Z-Uno och Vera?

Generell info kring Z-Wave
Post Reply
n0ir
Ny medlem
Posts: 13
Joined: 13 Mar 2013, 18:25
11

Har precis köpt en Z-Uno för att ersätta en Fibaro Universal Sensor. Någon som har hunnit sätta sig in i Z-Uno?

Vill kunna koppla in 5 st. DS18B20-sensorer, hålla koll på om ett relä är öppet eller inte samt mäta avstånd med en HC-SR04.

När jag laddar upp en mycket enkel sketch med endast två DS18B20 (för att lära mig grunderna innan jag knåpar ihop den riktiga sketchen) så ser det ut så här i Vera.
2016-11-23.png
Vad gör jag för fel? Visst kan Vera läsa DS18B20 med Z-Uno? Det stod på Z-Unos hemsida att "only most popular sensors scales, switches and dimmers are supported" med Vera.

Prövade att ladda in 10 Channels Certified Sketch (https://z-uno.z-wave.me/examples/Certified10Channels/) och även om jag inte har alla sensorer som krävs inkopplade så fyker det ju i.a.f. upp många enheter i veran efter en ny inklusion. Varför dyker det bara upp en temperatursensor i Vera när jag har två 1-Wire enheter?

Code: Select all

 // Multiple temperature sensors 

#include <ZUNO_DS18B20.h>

// DS18B20 pin connections 
#define PIN_OW 9 // this is s_pin number and it have to be in range[9;16]


// We can connect a lot of 1-wire devices to 1-pin
// Because 1-wire is BUS with addresses
OneWire ow(PIN_OW);
// We need only one sensor in one moment of time to read it, so just
// create one object of it 
DS18B20Sensor sen18b20(&ow);
// Currrently uCxx (v 0.810) doesn't support an array of constructed object
// But you can use an array of pointers to object
// For example in terms of 18b20:
// DS18B20Sensor sen1(&ow);
// DS18B20Sensor sen2(&ow);
// DS18B20Sensor * sensors[] = {&sen1, &sen2};

// Anyway you don't need it ^ here :) 

// Instead of it we have to know adresses of all sensors that you connect to your 1-Wire bus.
// You can detect it if you connect it alone to the BUS one by one and record them addresses
// use scanAloneSensor() it returns 8-byte unique address of sensor connected to the BUS and fill sensor_addresses. This addresses is unique for any 1-wire device. 

#define NUMBER_OF_SENSORS 2
#define ADDR_SIZE 8


byte sensor_addresses[NUMBER_OF_SENSORS][ADDR_SIZE] = {
{0x28, 0x1C, 0xD7, 0x3B, 0x05, 0x00, 0x00, 0xDE},
{0x28, 0x43, 0x9C, 0x3B, 0x05, 0x00, 0x00, 0x4D}
};

int temp[NUMBER_OF_SENSORS]; 

ZUNO_SETUP_CHANNELS(
ZUNO_SENSOR_MULTILEVEL(ZUNO_SENSOR_MULTILEVEL_TYPE_TEMPERATURE, SENSOR_MULTILEVEL_SCALE_CELSIUS, SENSOR_MULTILEVEL_SIZE_TWO_BYTES, SENSOR_MULTILEVEL_PRECISION_TWO_DECIMALS, getterTemp0),
ZUNO_SENSOR_MULTILEVEL(ZUNO_SENSOR_MULTILEVEL_TYPE_TEMPERATURE, SENSOR_MULTILEVEL_SCALE_CELSIUS, SENSOR_MULTILEVEL_SIZE_TWO_BYTES, SENSOR_MULTILEVEL_PRECISION_TWO_DECIMALS, getterTemp1));

void setup() {
Serial.begin();
Serial.println("start"); 
}

void loop() 
{
// use byte instead of int to reduce code size
for (byte i=0; i<NUMBER_OF_SENSORS; i++)
{
// Use fixed point math
// get temperature of sensor with address sensor_addresses[i] 
temp[i] = sen18b20.getTempC100(sensor_addresses[i]);

Serial.print("Sensor ");
Serial.print(i);
Serial.print(" address is: ");
for (byte j = 0; j < ADDR_SIZE; j++)
{
Serial.print(sensor_addresses[i][j], HEX);
Serial.print(" ");
}

Serial.println();
Serial.print("Temperature: ");
Serial.println(temp[i]/100.0);
Serial.println();

// Sending report to the right channel
zunoSendReport(1 + i); 
}


delay(30000);
}

word getterTemp0() 
{
return temp[0];
}

word getterTemp1() 
{
return temp[1];
}
Post Reply