openHAB 2.0 binding
-
Further to my client ethernet gateway not working with the MySensors 2.1.1 library, I tried 2.0.0 and now go much further. The gateway does not keep restarting, talks to the openhab controller and at least reads the messages and tripped status from my motion sensor
0;255;3;0;9;Starting gateway (RNNGA-, 2.0.0) 0;255;3;0;9;TSM:INIT 0;255;3;0;9;TSM:RADIO:OK 0;255;3;0;9;TSM:GW MODE 0;255;3;0;9;TSM:READY IP: 192.168.1.9 0;255;3;0;9;No registration required 0;255;3;0;9;Init complete, id=0, parent=0, distance=0, registration=1 0;255;3;0;9;TSP:MSG:READ 1-1-0 s=1,c=1,t=16,pt=0,l=1,sg=0:0 0;255;3;0;9;TSP:MSG:READ 1-1-0 s=1,c=1,t=16,pt=0,l=1,sg=0:1 0;255;3;0;9;TSP:MSG:READ 1-1-0 s=1,c=1,t=16,pt=0,l=1,sg=0:0 0;255;3;0;9;TSP:MSG:READ 1-1-0 s=1,c=1,t=16,pt=0,l=1,sg=0:1 0;255;3;0;9;TSP:MSG:READ 1-1-0 s=1,c=1,t=16,pt=0,l=1,sg=0:0 0;255;3;0;9;TSP:SANCHK:OK```I had to turn on the skipStartupCheck for the ethernet gateway to come online in openhab (and the gateway serial monitor did show the 0;0;3;0;2; and ethernet messages between openhab and the gateway)
15:10:13.316 [DEBUG] [al.protocol.ip.MySensorsIpConnection] - Connecting to IP bridge [192.168.1.9:5003] 15:10:13.819 [DEBUG] [rs.internal.protocol.MySensorsWriter] - Sending to MySensors: 0;0;3;0;2; 15:10:14.320 [DEBUG] [rs.internal.protocol.MySensorsWriter] - Sending to MySensors: 0;0;3;0;2; 15:10:15.320 [DEBUG] [rs.internal.protocol.MySensorsWriter] - Sending to MySensors: 0;0;3;0;2; 15:10:16.320 [DEBUG] [rs.internal.protocol.MySensorsWriter] - Sending to MySensors: 0;0;3;0;2; 15:10:17.321 [DEBUG] [rs.internal.protocol.MySensorsWriter] - Sending to MySensors: 0;0;3;0;2; 15:10:18.321 [ERROR] [al.protocol.ip.MySensorsIpConnection] - Cannot start reading/writing thread, probably sync message (I_VERSION) not received. Try set skipStartupCheck to true 15:10:18.322 [ERROR] [al.protocol.ip.MySensorsIpConnection] - Failed connecting to bridge...next retry in 10 seconds (Retry No.:1) 15:10:18.322 [DEBUG] [al.protocol.ip.MySensorsIpConnection] - Disconnecting from IP bridge ... 15:10:18.323 [DEBUG] [rs.internal.protocol.MySensorsWriter] - Stopping Writer thread 15:10:18.324 [DEBUG] [rs.internal.protocol.MySensorsReader] - Stopping Reader thread 15:10:18.324 [ERROR] [rs.internal.protocol.MySensorsWriter] - (java.lang.InterruptedException) on writing to connection, message: class org.openhab.binding.mysensors.internal.protocol.ip.MySensorsIpWriter 15:10:18.325 [ERROR] [rs.internal.protocol.MySensorsReader] - (java.lang.InterruptedException: sleep interrupted) on reading from connection, message: class org.openhab.binding.mysensors.internal.protocol.ip.MySensorIpReader 15:10:25.236 [DEBUG] [ernal.handler.MySensorsBridgeHandler] - Disposing of the MySensors bridge 15:10:25.236 [DEBUG] [al.protocol.ip.MySensorsIpConnection] - Destroying connection 15:10:25.236 [DEBUG] [ternal.factory.MySensorsCacheFactory] - Cache file: given_ids.cached exist. 15:10:25.237 [DEBUG] [ternal.factory.MySensorsCacheFactory] - Cache (given_ids) content: [1] 15:10:25.237 [DEBUG] [ternal.factory.MySensorsCacheFactory] - Writing on cache given_ids, content: [1] 15:10:25.239 [DEBUG] [ernal.handler.MySensorsBridgeHandler] - Initialization of the MySensors bridge 15:10:25.239 [INFO ] [smarthome.event.ThingUpdatedEvent ] - Thing 'mysensors:bridge-eth:cb1d6dd1' has been updated. 15:10:25.240 [DEBUG] [al.protocol.ip.MySensorsIpConnection] - Set skip check on startup to: true 15:10:25.240 [DEBUG] [al.protocol.ip.MySensorsIpConnection] - Enabling connection watchdog 15:10:25.240 [DEBUG] [ternal.factory.MySensorsCacheFactory] - Cache file: given_ids.cached exist. 15:10:25.241 [DEBUG] [al.protocol.ip.MySensorsIpConnection] - Connecting to IP bridge [192.168.1.9:5003] 15:10:25.241 [DEBUG] [ternal.factory.MySensorsCacheFactory] - Cache (given_ids) content: [1] 15:10:25.241 [DEBUG] [ernal.handler.MySensorsBridgeHandler] - Initialization of the MySensors bridge DONE! 15:10:25.244 [WARN ] [al.protocol.ip.MySensorsIpConnection] - Skipping I_VERSION connection test, not recommended... 15:10:25.244 [INFO ] [al.protocol.ip.MySensorsIpConnection] - Successfully connected to MySensors Bridge.I then got my motion sensor to come online in openhab
15:13:24.300 [DEBUG] [ternal.handler.MySensorsThingHandler] - Configuration: nodeId 1, chiledId: 1, requestAck: false, revertState: false, smartSleep: false 15:13:24.301 [DEBUG] [ternal.handler.MySensorsThingHandler] - Event listener for node 1-1 not registered yet, registering... 15:13:24.305 [INFO ] [me.event.ThingStatusInfoChangedEvent] - 'mysensors:motion:24559d07' changed from INITIALIZING to ONLINE```However the motion sensor (via gateway) and openhab controller are not talking to each other. Does skipping the startup check result in problems?
Any ideas on how to progress with MySensors 2.0.0 library or do I need to wait for a fix to 2.1.1?
Many Thanks...
@Andrew-Currie It should make no difference for the binding if you're using 2.0.0 or 2.1.1. I can't see any incoming messages in the debug log you've posted. If the gateway is properly connected you should see messages incoming, for example from your motion sensor. Could you please establish a telnet connection to the gateway at port 5003 and post the output? In parallel check the serial output of the gateway, there you should see the establishment of the telnet connection for example.
-
@Andrew-Currie It should make no difference for the binding if you're using 2.0.0 or 2.1.1. I can't see any incoming messages in the debug log you've posted. If the gateway is properly connected you should see messages incoming, for example from your motion sensor. Could you please establish a telnet connection to the gateway at port 5003 and post the output? In parallel check the serial output of the gateway, there you should see the establishment of the telnet connection for example.
@TimO Thanks Tim for your feedback. Here is the log from the gateway. It receives messages from openhab re the ethernet connection and also from the motion sensor and gets a fail from one send
0;255;3;0;9;Starting gateway (RNNGA-, 2.0.0) 0;255;3;0;9;TSM:INIT 0;255;3;0;9;TSM:RADIO:OK 0;255;3;0;9;TSM:GW MODE 0;255;3;0;9;TSM:READY IP: 192.168.1.9 0;255;3;0;9;No registration required 0;255;3;0;9;Init complete, id=0, parent=0, distance=0, registration=1 0;255;3;0;9;TSP:SANCHK:OK 0;255;3;0;9;TSP:SANCHK:OK 0;255;3;0;9;Eth: connect 0;255;3;0;9;Eth: 0;0;3;0;2; 0;255;3;0;9;Eth: 0;255;3;0;9;Eth: 0;0;3;0;2; 0;255;3;0;9;Eth: 0;255;3;0;9;Eth: 0;0;3;0;2; 0;255;3;0;9;Eth: 0;255;3;0;9;Eth: 0;0;3;0;2; 0;255;3;0;9;Eth: 0;255;3;0;9;Eth: 0;0;3;0;2; 0;255;3;0;9;Eth: 0;255;3;0;9;Eth: disconnect 0;255;3;0;9;TSP:SANCHK:OK 0;255;3;0;9;Eth: connect 0;255;3;0;9;Eth: 0;0;3;0;2; 0;255;3;0;9;Eth: 0;255;3;0;9;Eth: 0;0;3;0;2; 0;255;3;0;9;Eth: 0;255;3;0;9;Eth: 0;0;3;0;2; 0;255;3;0;9;Eth: 0;255;3;0;9;Eth: 0;0;3;0;2; 0;255;3;0;9;Eth: 0;255;3;0;9;Eth: 0;0;3;0;2; 0;255;3;0;9;Eth: 0;255;3;0;9;Eth: disconnect 0;255;3;0;9;TSP:SANCHK:OK 0;255;3;0;9;TSP:SANCHK:OK 0;255;3;0;9;TSP:MSG:READ 1-1-255 s=255,c=3,t=7,pt=0,l=0,sg=0: 0;255;3;0;9;TSP:MSG:BC 0;255;3;0;9;TSP:MSG:FPAR REQ (sender=1) 0;255;3;0;9;TSP:CHKUPL:OK 0;255;3;0;9;TSP:MSG:GWL OK 0;255;3;0;9;TSP:MSG:SEND 0-0-1-1 s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=ok:0 0;255;3;0;9;TSP:MSG:READ 1-1-0 s=255,c=3,t=24,pt=1,l=1,sg=0:1 0;255;3;0;9;TSP:MSG:PINGED (ID=1, hops=1) 0;255;3;0;9;TSP:MSG:SEND 0-0-1-1 s=255,c=3,t=25,pt=1,l=1,sg=0,ft=0,st=ok:1 0;255;3;0;9;TSP:MSG:READ 1-1-0 s=255,c=3,t=15,pt=6,l=2,sg=0:0100 0;255;3;0;9;!TSP:MSG:SEND 0-0-1-1 s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=fail:0100 0;255;3;0;9;TSP:MSG:READ 1-1-0 s=255,c=3,t=6,pt=1,l=1,sg=0:0 0;255;3;0;9;TSP:MSG:READ 1-1-0 s=255,c=3,t=11,pt=0,l=13,sg=0:Motion Sensor 0;255;3;0;9;TSP:MSG:READ 1-1-0 s=255,c=3,t=12,pt=0,l=3,sg=0:1.0 0;255;3;0;9;TSP:MSG:READ 1-1-0 s=1,c=0,t=1,pt=0,l=0,sg=0: 0;255;3;0;9;TSP:MSG:READ 1-1-0 s=255,c=3,t=26,pt=1,l=1,sg=0:2 0;255;3;0;9;TSP:MSG:SEND 0-0-1-1 s=255,c=3,t=27,pt=1,l=1,sg=0,ft=0,st=ok:1 0;255;3;0;9;TSP:MSG:READ 1-1-0 s=1,c=1,t=16,pt=0,l=1,sg=0:0 0;255;3;0;9;TSP:MSG:READ 1-1-0 s=1,c=1,t=16,pt=0,l=1,sg=0:1 0;255;3;0;9;TSP:MSG:READ 1-1-0 s=1,c=1,t=16,pt=0,l=1,sg=0:0 0;255;3;0;9;TSP:SANCHK:OKThe telnet connection shows no action and the gateway device is on the local network
$ telnet 192.168.1.9 5003 Trying 192.168.1.9... Connected to 192.168.1.9. Escape character is '^]'.$ arp -a HPB482AF (192.168.1.2) at 28:92:4a:c0:c3:27 [ether] on wlan0 WIZnet9FFEED (192.168.1.9) at de:ad:b1:9f:fe:ed [ether] on wlan0 NB604N.Home (192.168.1.1) at 00:60:64:83:50:8b [ether] on wlan0 HF-LPB100 (192.168.1.12) at f0:fe:6b:16:a1:4a [ether] on wlan0I have tried all sorts of ubuntu firewall settings to allow access to and from 192.168.1.9 port 5003 and also looked into the router settings with no joy.
As another approach I tried the serial gateway and investigated the linux settings given in
http://docs.openhab.org/installation/linux.html#privileges-for-common-peripheralsThe furthest I got with the serial gateway was as follows, first the debug log at startup and then when creating the gateway thing in the paper ui
10:07:04.218 [DEBUG] [org.openhab.binding.mysensors ] - ServiceEvent REGISTERED - {org.eclipse.smarthome.core.thing.binding.ThingHandlerFactory}={component.name=org.openhab.binding.mysensors.internal.factory.MySensorsHandlerFactory, component.id=197, service.id=340, service.bundleid=250, service.scope=bundle} - org.openhab.binding.mysensors 10:07:04.219 [DEBUG] [org.openhab.binding.mysensors ] - BundleEvent STARTED – org.openhab.binding.mysensors 10:08:52.520 [DEBUG] [org.openhab.binding.mysensors ] - ServiceEvent REGISTERED - {org.eclipse.smarthome.config.discovery.DiscoveryService}={service.id=341, service.bundleid=250, service.scope=singleton} – org.openhab.binding.mysensors10:08:52.524 [DEBUG] [ernal.handler.MySensorsBridgeHandler] - Initialization of the MySensors bridge 10:08:52.526 [DEBUG] [col.serial.MySensorsSerialConnection] - Set skip check on startup to: false 10:08:52.526 [DEBUG] [col.serial.MySensorsSerialConnection] - Enabling connection watchdog 10:08:52.527 [DEBUG] [col.serial.MySensorsSerialConnection] - Connecting to ttyUSB1 [baudRate:115200] 10:08:52.530 [DEBUG] [ternal.factory.MySensorsCacheFactory] - Cache file: given_ids.cached exist. 10:08:52.531 [DEBUG] [ternal.factory.MySensorsCacheFactory] - Cache (given_ids) content: [] 10:08:52.532 [DEBUG] [ernal.handler.MySensorsBridgeHandler] - Initialization of the MySensors bridge DONE! testRead() open failed: /dev/ttyUSB1 localClose: File Descriptor error, not closing testRead() open failed: /dev/ttyUSB1 localClose: File Descriptor error, not closing testRead() open failed: /dev/ttyUSB1 localClose: File Descriptor error, not closing 10:08:52.545 [DEBUG] [col.serial.MySensorsSerialConnection] - Final port list: ttyUSB1:/dev/ttyUSB1 testRead() open failed: ttyUSB1 localClose: File Descriptor error, not closing Failed to connect on port: ttyUSB1 exception: gnu.io.NoSuchPortExceptionWhile my plan was to test on my ubuntu 16.04 laptop, I have gone ahead and ordered a Raspberry pi 3 and intend to install the openhabianpi img file. Hopefully better progress there...
-
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? -
Hi, just a short question as I haven't found any up to date information about it: I am thinking about switching from domoticz to openHab 2 (as I really like the new UIs and the auto discovery). I am using an ESP8266 based MQTT gateway. Does openhab 2 on a raspi work with Mysensors using MQTT and does it support the new sensors/actor types added Mysensors 2 (specially RGBW)?
Thank you!
-
Thanks @Fabien I have a serial gateway too, but I liked the idea of a MQTT gateway more because its much more flexible. Does Tims plugin not support MQTT? I wanted to use that.
-
Thanks @Fabien I have a serial gateway too, but I liked the idea of a MQTT gateway more because its much more flexible. Does Tims plugin not support MQTT? I wanted to use that.
Hi @LastSamurai , currently Timo is working on MQTT gateway but I don't know precisely when it will be available to all.
@TimO said in openHAB 2.0 binding:
@Fabien Thank you for your feedback!
And: I've waited for that question according firmware updates to come up. :-DI've looked into it and I'm very interested but till now there is only the implementation in the library, I've not seen an implementation in a binding. I'll continue to look at it, but with low priority. :-)
Current priority list is:
- Include binding in OH2 repository.
- Test and include the big refactoring from @andreacioni .
- Add MQTT gateway (proof of concept working, full integration after refactoring).
- Add little feature requests, add sensors ...
-
Ok, I will keep an eye on this one and stay with the serial gateway for now.
-
After moving from my ubuntu laptop to RP3 I have had success!!
Flashed the sd card with the latest openhabian, waited for everything to auto install on the RP3 and could then install the my sensors (ethernet) gateway on the pi and also open a karaf console to log openhab2 via a remote/headless ssh. My remote browser could open the paper ui via openhabianpi:8080 and I added the ethernet gateway successfully. Adding the motion sensor needed the node id 2 and child id 1 as set by the Arduino sketch. The light level sensor was then turned on and it just showed up as my sensors (2,2) in the paper ui inbox so this level of discovery works! The sensors now show tripped status/light level in the paper ui control.
Looks like I can now progress to using My Sensors to control the mi-lights already working in openhab2.
Thanks Tim for all your work on the binding -
@TimO , I just noticed a weird behavior - I've changed configuration for another binding and restarted it from the console but that killed mysensors binding:
2017-03-04 13:07:19.110 [INFO ] [el.core.internal.ModelRepositoryImpl] - Refreshing model 'demo.things'
2017-03-04 13:07:19.123 [ERROR] [col.serial.MySensorsSerialConnection] - Interrupted reset time wait
2017-03-04 13:07:19.124 [WARN ] [col.serial.MySensorsSerialConnection] - Skipping I_VERSION connection test, not recommended...
2017-03-04 13:07:19.125 [INFO ] [col.serial.MySensorsSerialConnection] - Successfully connected to MySensors Bridge.
2017-03-04 13:07:19.125 [WARN ] [col.serial.MySensorsSerialConnection] - Network Sanity Checker thread disabled from bridge configuration2017-03-04 13:07:21.141 [ERROR] [col.serial.MySensorsSerialConnection] - Can't connect to serial port. Wrong port?
2017-03-04 13:07:21.149 [ERROR] [col.serial.MySensorsSerialConnection] - Failed connecting to bridge...next retry in 10 seconds (Retry No.:0)
2017-03-04 13:07:33.161 [ERROR] [col.serial.MySensorsSerialConnection] - Can't connect to serial port. Wrong port?
2017-03-04 13:07:33.163 [ERROR] [col.serial.MySensorsSerialConnection] - Failed connecting to bridge...next retry in 10 seconds (Retry No.:1)Complete stop/start of OH is the only solution so far.
-
@TimO , I just noticed a weird behavior - I've changed configuration for another binding and restarted it from the console but that killed mysensors binding:
2017-03-04 13:07:19.110 [INFO ] [el.core.internal.ModelRepositoryImpl] - Refreshing model 'demo.things'
2017-03-04 13:07:19.123 [ERROR] [col.serial.MySensorsSerialConnection] - Interrupted reset time wait
2017-03-04 13:07:19.124 [WARN ] [col.serial.MySensorsSerialConnection] - Skipping I_VERSION connection test, not recommended...
2017-03-04 13:07:19.125 [INFO ] [col.serial.MySensorsSerialConnection] - Successfully connected to MySensors Bridge.
2017-03-04 13:07:19.125 [WARN ] [col.serial.MySensorsSerialConnection] - Network Sanity Checker thread disabled from bridge configuration2017-03-04 13:07:21.141 [ERROR] [col.serial.MySensorsSerialConnection] - Can't connect to serial port. Wrong port?
2017-03-04 13:07:21.149 [ERROR] [col.serial.MySensorsSerialConnection] - Failed connecting to bridge...next retry in 10 seconds (Retry No.:0)
2017-03-04 13:07:33.161 [ERROR] [col.serial.MySensorsSerialConnection] - Can't connect to serial port. Wrong port?
2017-03-04 13:07:33.163 [ERROR] [col.serial.MySensorsSerialConnection] - Failed connecting to bridge...next retry in 10 seconds (Retry No.:1)Complete stop/start of OH is the only solution so far.
-
@andreacioni thank you
Yes, it was a change in the .things file, but it was related to another binding. -
@andreacioni thank you
Yes, it was a change in the .things file, but it was related to another binding.@AndrewZ things file update trigger a reload of all binding declared inside it, nothing strange. ;) Follow the above link to keep track of the status of this issue.
-
I just tried to get the openhab 2 binding up and running. I have a serial gateway and domoticz + openhab running on a pi. I stopped the domoticz service and installed the serial and mysensors addons for openhab like mentioned in the github readme (bundle:list showed them both). I also added the openhab user to the dialout group.
I then created a demo.things file in config/things withBridge mysensors:bridge-ser:gateway [ serialPort="/dev/ttyUSB0", sendDelay=200 ] { /** define things connected to that bridge here */ }The log of openhab shows these errors though:
2017-03-19 00:03:59.855 [ERROR] [col.serial.MySensorsSerialConnection] - Can't connect to serial port. Wrong port? 2017-03-19 00:03:59.897 [ERROR] [col.serial.MySensorsSerialConnection] - Failed connecting to bridge...next retry in 10 seconds (Retry No.:46)Any idea why? This works just fine:
cat /dev/ttyUSB0 -
I just tried to get the openhab 2 binding up and running. I have a serial gateway and domoticz + openhab running on a pi. I stopped the domoticz service and installed the serial and mysensors addons for openhab like mentioned in the github readme (bundle:list showed them both). I also added the openhab user to the dialout group.
I then created a demo.things file in config/things withBridge mysensors:bridge-ser:gateway [ serialPort="/dev/ttyUSB0", sendDelay=200 ] { /** define things connected to that bridge here */ }The log of openhab shows these errors though:
2017-03-19 00:03:59.855 [ERROR] [col.serial.MySensorsSerialConnection] - Can't connect to serial port. Wrong port? 2017-03-19 00:03:59.897 [ERROR] [col.serial.MySensorsSerialConnection] - Failed connecting to bridge...next retry in 10 seconds (Retry No.:46)Any idea why? This works just fine:
cat /dev/ttyUSB0 -
Thank you, that helped! Should anyone ever face the same problem: after changing the EXTRA_JAVA_OPTS I also needed to restart openhab (more likely the java vm).
-
So openhab is running now and discovers my sensors when I restart them while scanning. My RGBW controller nodes pop up as RGBW sensors though. The on/off switch works, but what do I have to do to actually control the colors?
I tried editing the 4 variables but that doesn't seem to change the lights.
-
@LastSamurai : What does your sketch expect? One ASCII formated RGB code like described here: https://www.mysensors.org/download/serial_api_20 or a value between 0 and 100% per color (r,g,b,w)? I see different implementations (in openhab and in mysensors) and maybe we have to adjust the binding.
-
@TimO Right, I guess thats the problem. I have written my sketch against domoticz, so it expects either a 6 bit hex string (rgb = e.g. ff00ff) or a 9 bit (idk why) rgbw hex string (e.g. #ff00ff00).
According to the mysensors docu "ff00ff00" would be right, I guess.