openHAB 2.0 binding
-
@TimO Cool, I'll test it once you are done. Domoticz only allows to either use the white channel or a RGB value (without the white) at the moment. Perhaps it can be done similarly in openhab.
@LastSamurai Could you please take a look at this: https://github.com/tobof/openhab2-addons/issues/76 ?
I've added the RGB & RGBW channels and because I'm not that confident about the RGBW implementation I'm kindly asking you to test the implementation and give me some feedback. :-)
The conversion from HSB, which is used by OpenHAB2 internally, to RGBW left me pretty confused. ;-) -
I'll test it. Might take some days to get to it though ;)
-
Hey guys, first message on this forum. Been reading alot before. But now I have a problem I just can't solve.
It's about smartsleep with openhab 2.
Im using wifi gw rfm 69.
Regular messages works as it should both ways.
But it almost seems like the smartsleep isn't enabled in the binding.
Here are my configs and logs.Things file:
Bridge mysensors:bridge-eth:gw69 [ ipAddress="192.168.1.235", tcpPort=5003, sendDelay=100, enableNetworkSanCheck=true ] { // Anarduino humidity AnHum [ nodeId="66", childId="0" ] temperature AnTemp [ nodeId="66", childId="1" ] light light02 [ nodeId="66", childId="3", smartSleep=true ] }Items file:
Switch TestLight "Test lampa" (Test) { channel="mysensors:light:gw69:light02:status" }Sketch: (Cleaned up the parts that dont matter, RTC and so on.)
// Enable debug prints to serial monitor #define MY_DEBUG // Enable and select radio type attached #define MY_RADIO_RFM69 #define MY_IS_RFM69HW #define MY_NODE_ID 66 #define MY_RFM69_NETWORKID 100 #define MY_RFM69_FREQUENCY RF69_433MHZ #define MY_SMART_SLEEP_WAIT_DURATION_MS 1000 #include <MySensors.h> #include <TimeLib.h> #include <Wire.h> #include <MCP7940RTC.h> #include <DHT.h> #define MCP7940_CTRL_ID 0x6F #define CSMEM_PIN 5 #define LEDPIN 9 long sleepIntervalSec=5; long loopCnt=0; uint8_t d[8]; uint8_t dAlarm[8]; int d1[8]; // Set this to the pin you connected the DHT's data pin to #define DHT_DATA_PIN 6 // Set this offset if the sensor has a permanent small offset to the real temperatures #define SENSOR_TEMP_OFFSET 0 // Sleep time between sensor updates (in milliseconds) // Must be >1000ms for DHT22 and >2000ms for DHT11 static const uint64_t UPDATE_INTERVAL = 5000; // Force sending an update of the temperature after n sensor reads, so a controller showing the // timestamp of the last update doesn't show something like 3 hours in the unlikely case, that // the value didn't change since; // i.e. the sensor would force sending an update every UPDATE_INTERVAL*FORCE_UPDATE_N_READS [ms] static const uint8_t FORCE_UPDATE_N_READS = 10; #define CHILD_ID_HUM 0 #define CHILD_ID_TEMP 1 #define CHILD_ID_MULTIMETER 2 float lastTemp; float lastHum; uint8_t nNoUpdatesTemp; uint8_t nNoUpdatesHum; bool metric = true; MyMessage msgHum(CHILD_ID_HUM, V_HUM); MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP); MyMessage msgVolt(CHILD_ID_MULTIMETER, V_VOLTAGE); DHT dht; int BATTERY_SENSE_PIN = A0; // select the input pin for the battery sense point int oldBatteryPcnt = 0; int batteryBasement = 812; int batteryFull = 922; float batteryConstant = 100.0 / (batteryFull - batteryBasement); float lastbatteryV = 0; const int buzzer = 7; //buzzer to arduino pin 7 #define RELAY_1 8 // Arduino Digital I/O pin number for first relay (second on pin+1 etc) #define NUMBER_OF_RELAYS 1 // Total number of attached relays #define RELAY_ON 1 // GPIO value to write to turn on attached relay #define RELAY_OFF 0 // GPIO value to write to turn off attached relay void before() { for (int sensor=3, pin=RELAY_1; sensor<=NUMBER_OF_RELAYS; sensor++, pin++) { // Then set relay pins in output mode pinMode(pin, OUTPUT); // Set relay to last known state (using eeprom storage) digitalWrite(pin, loadState(sensor)?RELAY_ON:RELAY_OFF); } } void setup() { // use the 1.1 V internal reference analogReference(INTERNAL); pinMode(LEDPIN, OUTPUT); digitalWrite(LEDPIN, LOW); Wire.begin(); pinMode(CSMEM_PIN, OUTPUT); digitalWrite(CSMEM_PIN, HIGH); dht.setup(DHT_DATA_PIN); // set data pin of DHT sensor if (UPDATE_INTERVAL <= dht.getMinimumSamplingPeriod()) { Serial.println("Warning: UPDATE_INTERVAL is smaller than supported by the sensor!"); } // Sleep for the time of the minimum sampling period to give the sensor time to power up // (otherwise, timeout errors might occure for the first reading) sleepIntervalSec = dht.getMinimumSamplingPeriod(); clearAlarm(); delay(20); setNewAlarm(); sleep(dht.getMinimumSamplingPeriod()); analogRead(BATTERY_SENSE_PIN); } void presentation() { // Send the sketch version information to the gateway and Controller sendSketchInfo("Humidity sensor", "1.0"); present(CHILD_ID_MULTIMETER, S_MULTIMETER, "VOLT", true); present(CHILD_ID_HUM, S_HUM, "HUMIDITY", true); present(CHILD_ID_TEMP, S_TEMP, "TEMP", true); for (int sensor=1, pin=RELAY_1; sensor<=NUMBER_OF_RELAYS; sensor++, pin++) { // Register all sensors to gw (they will be created as child devices) present(sensor, S_BINARY); } metric = getControllerConfig().isMetric; } void loop() { wait(100); int sensorValue = analogRead(BATTERY_SENSE_PIN); #ifdef MY_DEBUG Serial.println(sensorValue); #endif float batteryV = sensorValue * 0.004551646; if(sensorValue < batteryBasement) { sensorValue = batteryBasement; batteryV = 0; } else if (sensorValue > batteryFull) { sensorValue = batteryFull; } int batteryPcnt = (sensorValue - batteryBasement) * batteryConstant; if ((abs(oldBatteryPcnt - batteryPcnt) > 1)) { sendBatteryLevel(batteryPcnt); oldBatteryPcnt = batteryPcnt; } if(batteryV != lastbatteryV) { send(msgVolt.set(batteryV, 2)); lastbatteryV = batteryV; } #ifdef MY_DEBUG Serial.print("Battery Voltage: "); Serial.print(batteryV); Serial.println(" V"); Serial.print("Battery percent: "); Serial.print(batteryPcnt); Serial.println(" %"); #endif // Force reading sensor, so it works also after sleep() dht.readSensor(true); // Get temperature from DHT library float temperature = dht.getTemperature(); if (isnan(temperature)) { Serial.println("Failed reading temperature from DHT!"); } else if (temperature != lastTemp || nNoUpdatesTemp == FORCE_UPDATE_N_READS) { // Only send temperature if it changed since the last measurement or if we didn't send an update for n times lastTemp = temperature; if (!metric) { temperature = dht.toFahrenheit(temperature); } // Reset no updates counter nNoUpdatesTemp = 0; temperature += SENSOR_TEMP_OFFSET; send(msgTemp.set(temperature, 1)); #ifdef MY_DEBUG Serial.print("T: "); Serial.println(temperature); #endif } else { // Increase no update counter if the temperature stayed the same nNoUpdatesTemp++; } // Get humidity from DHT library float humidity = dht.getHumidity(); if (isnan(humidity)) { Serial.println("Failed reading humidity from DHT"); } else if (humidity != lastHum || nNoUpdatesHum == FORCE_UPDATE_N_READS) { // Only send humidity if it changed since the last measurement or if we didn't send an update for n times lastHum = humidity; // Reset no updates counter nNoUpdatesHum = 0; send(msgHum.set(humidity, 1)); #ifdef MY_DEBUG Serial.print("H: "); Serial.println(humidity); #endif } else { // Increase no update counter if the humidity stayed the same nNoUpdatesHum++; } long sleepTime = UPDATE_INTERVAL; if (batteryPcnt < 50) { sleepTime = (sleepTime * 2); } // Sleep for a while to save energy sleepIntervalSec = sleepTime / 1000; Serial.println(); Serial.print("Setting new sleep time: "); Serial.print(sleepIntervalSec); Serial.println(" seconds."); clearAlarm(); delay(20); setNewAlarm(); smartSleep(sleepTime); } void receive(const MyMessage &message) { // We only expect one type of message from controller. But we better check anyway. if (message.type==V_STATUS) { // Change relay state digitalWrite(message.sensor-1+RELAY_1, message.getBool()?RELAY_ON:RELAY_OFF); // Store state in eeprom saveState(message.sensor, message.getBool()); // Write some debug info Serial.print("Incoming change for sensor:"); Serial.print(message.sensor); Serial.print(", New status: "); Serial.println(message.getBool()); } }Sensor startup:
0 MCO:BGN:INIT NODE,CP=RRNNA--,VER=2.1.1 3 MCO:BGN:BFR 4 TSM:INIT 5 TSF:WUR:MS=0 8 TSM:INIT:TSP OK 9 TSM:INIT:STATID=66 11 TSF:SID:OK,ID=66 13 TSM:FPAR 143 TSF:MSG:SEND,66-66-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK: 524 TSF:MSG:READ,0-0-66,s=255,c=3,t=8,pt=1,l=1,sg=0:0 529 TSF:MSG:FPAR OK,ID=0,D=1 2150 TSM:FPAR:OK 2151 TSM:ID 2152 TSM:ID:OK 2154 TSM:UPL 2161 TSF:MSG:SEND,66-66-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=OK:1 2181 TSF:MSG:READ,0-0-66,s=255,c=3,t=25,pt=1,l=1,sg=0:1 2186 TSF:MSG:PONG RECV,HP=1 2189 TSM:UPL:OK 2190 TSM:READY:ID=66,PAR=0,DIS=1 2199 TSF:MSG:SEND,66-66-0-0,s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=OK:0100 2253 TSF:MSG:READ,0-0-66,s=255,c=3,t=15,pt=6,l=2,sg=0:0100 2310 TSF:MSG:SEND,66-66-0-0,s=255,c=0,t=17,pt=0,l=5,sg=0,ft=0,st=OK:2.1.1 2366 TSF:MSG:SEND,66-66-0-0,s=255,c=3,t=6,pt=1,l=1,sg=0,ft=0,st=OK:0 2403 TSF:MSG:READ,0-0-66,s=255,c=3,t=6,pt=0,l=1,sg=0:M 2461 TSF:MSG:SEND,66-66-0-0,s=255,c=3,t=11,pt=0,l=15,sg=0,ft=0,st=OK:Humidity sensor 2562 TSF:MSG:SEND,66-66-0-0,s=255,c=3,t=12,pt=0,l=3,sg=0,ft=0,st=OK:1.0 2618 TSF:MSG:SEND,66-66-0-0,s=2,c=0,t=30,pt=0,l=4,sg=0,ft=0,st=OK:VOLT 2757 !TSF:MSG:SEND,66-66-0-0,s=0,c=0,t=7,pt=0,l=8,sg=0,ft=0,st=NACK:HUMIDITY 2777 TSF:MSG:SEND,66-66-0-0,s=1,c=0,t=6,pt=0,l=4,sg=0,ft=1,st=OK:TEMP 2912 !TSF:MSG:SEND,66-66-0-0,s=1,c=0,t=3,pt=0,l=0,sg=0,ft=0,st=NACK: 2918 MCO:REG:REQ 2974 TSF:MSG:SEND,66-66-0-0,s=255,c=3,t=26,pt=1,l=1,sg=0,ft=1,st=OK:2 2991 TSF:MSG:READ,0-0-66,s=255,c=3,t=27,pt=1,l=1,sg=0:1 2996 MCO:PIM:NODE REG=1 2999 MCO:BGN:STP 3154 MCO:SLP:MS=2000,SMS=0,I1=255,M1=255,I2=255,M2=255 3160 MCO:SLP:TPD 3161 MCO:SLP:WUP=-1 3163 MCO:BGN:INIT OK,TSP=1Log Sensor: (This is when I press the button when the sensor is awake)
It's sends away it's heartbeat correctly.125578 TSF:MSG:READ,0-0-66,s=3,c=1,t=2,pt=0,l=1,sg=0:0 Incoming change for sensor:3, New status: 0 Setting new sleep time: 5 seconds. 137926 MCO:SLP:MS=5000,SMS=1,I1=255,M1=255,I2=255,M2=255 137939 TSF:MSG:SEND,66-66-0-0,s=255,c=3,t=22,pt=5,l=4,sg=0,ft=0,st=OK:134932Log Openhab: And the gateway receives heartbeat.
18:21:37.174 [DEBUG] [rs.internal.protocol.MySensorsWriter] - Sending to MySensors: 66;3;1;0;2;0 18:21:37.178 [INFO ] [smarthome.event.ItemCommandEvent ] - Item 'TestLight' received command OFF 18:21:37.181 [INFO ] [marthome.event.ItemStateChangedEvent] - TestLight changed from ON to OFF 18:22:15.416 [DEBUG] [rs.internal.protocol.MySensorsReader] - 66;255;3;0;22;134932 18:22:16.372 [DEBUG] [rs.internal.protocol.MySensorsWriter] - Sending to MySensors: 0;0;3;0;2; 18:22:16.408 [DEBUG] [rs.internal.protocol.MySensorsReader] - 0;255;3;0;2;2.1.1Log Openhab: When the node sleeps..
18:26:52.396 [DEBUG] [rs.internal.protocol.MySensorsWriter] - Sending to MySensors: 66;3;1;0;2;0 18:26:52.397 [INFO ] [smarthome.event.ItemCommandEvent ] - Item 'TestLight' received command OFF 18:26:52.399 [INFO ] [marthome.event.ItemStateChangedEvent] - TestLight changed from ON to OFFAs you can see there is no mention in the openhab log file about buffering or smart sleep. Or a received heartbeat. Which it gets.
What am I doing wrong?I found the solution myself. About a week ago i upgraded the binding. And it worked.
Everything seems to work as it should. Except I can't recieve var1 (custom) for neither the hum or temp child.smartSleep is nice. I use it once an hour (regular sleep every minute) to get configurations from openhab about sleep time and other small things in the code.
@balder88 said in openHAB 2.0 binding:
Hey guys, first message on this forum. Been reading alot before. But now I have a problem I just can't solve.
It's about smartsleep with openhab 2.
Im using wifi gw rfm 69.
Regular messages works as it should both ways.
But it almost seems like the smartsleep isn't enabled in the binding.
Here are my configs and logs.Things file:
Bridge mysensors:bridge-eth:gw69 [ ipAddress="192.168.1.235", tcpPort=5003, sendDelay=100, enableNetworkSanCheck=true ] { // Anarduino humidity AnHum [ nodeId="66", childId="0" ] temperature AnTemp [ nodeId="66", childId="1" ] light light02 [ nodeId="66", childId="3", smartSleep=true ] }Items file:
Switch TestLight "Test lampa" (Test) { channel="mysensors:light:gw69:light02:status" }Sketch: (Cleaned up the parts that dont matter, RTC and so on.)
// Enable debug prints to serial monitor #define MY_DEBUG // Enable and select radio type attached #define MY_RADIO_RFM69 #define MY_IS_RFM69HW #define MY_NODE_ID 66 #define MY_RFM69_NETWORKID 100 #define MY_RFM69_FREQUENCY RF69_433MHZ #define MY_SMART_SLEEP_WAIT_DURATION_MS 1000 #include <MySensors.h> #include <TimeLib.h> #include <Wire.h> #include <MCP7940RTC.h> #include <DHT.h> #define MCP7940_CTRL_ID 0x6F #define CSMEM_PIN 5 #define LEDPIN 9 long sleepIntervalSec=5; long loopCnt=0; uint8_t d[8]; uint8_t dAlarm[8]; int d1[8]; // Set this to the pin you connected the DHT's data pin to #define DHT_DATA_PIN 6 // Set this offset if the sensor has a permanent small offset to the real temperatures #define SENSOR_TEMP_OFFSET 0 // Sleep time between sensor updates (in milliseconds) // Must be >1000ms for DHT22 and >2000ms for DHT11 static const uint64_t UPDATE_INTERVAL = 5000; // Force sending an update of the temperature after n sensor reads, so a controller showing the // timestamp of the last update doesn't show something like 3 hours in the unlikely case, that // the value didn't change since; // i.e. the sensor would force sending an update every UPDATE_INTERVAL*FORCE_UPDATE_N_READS [ms] static const uint8_t FORCE_UPDATE_N_READS = 10; #define CHILD_ID_HUM 0 #define CHILD_ID_TEMP 1 #define CHILD_ID_MULTIMETER 2 float lastTemp; float lastHum; uint8_t nNoUpdatesTemp; uint8_t nNoUpdatesHum; bool metric = true; MyMessage msgHum(CHILD_ID_HUM, V_HUM); MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP); MyMessage msgVolt(CHILD_ID_MULTIMETER, V_VOLTAGE); DHT dht; int BATTERY_SENSE_PIN = A0; // select the input pin for the battery sense point int oldBatteryPcnt = 0; int batteryBasement = 812; int batteryFull = 922; float batteryConstant = 100.0 / (batteryFull - batteryBasement); float lastbatteryV = 0; const int buzzer = 7; //buzzer to arduino pin 7 #define RELAY_1 8 // Arduino Digital I/O pin number for first relay (second on pin+1 etc) #define NUMBER_OF_RELAYS 1 // Total number of attached relays #define RELAY_ON 1 // GPIO value to write to turn on attached relay #define RELAY_OFF 0 // GPIO value to write to turn off attached relay void before() { for (int sensor=3, pin=RELAY_1; sensor<=NUMBER_OF_RELAYS; sensor++, pin++) { // Then set relay pins in output mode pinMode(pin, OUTPUT); // Set relay to last known state (using eeprom storage) digitalWrite(pin, loadState(sensor)?RELAY_ON:RELAY_OFF); } } void setup() { // use the 1.1 V internal reference analogReference(INTERNAL); pinMode(LEDPIN, OUTPUT); digitalWrite(LEDPIN, LOW); Wire.begin(); pinMode(CSMEM_PIN, OUTPUT); digitalWrite(CSMEM_PIN, HIGH); dht.setup(DHT_DATA_PIN); // set data pin of DHT sensor if (UPDATE_INTERVAL <= dht.getMinimumSamplingPeriod()) { Serial.println("Warning: UPDATE_INTERVAL is smaller than supported by the sensor!"); } // Sleep for the time of the minimum sampling period to give the sensor time to power up // (otherwise, timeout errors might occure for the first reading) sleepIntervalSec = dht.getMinimumSamplingPeriod(); clearAlarm(); delay(20); setNewAlarm(); sleep(dht.getMinimumSamplingPeriod()); analogRead(BATTERY_SENSE_PIN); } void presentation() { // Send the sketch version information to the gateway and Controller sendSketchInfo("Humidity sensor", "1.0"); present(CHILD_ID_MULTIMETER, S_MULTIMETER, "VOLT", true); present(CHILD_ID_HUM, S_HUM, "HUMIDITY", true); present(CHILD_ID_TEMP, S_TEMP, "TEMP", true); for (int sensor=1, pin=RELAY_1; sensor<=NUMBER_OF_RELAYS; sensor++, pin++) { // Register all sensors to gw (they will be created as child devices) present(sensor, S_BINARY); } metric = getControllerConfig().isMetric; } void loop() { wait(100); int sensorValue = analogRead(BATTERY_SENSE_PIN); #ifdef MY_DEBUG Serial.println(sensorValue); #endif float batteryV = sensorValue * 0.004551646; if(sensorValue < batteryBasement) { sensorValue = batteryBasement; batteryV = 0; } else if (sensorValue > batteryFull) { sensorValue = batteryFull; } int batteryPcnt = (sensorValue - batteryBasement) * batteryConstant; if ((abs(oldBatteryPcnt - batteryPcnt) > 1)) { sendBatteryLevel(batteryPcnt); oldBatteryPcnt = batteryPcnt; } if(batteryV != lastbatteryV) { send(msgVolt.set(batteryV, 2)); lastbatteryV = batteryV; } #ifdef MY_DEBUG Serial.print("Battery Voltage: "); Serial.print(batteryV); Serial.println(" V"); Serial.print("Battery percent: "); Serial.print(batteryPcnt); Serial.println(" %"); #endif // Force reading sensor, so it works also after sleep() dht.readSensor(true); // Get temperature from DHT library float temperature = dht.getTemperature(); if (isnan(temperature)) { Serial.println("Failed reading temperature from DHT!"); } else if (temperature != lastTemp || nNoUpdatesTemp == FORCE_UPDATE_N_READS) { // Only send temperature if it changed since the last measurement or if we didn't send an update for n times lastTemp = temperature; if (!metric) { temperature = dht.toFahrenheit(temperature); } // Reset no updates counter nNoUpdatesTemp = 0; temperature += SENSOR_TEMP_OFFSET; send(msgTemp.set(temperature, 1)); #ifdef MY_DEBUG Serial.print("T: "); Serial.println(temperature); #endif } else { // Increase no update counter if the temperature stayed the same nNoUpdatesTemp++; } // Get humidity from DHT library float humidity = dht.getHumidity(); if (isnan(humidity)) { Serial.println("Failed reading humidity from DHT"); } else if (humidity != lastHum || nNoUpdatesHum == FORCE_UPDATE_N_READS) { // Only send humidity if it changed since the last measurement or if we didn't send an update for n times lastHum = humidity; // Reset no updates counter nNoUpdatesHum = 0; send(msgHum.set(humidity, 1)); #ifdef MY_DEBUG Serial.print("H: "); Serial.println(humidity); #endif } else { // Increase no update counter if the humidity stayed the same nNoUpdatesHum++; } long sleepTime = UPDATE_INTERVAL; if (batteryPcnt < 50) { sleepTime = (sleepTime * 2); } // Sleep for a while to save energy sleepIntervalSec = sleepTime / 1000; Serial.println(); Serial.print("Setting new sleep time: "); Serial.print(sleepIntervalSec); Serial.println(" seconds."); clearAlarm(); delay(20); setNewAlarm(); smartSleep(sleepTime); } void receive(const MyMessage &message) { // We only expect one type of message from controller. But we better check anyway. if (message.type==V_STATUS) { // Change relay state digitalWrite(message.sensor-1+RELAY_1, message.getBool()?RELAY_ON:RELAY_OFF); // Store state in eeprom saveState(message.sensor, message.getBool()); // Write some debug info Serial.print("Incoming change for sensor:"); Serial.print(message.sensor); Serial.print(", New status: "); Serial.println(message.getBool()); } }Sensor startup:
0 MCO:BGN:INIT NODE,CP=RRNNA--,VER=2.1.1 3 MCO:BGN:BFR 4 TSM:INIT 5 TSF:WUR:MS=0 8 TSM:INIT:TSP OK 9 TSM:INIT:STATID=66 11 TSF:SID:OK,ID=66 13 TSM:FPAR 143 TSF:MSG:SEND,66-66-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK: 524 TSF:MSG:READ,0-0-66,s=255,c=3,t=8,pt=1,l=1,sg=0:0 529 TSF:MSG:FPAR OK,ID=0,D=1 2150 TSM:FPAR:OK 2151 TSM:ID 2152 TSM:ID:OK 2154 TSM:UPL 2161 TSF:MSG:SEND,66-66-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=OK:1 2181 TSF:MSG:READ,0-0-66,s=255,c=3,t=25,pt=1,l=1,sg=0:1 2186 TSF:MSG:PONG RECV,HP=1 2189 TSM:UPL:OK 2190 TSM:READY:ID=66,PAR=0,DIS=1 2199 TSF:MSG:SEND,66-66-0-0,s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=OK:0100 2253 TSF:MSG:READ,0-0-66,s=255,c=3,t=15,pt=6,l=2,sg=0:0100 2310 TSF:MSG:SEND,66-66-0-0,s=255,c=0,t=17,pt=0,l=5,sg=0,ft=0,st=OK:2.1.1 2366 TSF:MSG:SEND,66-66-0-0,s=255,c=3,t=6,pt=1,l=1,sg=0,ft=0,st=OK:0 2403 TSF:MSG:READ,0-0-66,s=255,c=3,t=6,pt=0,l=1,sg=0:M 2461 TSF:MSG:SEND,66-66-0-0,s=255,c=3,t=11,pt=0,l=15,sg=0,ft=0,st=OK:Humidity sensor 2562 TSF:MSG:SEND,66-66-0-0,s=255,c=3,t=12,pt=0,l=3,sg=0,ft=0,st=OK:1.0 2618 TSF:MSG:SEND,66-66-0-0,s=2,c=0,t=30,pt=0,l=4,sg=0,ft=0,st=OK:VOLT 2757 !TSF:MSG:SEND,66-66-0-0,s=0,c=0,t=7,pt=0,l=8,sg=0,ft=0,st=NACK:HUMIDITY 2777 TSF:MSG:SEND,66-66-0-0,s=1,c=0,t=6,pt=0,l=4,sg=0,ft=1,st=OK:TEMP 2912 !TSF:MSG:SEND,66-66-0-0,s=1,c=0,t=3,pt=0,l=0,sg=0,ft=0,st=NACK: 2918 MCO:REG:REQ 2974 TSF:MSG:SEND,66-66-0-0,s=255,c=3,t=26,pt=1,l=1,sg=0,ft=1,st=OK:2 2991 TSF:MSG:READ,0-0-66,s=255,c=3,t=27,pt=1,l=1,sg=0:1 2996 MCO:PIM:NODE REG=1 2999 MCO:BGN:STP 3154 MCO:SLP:MS=2000,SMS=0,I1=255,M1=255,I2=255,M2=255 3160 MCO:SLP:TPD 3161 MCO:SLP:WUP=-1 3163 MCO:BGN:INIT OK,TSP=1Log Sensor: (This is when I press the button when the sensor is awake)
It's sends away it's heartbeat correctly.125578 TSF:MSG:READ,0-0-66,s=3,c=1,t=2,pt=0,l=1,sg=0:0 Incoming change for sensor:3, New status: 0 Setting new sleep time: 5 seconds. 137926 MCO:SLP:MS=5000,SMS=1,I1=255,M1=255,I2=255,M2=255 137939 TSF:MSG:SEND,66-66-0-0,s=255,c=3,t=22,pt=5,l=4,sg=0,ft=0,st=OK:134932Log Openhab: And the gateway receives heartbeat.
18:21:37.174 [DEBUG] [rs.internal.protocol.MySensorsWriter] - Sending to MySensors: 66;3;1;0;2;0 18:21:37.178 [INFO ] [smarthome.event.ItemCommandEvent ] - Item 'TestLight' received command OFF 18:21:37.181 [INFO ] [marthome.event.ItemStateChangedEvent] - TestLight changed from ON to OFF 18:22:15.416 [DEBUG] [rs.internal.protocol.MySensorsReader] - 66;255;3;0;22;134932 18:22:16.372 [DEBUG] [rs.internal.protocol.MySensorsWriter] - Sending to MySensors: 0;0;3;0;2; 18:22:16.408 [DEBUG] [rs.internal.protocol.MySensorsReader] - 0;255;3;0;2;2.1.1Log Openhab: When the node sleeps..
18:26:52.396 [DEBUG] [rs.internal.protocol.MySensorsWriter] - Sending to MySensors: 66;3;1;0;2;0 18:26:52.397 [INFO ] [smarthome.event.ItemCommandEvent ] - Item 'TestLight' received command OFF 18:26:52.399 [INFO ] [marthome.event.ItemStateChangedEvent] - TestLight changed from ON to OFFAs you can see there is no mention in the openhab log file about buffering or smart sleep. Or a received heartbeat. Which it gets.
What am I doing wrong? -
First I want to thank you for this binding, got it working with my esp8266 gateway without any problems at all. However, I want to ask how the reconnection problem is developing, any plans to solve it or is it not possible? I've tried to scan the thread but didn't find any information regarding it.
-
Thanks for making this binding! :)
One question, is there a specific reason motion (tripped) sensors have to be Contact items?
In OH2 all the Z-wave motion sensors are Switches (AFAIK) so it would be nice if the mysensor PIR's could also be Switches so I can just add these to my existing motion sensor groups and rules.(I tried setting a triggered channel as Switch but it didn't work)
-
Thanks for making this binding! :)
One question, is there a specific reason motion (tripped) sensors have to be Contact items?
In OH2 all the Z-wave motion sensors are Switches (AFAIK) so it would be nice if the mysensor PIR's could also be Switches so I can just add these to my existing motion sensor groups and rules.(I tried setting a triggered channel as Switch but it didn't work)
@Alpoy check this discussion on GitHub. The question is still open.
@antonholmstedt reconnection is currently implemented in binding (look here). Feel free to open an issue if you experience reconnection fails in your environment :smiley:
-
@Alpoy check this discussion on GitHub. The question is still open.
@antonholmstedt reconnection is currently implemented in binding (look here). Feel free to open an issue if you experience reconnection fails in your environment :smiley:
@antonholmstedt reconnection is currently implemented in binding (look here). Feel free to open an issue if you experience reconnection fails in your environment :smiley:
Yes I have reconnection problems right now, so will open an issue :)
-
I was checking back on this bindning and it really has matured!
On GitHub I see that there are some updates referring to MqTT protocol.
Are they available in the JAR that is posted here?
http://www.oberfoell.com/openhab2/org.openhab.binding.mysensors-2.0.0-SNAPSHOT.jarKudos on the great work!
-
I was checking back on this bindning and it really has matured!
On GitHub I see that there are some updates referring to MqTT protocol.
Are they available in the JAR that is posted here?
http://www.oberfoell.com/openhab2/org.openhab.binding.mysensors-2.0.0-SNAPSHOT.jarKudos on the great work!
@Nicklas-Starkel Well no, MQTT Gateway is not yet supported. :-(
I got distracted by my current hardware project and need to catch up on the binding. First tests of the MQTT addition to the binding look very promising and I'll include it soon.The current release is this one: http://www.oberfoell.com/openhab2/org.openhab.binding.mysensors-2.1.0-SNAPSHOT.jar
While preparing the code to be included in OpenHAB2 I'm currently changing some things that will break the current configuration / things files. But I will give some information about that with the release of the next version.
-
Hi @TimO, @andreacioni.
I am doing some "expert mode" rules where I need to get the NodeId of a specific sensors, or at least, to get all the configured Nodes Ids. Is that possible?
I would like to cron a rule where every X minutes, heartbeat request message is sent to all configured nodes, so as to see wether they are alive or not.
Thanks, regards.
-
Hi @TimO, @andreacioni.
I am doing some "expert mode" rules where I need to get the NodeId of a specific sensors, or at least, to get all the configured Nodes Ids. Is that possible?
I would like to cron a rule where every X minutes, heartbeat request message is sent to all configured nodes, so as to see wether they are alive or not.
Thanks, regards.
Hi @gonzalonal :smiley:
In the new version of binding we have implemented a (beta-)function that allows you to send heartbeat message at certain interval without the need to write your own rules.
Please take a lock at this gateway-parameter (you must have set enableNetworkSanCheck=true and sanityCheckerInterval).
With sanCheckSendHeartbeat parameter set you could also use this node-parameter to put your nodes offline after a certain number of failure.
I hope this function will help you!
-
Hi @gonzalonal :smiley:
In the new version of binding we have implemented a (beta-)function that allows you to send heartbeat message at certain interval without the need to write your own rules.
Please take a lock at this gateway-parameter (you must have set enableNetworkSanCheck=true and sanityCheckerInterval).
With sanCheckSendHeartbeat parameter set you could also use this node-parameter to put your nodes offline after a certain number of failure.
I hope this function will help you!
Hi @andreacioni . Thats a great feature.
But for the moment, I think I prefer doing it manually, by rules, because of the way in which I can show my offline nodes in my sitemap and configure custom notifications for them.For each node, I have a datetime item showing the time of last heartbeat response received. If more than 25' have passed (5 heartbeats request, 1 heartbeat request each 5 mins) without response, I fire up a notification telling that that specific node has gone offline.
So, back to my original question. Is there any way to get Node Ids at the rules engine?
Do you believe we can customize this kind of behavior with the beta feature proposed?
Thanks, regards.
-
@gonzalonal I have no clue! Could be possible, but better ask at the OH2 community because the node Id is something that is specified in the thing description (xml) and maybe it is possible to access this information in rules.
-
Does this happen to support MQTT gateways? You mention serial or ethernet, but openhab doesn't support ethernet so i'm assuming you mean ethernet as the mqtt ethernet gateway?
-
@Nicklas-Starkel Well no, MQTT Gateway is not yet supported. :-(
I got distracted by my current hardware project and need to catch up on the binding. First tests of the MQTT addition to the binding look very promising and I'll include it soon.The current release is this one: http://www.oberfoell.com/openhab2/org.openhab.binding.mysensors-2.1.0-SNAPSHOT.jar
While preparing the code to be included in OpenHAB2 I'm currently changing some things that will break the current configuration / things files. But I will give some information about that with the release of the next version.
Just few posts before 😉
@TimO said in openHAB 2.0 binding:
@Nicklas-Starkel Well no, MQTT Gateway is not yet supported. :-(
I got distracted by my current hardware project and need to catch up on the binding. First tests of the MQTT addition to the binding look very promising and I'll include it soon.The current release is this one: http://www.oberfoell.com/openhab2/org.openhab.binding.mysensors-2.1.0-SNAPSHOT.jar
While preparing the code to be included in OpenHAB2 I'm currently changing some things that will break the current configuration / things files. But I will give some information about that with the release of the next version.
-
I'm sorry, I ran a ctrl+f search and it either didn't show or i completely missed it, thank you for the prompt reply though.
In this case then i will have to wait for this release then as i can't achieve what i need to do with rules. Do we have any idea when the release will be?
-
Hi, did anyone hit the problem when it seems that all works fine
and then mysensors plugin start to think that it failed connecting to bridge (even if it doesnt actually)Should I find newer version (last jar I found is since 2017-01-18)
I put message from node every 1 second, and in log you will see "0;255;3;0;9;TSF:MSG:READ...." every second
but every 10 second it recconects saying "Failed connecting to bridge...next retry in 10 seconds (Retry No.:31).... Shutting down serial connection!...17:40:21.656 [DEBUG] [rs.internal.protocol.MySensorsReader] - 0;255;3;0;9;TSF:MSG:READ,202-202-0,s=1,c=1,t=37,pt=2,l=2,sg=0:468 17:40:21.657 [DEBUG] [rs.internal.protocol.MySensorsReader] - 202;1;1;0;37;468 17:40:22.421 [ERROR] [col.serial.MySensorsSerialConnection] - Can't connect to serial port. Wrong port? 17:40:22.424 [ERROR] [col.serial.MySensorsSerialConnection] - Failed connecting to bridge...next retry in 10 seconds (Retry No.:31) 17:40:22.425 [DEBUG] [col.serial.MySensorsSerialConnection] - Shutting down serial connection! 17:40:22.842 [DEBUG] [rs.internal.protocol.MySensorsReader] - 0;255;3;0;9;TSF:MSG:READ,202-202-0,s=1,c=1,t=37,pt=2,l=2,sg=0:486 17:40:22.844 [DEBUG] [rs.internal.protocol.MySensorsReader] - 202;1;1;0;37;486 17:40:24.029 [DEBUG] [rs.internal.protocol.MySensorsReader] - 0;255;3;0;9;TSF:MSG:READ,202-202-0,s=1,c=1,t=37,pt=2,l=2,sg=0:470 17:40:24.032 [DEBUG] [rs.internal.protocol.MySensorsReader] - 202;1;1;0;37;470 17:40:25.218 [DEBUG] [rs.internal.protocol.MySensorsReader] - 0;255;3;0;9;TSF:MSG:READ,202-202-0,s=1,c=1,t=37,pt=2,l=2,sg=0:474 17:40:25.222 [DEBUG] [rs.internal.protocol.MySensorsReader] - 202;1;1;0;37;474 17:40:26.406 [DEBUG] [rs.internal.protocol.MySensorsReader] - 0;255;3;0;9;TSF:MSG:READ,202-202-0,s=1,c=1,t=37,pt=2,l=2,sg=0:486 17:40:26.407 [DEBUG] [rs.internal.protocol.MySensorsReader] - 202;1;1;0;37;486 17:40:27.591 [DEBUG] [rs.internal.protocol.MySensorsReader] - 0;255;3;0;9;TSF:MSG:READ,202-202-0,s=1,c=1,t=37,pt=2,l=2,sg=0:466 17:40:27.592 [DEBUG] [rs.internal.protocol.MySensorsReader] - 202;1;1;0;37;466 17:40:28.783 [DEBUG] [rs.internal.protocol.MySensorsReader] - 0;255;3;0;9;TSF:MSG:READ,202-202-0,s=1,c=1,t=37,pt=2,l=2,sg=0:483 17:40:28.786 [DEBUG] [rs.internal.protocol.MySensorsReader] - 202;1;1;0;37;483 17:40:29.967 [DEBUG] [rs.internal.protocol.MySensorsReader] - 0;255;3;0;9;TSF:MSG:READ,202-202-0,s=1,c=1,t=37,pt=2,l=2,sg=0:483 17:40:29.972 [DEBUG] [rs.internal.protocol.MySensorsReader] - 202;1;1;0;37;483 17:40:31.158 [DEBUG] [rs.internal.protocol.MySensorsReader] - 0;255;3;0;9;TSF:MSG:READ,202-202-0,s=1,c=1,t=37,pt=2,l=2,sg=0:463 17:40:31.163 [DEBUG] [rs.internal.protocol.MySensorsReader] - 202;1;1;0;37;463 17:40:32.344 [DEBUG] [rs.internal.protocol.MySensorsReader] - 0;255;3;0;9;TSF:MSG:READ,202-202-0,s=1,c=1,t=37,pt=2,l=2,sg=0:487 17:40:32.346 [DEBUG] [rs.internal.protocol.MySensorsReader] - 202;1;1;0;37;487 17:40:32.431 [DEBUG] [col.serial.MySensorsSerialConnection] - Connecting to /dev/ttyUSB0 [baudRate:115200] 17:40:32.435 [DEBUG] [col.serial.MySensorsSerialConnection] - Final port list: /dev/ttyUSB0 17:40:33.530 [DEBUG] [rs.internal.protocol.MySensorsReader] - 0;255;3;0;9;TSF:MSG:READ,202-202-0,s=1,c=1,t=37,pt=2,l=2,sg=0:470 17:40:33.533 [DEBUG] [rs.internal.protocol.MySensorsReader] - 202;1;1;0;37;470 17:40:34.438 [ERROR] [col.serial.MySensorsSerialConnection] - Can't connect to serial port. Wrong port? 17:40:34.440 [ERROR] [col.serial.MySensorsSerialConnection] - Failed connecting to bridge...next retry in 10 seconds (Retry No.:32) 17:40:34.441 [DEBUG] [col.serial.MySensorsSerialConnection] - Shutting down serial connection! 17:40:34.720 [DEBUG] [rs.internal.protocol.MySensorsReader] - 0;255;3;0;9;TSF:MSG:READ,202-202-0,s=1,c=1,t=37,pt=2,l=2,sg=0:472 -
Hi, did anyone hit the problem when it seems that all works fine
and then mysensors plugin start to think that it failed connecting to bridge (even if it doesnt actually)Should I find newer version (last jar I found is since 2017-01-18)
I put message from node every 1 second, and in log you will see "0;255;3;0;9;TSF:MSG:READ...." every second
but every 10 second it recconects saying "Failed connecting to bridge...next retry in 10 seconds (Retry No.:31).... Shutting down serial connection!...17:40:21.656 [DEBUG] [rs.internal.protocol.MySensorsReader] - 0;255;3;0;9;TSF:MSG:READ,202-202-0,s=1,c=1,t=37,pt=2,l=2,sg=0:468 17:40:21.657 [DEBUG] [rs.internal.protocol.MySensorsReader] - 202;1;1;0;37;468 17:40:22.421 [ERROR] [col.serial.MySensorsSerialConnection] - Can't connect to serial port. Wrong port? 17:40:22.424 [ERROR] [col.serial.MySensorsSerialConnection] - Failed connecting to bridge...next retry in 10 seconds (Retry No.:31) 17:40:22.425 [DEBUG] [col.serial.MySensorsSerialConnection] - Shutting down serial connection! 17:40:22.842 [DEBUG] [rs.internal.protocol.MySensorsReader] - 0;255;3;0;9;TSF:MSG:READ,202-202-0,s=1,c=1,t=37,pt=2,l=2,sg=0:486 17:40:22.844 [DEBUG] [rs.internal.protocol.MySensorsReader] - 202;1;1;0;37;486 17:40:24.029 [DEBUG] [rs.internal.protocol.MySensorsReader] - 0;255;3;0;9;TSF:MSG:READ,202-202-0,s=1,c=1,t=37,pt=2,l=2,sg=0:470 17:40:24.032 [DEBUG] [rs.internal.protocol.MySensorsReader] - 202;1;1;0;37;470 17:40:25.218 [DEBUG] [rs.internal.protocol.MySensorsReader] - 0;255;3;0;9;TSF:MSG:READ,202-202-0,s=1,c=1,t=37,pt=2,l=2,sg=0:474 17:40:25.222 [DEBUG] [rs.internal.protocol.MySensorsReader] - 202;1;1;0;37;474 17:40:26.406 [DEBUG] [rs.internal.protocol.MySensorsReader] - 0;255;3;0;9;TSF:MSG:READ,202-202-0,s=1,c=1,t=37,pt=2,l=2,sg=0:486 17:40:26.407 [DEBUG] [rs.internal.protocol.MySensorsReader] - 202;1;1;0;37;486 17:40:27.591 [DEBUG] [rs.internal.protocol.MySensorsReader] - 0;255;3;0;9;TSF:MSG:READ,202-202-0,s=1,c=1,t=37,pt=2,l=2,sg=0:466 17:40:27.592 [DEBUG] [rs.internal.protocol.MySensorsReader] - 202;1;1;0;37;466 17:40:28.783 [DEBUG] [rs.internal.protocol.MySensorsReader] - 0;255;3;0;9;TSF:MSG:READ,202-202-0,s=1,c=1,t=37,pt=2,l=2,sg=0:483 17:40:28.786 [DEBUG] [rs.internal.protocol.MySensorsReader] - 202;1;1;0;37;483 17:40:29.967 [DEBUG] [rs.internal.protocol.MySensorsReader] - 0;255;3;0;9;TSF:MSG:READ,202-202-0,s=1,c=1,t=37,pt=2,l=2,sg=0:483 17:40:29.972 [DEBUG] [rs.internal.protocol.MySensorsReader] - 202;1;1;0;37;483 17:40:31.158 [DEBUG] [rs.internal.protocol.MySensorsReader] - 0;255;3;0;9;TSF:MSG:READ,202-202-0,s=1,c=1,t=37,pt=2,l=2,sg=0:463 17:40:31.163 [DEBUG] [rs.internal.protocol.MySensorsReader] - 202;1;1;0;37;463 17:40:32.344 [DEBUG] [rs.internal.protocol.MySensorsReader] - 0;255;3;0;9;TSF:MSG:READ,202-202-0,s=1,c=1,t=37,pt=2,l=2,sg=0:487 17:40:32.346 [DEBUG] [rs.internal.protocol.MySensorsReader] - 202;1;1;0;37;487 17:40:32.431 [DEBUG] [col.serial.MySensorsSerialConnection] - Connecting to /dev/ttyUSB0 [baudRate:115200] 17:40:32.435 [DEBUG] [col.serial.MySensorsSerialConnection] - Final port list: /dev/ttyUSB0 17:40:33.530 [DEBUG] [rs.internal.protocol.MySensorsReader] - 0;255;3;0;9;TSF:MSG:READ,202-202-0,s=1,c=1,t=37,pt=2,l=2,sg=0:470 17:40:33.533 [DEBUG] [rs.internal.protocol.MySensorsReader] - 202;1;1;0;37;470 17:40:34.438 [ERROR] [col.serial.MySensorsSerialConnection] - Can't connect to serial port. Wrong port? 17:40:34.440 [ERROR] [col.serial.MySensorsSerialConnection] - Failed connecting to bridge...next retry in 10 seconds (Retry No.:32) 17:40:34.441 [DEBUG] [col.serial.MySensorsSerialConnection] - Shutting down serial connection! 17:40:34.720 [DEBUG] [rs.internal.protocol.MySensorsReader] - 0;255;3;0;9;TSF:MSG:READ,202-202-0,s=1,c=1,t=37,pt=2,l=2,sg=0:472@Igor-Antolić huh,... my mistake, just installed 2.1.0 instead of 2.0.0. It seems it is from 2017-03-07.
I dont have a good way to find last version of lib. Any suggestion how to check if last stabile version of mysensors java lib?
-
@Igor-Antolić huh,... my mistake, just installed 2.1.0 instead of 2.0.0. It seems it is from 2017-03-07.
I dont have a good way to find last version of lib. Any suggestion how to check if last stabile version of mysensors java lib?
@Igor-Antolić I'm glad it worked after the update!
It currently is not possible to automatically update (or check) for the most recent version. There are currently two sources for the binding:
- the IoT Marketplace
- The link in the wiki on github
The most convenient way is the integration in the official openhab2-plugins repository and I'm working on it, but I still have a lot of homework to do.
Maybe the IoT Marketplace will soon support such mechanisms, there are a few extensions planned.
-
I'm sorry, I ran a ctrl+f search and it either didn't show or i completely missed it, thank you for the prompt reply though.
In this case then i will have to wait for this release then as i can't achieve what i need to do with rules. Do we have any idea when the release will be?
@Samuel235 said in openHAB 2.0 binding:
In this case then i will have to wait for this release then as i can't achieve what i need to do with rules. Do we have any idea when the release will be?
What is it, what you want to achieve? I'm running MQTT too, as a connection between OpenHAB2 and nodered (50% of my rules are now nodered based). My gateways are serial or ethernet based.
serial / ethernet gateway
<->
OpenHAB2 binding
<->
MQTT Event bus
<->
nodered@Samuel235 Are you willing and have the ability to test the MQTT implementation of the binding? Any help is really appreciated!