I think this problem is quite simple to you.
I'm new to z-uno and I cannot figure out this problem.
I have a relay and one DHT22 sensor. But I cannot get my temperatur or humidity to shown in domoticz but in "serial monitor" it shows my realy works like a charm!
#include "ZUNO_DHT.h"
// pin number, where relay is connected
#define RELAY_PIN 12
#define DHTPIN 9
DHT dht(DHTPIN, DHT11);
// variable to store current relay state
byte lastSetValue;
int humidity; // here we will store the humidity
int temperature; // here we will store the temperature
// next macro sets up the Z-Uno channels
ZUNO_SETUP_CHANNELS(
ZUNO_SWITCH_BINARY(getter, setter),
ZUNO_SENSOR_MULTILEVEL_TEMPERATURE(getterTemperature),
ZUNO_SENSOR_MULTILEVEL_HUMIDITY(getterHumidity)
);
void setup() {
pinMode(RELAY_PIN, OUTPUT); // set up relay pin as output
dht.begin();
Serial.begin();
Serial.println("start");
}
void loop() {
// loop is empty, because all the control comes over the Z-Wave
// obtaining readings from the sensor DHT
humidity = dht.readHumidity();
temperature = dht.readTemperature();
Serial.print("Humidity = ");
Serial.print(humidity);
Serial.print(" % ");
Serial.print("Temperature = ");
Serial.print(temperature);
Serial.println(" *C");
// send data to channels
zunoSendReport(1);
zunoSendReport(2);
// send every 30 second
delay(30000);
}
byte getterTemperature() {
return temperature;
}
byte getterHumidity() {
return humidity;
}
// function, which returns the previously saved relay value
// this function runs only once the controller asks
byte getter() {
return lastSetValue;
}
// function, which sets new relay state
// this function runs only once the controller sends new value
void setter(byte newValue) {
// newValue is a variable, holding a "value"
// which came from the controller or other Z-Wave device
if (newValue > 0) { // if greater then zero
digitalWrite(RELAY_PIN, LOW); //turn relay on
} else { // if equals zero
digitalWrite(RELAY_PIN, HIGH); //turn relay off
}
// save the new value in a variable
lastSetValue = newValue;
}
#include "ZUNO_DHT.h"
// Pin number
#define RELAY_PIN 12 // Realy pin
#define DHTPIN 9 // DHT22 sensor
#define WATER_PIN 10 // Water level sensor
DHT dht(DHTPIN, DHT11);
// variable to store current state
byte relayValue; // here we will store the realy state
byte waterValue; // here we will store the water level state
int humidity; // here we will store the humidity
int temperature; // here we will store the temperature
// Sets up the Z-Uno channels
ZUNO_SETUP_CHANNELS(
ZUNO_SWITCH_BINARY(getterRelay1, setterRelay1),
ZUNO_SWITCH_BINARY(getterWater, setterWater),
ZUNO_SENSOR_MULTILEVEL_TEMPERATURE(getterTemperature),
ZUNO_SENSOR_MULTILEVEL_HUMIDITY(getterHumidity)
);
void setup() {
// set up I/O pins
pinMode(RELAY_PIN, OUTPUT); // set up relay pin as output
pinMode(WATER_PIN, INPUT_PULLUP); // Control water level
dht.begin();
Serial.begin();
Serial.println("start");
}
void loop() {
// obtaining readings from the sensor DHT
humidity = dht.readHumidity();
temperature = dht.readTemperature();
Serial.print("Humidity = ");
Serial.print(humidity);
Serial.print(" % ");
Serial.print("Temperature = ");
Serial.print(temperature);
Serial.println(" *C");
// obtaining readings from switches
Serial.print("But1=");
Serial.print(digitalRead(WATER_PIN));
// send every 10 second
delay(10000);
}
// function, which returns the previously saved value
// this function runs only once the controller asks
byte getterRelay1() {
return relayValue;
// send data to channel
zunoSendReport(1);
}
byte getterWater() {
return waterValue;
// send data to channel
zunoSendReport(2);
}
byte getterTemperature() {
return temperature;
// send data to channel
zunoSendReport(3);
}
byte getterHumidity() {
return humidity;
// send data to channel
zunoSendReport(3);
}
// function, which sets new relay state
// this function runs only once the controller sends new value
void setterRelay1(byte newValue) {
// newValue is a variable, holding a "value"
// which came from the controller or other Z-Wave device
if (newValue > 0) { // if greater then zero
digitalWrite(RELAY_PIN, LOW); //turn relay on
} else { // if equals zero
digitalWrite(RELAY_PIN, HIGH); //turn relay off
}
// save the new value in a variable
relayValue = newValue;
}