[Tutorial] openHAB with serial gateway
-
How to I add I_BATTERY_LEVEL to the openhab rules? Being internal I wasnt sure if hashmap would do it.
Something like this? Where Item is NodeX_Batt
// Internal Command if(msgType == 3){ if(subType == I_BATTERY_LEVEL){ postUpdate("Node" + nodeId + "_Batt, msg) println("Node" + nodeId + "_Batt:" + msg) }} -
This is a BRILLIANT tutorial. Up and running with a single temp/humidity node in minutes. Thanks so much.
I built a second node (identical simple DHT22 temp/humidity) and set the Node-id to 110. I'm just wondering how to add the second node into OpenHAB? I have confirmed that openhab is receiving the signals from the second node correctly, but not quite sure about the OpenHAB rules, sitemap and items configs for a second node - that is identical in every way save for the Node ID and different item names. I've simply duplicated all of the code in the relevant config files, changed the item names and added four extra lines to the mapping to map the second 110 node. When I do this I get no data from either of the nodes. If I comment out my changes, I get the values from my first node just fine.
Can anyone with multiple nodes post a link to their configs so I can see what I might be doing wrong? Cheers.
-
Scratch that...I figured it out. In the rules file, I needed to add a extra comma after the first chunk of mapping. As it stood, I presume it failed to process the whole rule, as there was a syntax error (missing comma) which mean't the 'list' of mappings were incomplete. Added a comma and all was right once again. :)
-
Hi guys,
I'm running in an interesting issue here, posting to see where I'm missing a step.
I have a Serial Gateway, connected to openHAB and working without issue. I see messages from the arduino Monitor and I can see the messages in openHAB without issue.
I'm running openHAB on Raspberry PI. arduino connected to PI by USB (on serial port /dev/ttyUSB0) declared as below:
String itmSensor_gateway_rawmessage { serial="/dev/ttyUSB0@115200" }The problem that I'm facing is related to the parse process ( I think ).
Message sent from my node:
send: 124-124-0-0 s=0,c=1,t=1,pt=7,l=5,sg=0,st=ok:32.0with this code:
This is the section of the arduino sketch that I'm using to send the Humidity status:float humidity = dht.getHumidity(); if (isnan(humidity)) { Serial.println("Failed reading humidity from DHT"); } else if (humidity != lastHum) { lastHum = humidity; gw.send(msgHum.set(humidity, 1)); Serial.print("H: "); Serial.println(humidity); numAttemptsHum = 0; } else { Serial.print("Attempt "); Serial.print(numAttemptsHum); Serial.print("/"); Serial.print(MAX_NUM_ATTEMPTS_HUM); Serial.print(" - Same Humidity level presented"); Serial.print(" (Previous:"); Serial.print(lastHum); Serial.print(" vs Current: "); Serial.print(humidity); Serial.println(") - not sending"); numAttemptsHum ++; if ( numAttemptsHum > MAX_NUM_ATTEMPTS_HUM ) { lastHum = 0; numAttemptsHum = 0; } }(it's based on the Humidity & Temp example with minor changes to avoid traffic witout reducing the sampling frequency but with consistent updates based on a specific threshold.).
Message received in openHAB:
13:27:54.142 [DEBUG] [b.serial.internal.SerialDevice:194 ] - Received message '0;0;3;0;9;read: 124-124-0 s=0,c=1,t=1,pt=7,l=5,sg=0:31.0 ' on serial port /dev/ttyUSB0So at this point I see that all messages are type 3 ( not 1 as in the above example ).
That message updates my openHAB item, as per this example I have a rule that descompose the original message ( no modifications done yet to the one posted here ).
So, when I finally get to the core msg ( the one that in this example is directly assigned to the openHAB item ) the value is:
124-124-0 s=0,c=1,t=1,pt=7,l=5,sg=0:31.0instead of the 31.0 that I was expecting.
Any ideas?
(happy to provide more sections of code if needed, didn't want to put everyting here to avoid garbage)
Thanks in advance for any help.
-
@Dave-Dan
0;0;3 means a debug message.. you can throw these away. Shouldn't be processed by your controller. -
Ok cool.
That means that I'm doing something else wrong bc I still see that part after disabling DEBUG.I'm curious on why having the same sketch + openHAB rule from thia thread I xan make it work ...
Will review carefully because sounds weird for me.
Thanks!!!!
-
Hi TimO,
I want to make a permanent USB setting for my Radberry and I follow your tutorial here.
In my etc/udev/rules.d I have two documents: 40-scratch.rules and 99-input.rules and I don't know where to make the needed modifications as you show in this tutorial.
The file you point to make the modifications has another name and I can't figure where to add the vendor, product and serial no for my arduino. Shall I make a new file called 99-usb-serial.rules and to write in it the ATTRS{idVendor} and the rest of them according to my dmesg as you say here above or to do that in one of the two files I have?
Thanks! -
Hi! Can somebody please help here? I got stuck with my openhab server on my raspberry!
By now I was starting the server by:Sudo /opt/openhab/start.shBut I wanted more, to make it auto start on reboot so in case of power failure to auto start when the power is back. Therefore I followed some tutorials found on the www and I got it done, now the server starts alone but I cannot do anything from web page or from my phone. I also can't see the temp and humidity on the web or phone!
The question is how to stop this server? I tried different commands found on the internet but non of them can stop this invincible server I have lunched :)
I tried to stop it, remove, delete... Nothing works!
Is there any way to remove everything from my raspberry pi and to start it all over again with all the installation as for windows ? Format the partition, install the noobs again and so on?
Thanks. -
-
udev: Just create the new file if it is not there yet. It should be processed automatically.
-
The best way to start a service in Linux is using an etc-script. You will find an example here: https://github.com/openhab/openhab/wiki/Samples-Tricks#how-to-configure-openhab-to-start-automatically-on-linux
The script will start OpenHab at boot and you're able to start/stop/restart with/etc/init.d/openhab start or service openhab start
-
-
I'm having issues getting the ttyUSB99 fix to work.
I'm running openhab 1.7.1 and it was installed using apt-get.
My dmseg output looks like this[10167.765598] usb 1-1.2: USB disconnect, device number 4 [10167.766311] ch341-uart ttyUSB0: ch341-uart converter now disconnected from ttyUSB0 [10167.766407] ch341 1-1.2:1.0: device disconnected [10171.843803] usb 1-1.2: new full-speed USB device number 5 using dwc_otg [10171.946998] usb 1-1.2: New USB device found, idVendor=1a86, idProduct=7523 [10171.947025] usb 1-1.2: New USB device strings: Mfr=0, Product=2, SerialNumber=0 [10171.947042] usb 1-1.2: Product: USB2.0-Serial [10171.948288] ch341 1-1.2:1.0: ch341-uart converter detected [10171.952514] usb 1-1.2: ch341-uart converter now attached to ttyUSB0As you can see there is no SerialNumber here, but I found it using
pi@raspberrypi ~ $ udevadm info -a -n /dev/ttyUSB0 | grep '{serial}' | head -n1 ATTRS{serial}=="3f980000.usbSo I created a rules file looking like this:
pi@raspberrypi ~ $ cat /etc/udev/rules.d/99-usb-serial.rules SUBSYSTEM=="tty", ATTRS{idVendor}=="1a86", ATTRS{idProduct}=="7523", ATTRS{serial}=="3f980000.usb", SYMLINK+="ttyUSB99"I have disconnected and reconnected my gateway.
But starting openhab now just results in the following error:2015-09-20 09:24:48.867 [ERROR] [i.internal.GenericItemProvider] - Binding configuration of type 'serial' of item ?Arduino? could not be parsed correctly. org.openhab.model.item.binding.BindingConfigParseException: Could not open serial port /dev/ttyUSB99: Serial port '/dev/ttyUSB99' could not be found. Available ports are: /dev/ttyUSB0What can I do to resolve this?
-
Eventually solved it by just omitting SerialNumber, i.e.
SUBSYSTEM=="tty", ATTRS{idVendor}=="1a86", ATTRS{idProduct}=="7523", ATTRS{serial}=="3f980000.usb", SYMLINK+="ttyUSB99I guess that could cause problems if I would attached more similar devices to my RPI, but I don't know if there is any point in having more than one gateway? (unless you have > 255 sensors I guess)
-
Hi,
I am new with mysensors and i am trying to make it work with openhab.
I have a soil sensor and with same copy paste from the forum i manage to sent the value on the openhab, now i am trying to translate the battery level on the opnehab side but i dont know how to do it. can someone help me please?? this is what i get on the openhab 0;0;3;0;9;read: 254-254-0 s=255,c=3,t=0,pt=1,l=1,sg=0:68
254;255;3;0;0;68 this is the battery value.
But i am lost on the rule how to decode the message.Thanks
Nikos -
I also would like to share my working
default.rules+ examples with you. Hope it can help someone. -
Hi @nikos1671 !
You need to add an item to the hash map with nodeID 254 and childId 255.
In the rules section search for// Internal Command if(msgType == 3){ if(subType == I_SKETCH_NAME){ println("Sketch name: " + msg ) sketchName=msg } if(subType == I_SKETCH_VERSION){ println("Sketch version: " + msg ) postUpdate(sensorToItemsMap.get( nodeId + ";" + childId + ";"), sketchName+" " +msg ) sketchName="" } } }As the battery status is an internal message, you need to modify this section. Add an if statement for I_BATTERY_LEVEL.
For more information about the messages: http://www.mysensors.org/download/serial_api_15
-
Hi @nikos1671 !
You need to add an item to the hash map with nodeID 254 and childId 255.
In the rules section search for// Internal Command if(msgType == 3){ if(subType == I_SKETCH_NAME){ println("Sketch name: " + msg ) sketchName=msg } if(subType == I_SKETCH_VERSION){ println("Sketch version: " + msg ) postUpdate(sensorToItemsMap.get( nodeId + ";" + childId + ";"), sketchName+" " +msg ) sketchName="" } } }As the battery status is an internal message, you need to modify this section. Add an if statement for I_BATTERY_LEVEL.
For more information about the messages: http://www.mysensors.org/download/serial_api_15
-
What i am doing wrong??
i am using the last rules from silex and i can parse the data from my sensebender temp and hum on openhab but i cannot make it with battery. here is my setup// Mappings
var HashMap<String, String> sensorToItemsMap = newLinkedHashMap("3;1;" -> "Temp", "Temp" -> "3;1;", "3;2;" -> "Hum", "Hum" -> "3;2;", "3;255;" -> "Batt", "Batt" -> "3;255;",the rule
if(msgType == M_INTERNAL){ // Internal Command
print("(INTERNAL)\t")
if(subType == I_SKETCH_NAME){
println("Sketch name: " + msg )
}
if(subType == I_SKETCH_VERSION){
println("Sketch version: " + msg )
}
if(subType == I_BATTERY_LEVEL){
postUpdate(sensorToItemsMap.get( nodeId + ";" + childId + ";"), msg)
println ("Batt item: " + sensorToItemsMap.get( nodeId + ";" + childId + ";") + " Batt: " + msg )
}}my.items
String Arduino "Arduino" { serial="COM3@115200" }Number Temp "Temperatur [%.1f °C]" <temperature>
Number Hum "Feuchtigkeit [%.1f %%]" <temperature>
Number Batt "bataria [%.1f %%]" <energy>and this is the logs of openhab
20:02:58.954 [DEBUG] [b.serial.internal.SerialDevice:194 ] - Received message '0;0;3;0;9;read: 3-3-0 s=255,c=4,t=0,pt=6,l=10,sg=0:FFFFFFFFFFFFFFFF03
3;255;4;0;0;FFFFFFFFFFFFFFFF0300
0;0;3;0;9;read: 3-3-0 s=255,c=3,t=11,pt=0,l=17,sg=0:Sensebender Micro
3;255;3;0;11;Sensebender Micro
0;0;3;0;9;read: 3-3-0 s=255,c=3,t=12,pt=0,l=3,sg=0:1.3
3;255;3;0;12;1.3
0;0;3;0;9;read: 3-3-0 s=1,c=0,t=6,pt=0,l=0,sg=0:
3;1;0;0;6;
0;0;3;0;9;read: 3-3-0 s=2,c=0,t=7,pt=0,l=0,sg=0:
3;2;0;0;7;
0;0;3;0;9;read: 3-3-0 s=1,c=1,t=0,pt=7,l=5,sg=0:23.6
3;1;1;0;0;23.6
0;0;3;0;9;read: 3-3-0 s=2,c=1,t=1,pt=2,l=2,sg=0:53
3;2;1;0;1;53
0;0;3;0;9;read: 3-3-0 s=255,c=3,t=0,pt=1,l=1,sg=0:113
3;255;3;0;0;113
' on serial port COM3
20:02:58.960 [DEBUG] [o.b.f.i.h.FritzahaWebInterface:336 ] - Sending update to item Power_FritzDECTv
20:02:58.977 [DEBUG] [m.r.internal.engine.RuleEngine:305 ] - Executing rule 'Decode incoming MySensors data'
20:02:59.101 [ERROR] [o.o.c.s.ScriptExecutionThread :50 ] - Error during the execution of rule 'Decode incoming MySensors data': 5Can someone help me please??
-
Hi @nikos1671,
everytime I had that error was mainly because I forgot / add extra comma in the LinkedHastMap definition or something like that.
Can you please share the full openHAB rule?
-
Hi @Dave-Dan ,
i think i found the problem. i have 2 sensebender micro one with the original shiped firmaware 1.1 (node1) and one with the new one 1.3 (node3) as you can see in the logs of openhab the node1 its parsing the data on the openhab very good but the node3 throwing an error( Error during the execution of rule 'Decode incoming MySensors data': 5)
here is the rule that i use
// CONTRIBUTE: Feel free to fork, enhance, pull reqest // // SiLeX <gersilex@gmail.com> // // // IMPORTS ////////////////////////////////////////////////////////////////////////////////////////////////////////// import org.openhab.core.library.types.* import org.openhab.core.persistence.* import org.openhab.model.script.actions.* import java.util.HashMap import org.eclipse.xtext.xbase.lib.* import org.openhab.core.items.* // VARS ///////////////////////////////////////////////////////////////////////////////////////////////////////////// // MySensors 1.5 //////////////////////////////////////////////////////////////////////////////////////////////////// // MessageTypes // val int M_PRESENTATION = 0 // Sent by a node when they present attached sensors. This is usually done in setup() at startup. val int M_SET = 1 // This message is sent from or to a sensor when a sensor value should be updated val int M_REQ = 2 // Requests a variable value (usually from an actuator destined for controller). val int M_INTERNAL = 3 // This is a special internal message. See table below for the details val int M_STREAM = 4 // Used for OTA firmware updates // SubTypes for MessageType M_PRESENTATION // // (Not used for now, as automatic configuration is not possible in OpenHAB 1.) // val int S_DOOR = 0 // Door and window sensors // val int S_MOTION = 1 // Motion sensors // val int S_SMOKE = 2 // Smoke sensor // val int S_LIGHT = 3 // Light Actuator (on/off) // val int S_BINARY = 3 // Binary device (on/off), Alias for S_LIGHT // val int S_DIMMER = 4 // Dimmable device of some kind // val int S_COVER = 5 // Window covers or shades // val int S_TEMP = 6 // Temperature sensor // val int S_HUM = 7 // Humidity sensor // val int S_BARO = 8 // Barometer sensor (Pressure) // val int S_WIND = 9 // Wind sensor // val int S_RAIN = 10 // Rain sensor // val int S_UV = 11 // UV sensor // val int S_WEIGHT = 12 // Weight sensor for scales etc. // val int S_POWER = 13 // Power measuring device, like power meters // val int S_HEATER = 14 // Heater device // val int S_DISTANCE = 15 // Distance sensor // val int S_LIGHT_LEVEL = 16 // Light sensor // val int S_ARDUINO_NODE = 17 // Arduino node device // val int S_ARDUINO_REPEATER_NODE = 18 // Arduino repeating node device // val int S_LOCK = 19 // Lock device // val int S_IR = 20 // Ir sender/receiver device // val int S_WATER = 21 // Water meter // val int S_AIR_QUALITY = 22 // Air quality sensor e.g. MQ-2 // val int S_CUSTOM = 23 // Use this for custom sensors where no other fits. // val int S_DUST = 24 // Dust level sensor // val int S_SCENE_CONTROLLER = 25 // Scene controller device // val int S_RGB_LIGHT = 26 // RGB light // val int S_RGBW_LIGHT = 27 // RGBW light (with separate white component) // val int S_COLOR_SENSOR = 28 // Color sensor // val int S_HVAC = 29 // Thermostat/HVAC device // val int S_MULTIMETER = 30 // Multimeter device // val int S_SPRINKLER = 31 // Sprinkler device // val int S_WATER_LEAK = 32 // Water leak sensor // val int S_SOUND = 33 // Sound sensor // val int S_VIBRATION = 34 // Vibration sensor // val int S_MOISTURE = 35 // Moisture sensor // SubTypes for MessageType M_SET // val int V_TEMP = 0 // Temperature val int V_HUM = 1 // Humidity val int V_STATUS = 2 // Binary status. 0=off 1=on val int V_LIGHT = 2 // Deprecated. Alias for V_STATUS. Light status. 0=off 1=on val int V_PERCENTAGE = 3 // Percentage value. 0-100 (%) val int V_DIMMER = 3 // Deprecated. Alias for V_PERCENTAGE. Dimmer value. 0-100 (%) val int V_PRESSURE = 4 // Atmospheric Pressure val int V_FORECAST = 5 // Whether forecast. One of "stable", "sunny", "cloudy", "unstable", "thunderstorm" or "unknown" val int V_RAIN = 6 // Amount of rain val int V_RAINRATE = 7 // Rate of rain val int V_WIND = 8 // Windspeed val int V_GUST = 9 // Gust val int V_DIRECTION = 10 // Wind direction val int V_UV = 11 // UV light level val int V_WEIGHT = 12 // Weight (for scales etc) val int V_DISTANCE = 13 // Distance val int V_IMPEDANCE = 14 // Impedance value val int V_ARMED = 15 // Armed status of a security sensor. 1=Armed, 0=Bypassed val int V_TRIPPED = 16 // Tripped status of a security sensor. 1=Tripped, 0=Untripped val int V_WATT = 17 // Watt value for power meters val int V_KWH = 18 // Accumulated number of KWH for a power meter val int V_SCENE_ON = 19 // Turn on a scene val int V_SCENE_OFF = 20 // Turn of a scene val int V_HVAC_FLOW_STATE = 21 // Mode of header. One of "Off", "HeatOn", "CoolOn", or "AutoChangeOver" val int V_HVAC_SPEED = 22 // HVAC/Heater fan speed ("Min", "Normal", "Max", "Auto") val int V_LIGHT_LEVEL = 23 // Uncalibrated light level. 0-100%. Use V_LEVEL for light level in lux. val int V_VAR1 = 24 // Custom value val int V_VAR2 = 25 // Custom value val int V_VAR3 = 26 // Custom value val int V_VAR4 = 27 // Custom value val int V_VAR5 = 28 // Custom value val int V_UP = 29 // Window covering. Up. val int V_DOWN = 30 // Window covering. Down. val int V_STOP = 31 // Window covering. Stop. val int V_IR_SEND = 32 // Send out an IR-command val int V_IR_RECEIVE = 33 // This message contains a received IR-command val int V_FLOW = 34 // Flow of water (in meter) val int V_VOLUME = 35 // Water volume val int V_LOCK_STATUS = 36 // Set or get lock status. 1=Locked, 0=Unlocked val int V_LEVEL = 37 // Used for sending level-value val int V_VOLTAGE = 38 // Voltage level val int V_CURRENT = 39 // Current level val int V_RGB = 40 // RGB value transmitted as ASCII hex string (I.e "ff0000" for red) val int V_RGBW = 41 // RGBW value transmitted as ASCII hex string (I.e "ff0000ff" for red + full white) val int V_ID = 42 // Optional unique sensor id (e.g. OneWire DS1820b ids) val int V_UNIT_PREFIX = 43 // Allows sensors to send in a string representing the unit prefix to be displayed in GUI. This is not parsed by controller! E.g. cm, m, km, inch. val int V_HVAC_SETPOINT_COOL = 44 // HVAC cold setpoint val int V_HVAC_SETPOINT_HEAT = 45 // HVAC/Heater setpoint val int V_HVAC_FLOW_MODE = 46 // Flow mode for HVAC ("Auto", "ContinuousOn", "PeriodicOn") // SubTypes for MessageType M_INTERNAL // val int I_BATTERY_LEVEL = 0 // Use this to report the battery level (in percent 0-100). val int I_TIME = 1 // Sensors can request the current time from the Controller using this message. The time will be reported as the seconds since 1970 val int I_VERSION = 2 // Used to request gateway version from controller. val int I_ID_REQUEST = 3 // Use this to request a unique node id from the controller. val int I_ID_RESPONSE = 4 // Id response back to sensor. Payload contains sensor id. val int I_INCLUSION_MODE = 5 // Start/stop inclusion mode of the Controller (1=start, 0=stop). val int I_CONFIG = 6 // Config request from node. Reply with (M)etric or (I)mperal back to sensor. val int I_FIND_PARENT = 7 // When a sensor starts up, it broadcast a search request to all neighbor nodes. They reply with a I_FIND_PARENT_RESPONSE. val int I_FIND_PARENT_RESPONSE = 8 // Reply message type to I_FIND_PARENT request. val int I_LOG_MESSAGE = 9 // Sent by the gateway to the Controller to trace-log a message val int I_CHILDREN = 10 // A message that can be used to transfer child sensors (from EEPROM routing table) of a repeating node. val int I_SKETCH_NAME = 11 // Optional sketch name that can be used to identify sensor in the Controller GUI val int I_SKETCH_VERSION = 12 // Optional sketch version that can be reported to keep track of the version of sensor in the Controller GUI. val int I_REBOOT = 13 // Used by OTA firmware updates. Request for node to reboot. val int I_GATEWAY_READY = 14 // Send by gateway to controller when startup is complete. val int I_REQUEST_SIGNING = 15 // Used between sensors when initialting signing. val int I_GET_NONCE = 16 // Used between sensors when requesting nonce. val int I_GET_NONCE_RESPONSE = 17 // Used between sensors for nonce response. // MySensors 1.5 Configuration /////////////////////////////// // Use the HashMap "sensorToItemsMap" to create a relation between the nodeID // within MySensors and the item name in OpenHAB. // // Please note that you must map in both directions, so we can resolve both. // Mappings var HashMap<String, String> sensorToItemsMap = newLinkedHashMap( "3;1;" -> "Temp", "Temp" -> "3;1;", "3;2;" -> "Hum", "Hum" -> "3;2;", "3;255;" -> "Batt", "Batt" -> "3;255;", "1;1;" -> "Temp1", "Temp1" -> "1;1;", "1;2;" -> "Hum1", "Hum1" -> "1;2;", "1;255;" -> "Battery1", "Battery1" -> "1;255;", ) //////////////////////////////////////////////////////////////////////////////////////////////////// val org.eclipse.xtext.xbase.lib.Functions$Function4 mysensors = [ String IDs, int subType, String data, org.openhab.core.library.items.StringItem gw | if(!(data instanceof String)) println("\nERROR: data must be String but has " + data.getClass() + "\n") var String new_data if(data == "ON"){ new_data = new String("1") } else if (data == "OFF"){ new_data = new String("0") } else { new_data = new String(data) } var String output = IDs + "1;0;" + subType + ";" + new_data + "\n" gw.sendCommand(output) ] // Notes for this rule // This is all you need to have MySensors set your items. // It's better to hardcode the nodeID on your MySensors sensors, // because openHAB will not assign them nodeIDs. rule "Decode incoming MySensors data" when Item Arduino changed then var String lineBuffer = Arduino.state.toString.split("\n") for (String line : lineBuffer) { var String[] message = line.split(";") var Integer nodeId = new Integer(message.get(0)) var Integer childId = new Integer(message.get(1)) var Integer msgType = new Integer(message.get(2)) var Integer ack = new Integer(message.get(3)) var Integer subType = new Integer(message.get(4)) var String msg = message.get(5) var String openhab_item = sensorToItemsMap.get( nodeId + ";" + childId + ";" ) if (nodeId != 0){ // internal messages have nodeId 0, but are not used for now if (openhab_item == null){ println("No item matches nodeId=" + nodeId + ", childId=" + childId + ". Data received: " + msg) } else { // openhab_item != null print("openhab_item=" + openhab_item + "\t") print("msgType=" + msgType + " ") var String newState = msg if (msgType == M_SET){ // Set Command from or to node println("(SET)\t subType=" + subType + " ") if (subType == V_STATUS ){ if ( new Integer(msg) == 1 ) newState = "ON" else newState = "OFF" } if (subType == V_ARMED ){ if ( new Integer(msg) == 1 ) newState = "ON" else newState = "OFF" } else if (subType == V_TRIPPED){ if ( new Integer(msg) == 1 ) newState = "OPEN" else newState = "CLOSED" } else println("No special handler for subType=" + subType + " found. Simply using data as String.") postUpdate(openhab_item, newState) } if(msgType == M_INTERNAL){ // Internal Command print("(INTERNAL)\t") if(subType == I_SKETCH_NAME){ println("Sketch name: " + msg ) } if(subType == I_SKETCH_VERSION){ println("Sketch version: " + msg ) } if(subType == I_BATTERY_LEVEL){ postUpdate(sensorToItemsMap.get( nodeId + ";" + childId + ";"), msg) println ("Battery1 item: " + sensorToItemsMap.get( nodeId + ";" + childId + ";") + " Battery1: " + msg ) } if(subType == I_BATTERY_LEVEL){ postUpdate(sensorToItemsMap.get( nodeId + ";" + childId + ";"), msg) println ("Batt item: " + sensorToItemsMap.get( nodeId + ";" + childId + ";") + " Batt: " + msg ) } } } // openhab_item != null } } } endand here is the logs of openhhab
10:37:09.294 [DEBUG] [b.serial.internal.SerialDevice:194 ] - Received message '0;0;3;0;9;gateway started, id=0, parent=0, distance=0 0;0;3;0;14;Gateway startup complete. ' on serial port COM13 10:37:10.764 [DEBUG] [o.o.i.s.i.DiscoveryServiceImpl:66 ] - Registering new service _openhab-server-ssl._tcp.local. at port 8443 10:37:12.060 [INFO ] [c.internal.ModelRepositoryImpl:80 ] - Loading model 'demo.rules' 10:37:13.305 [DEBUG] [.i.LoggingPersistenceActivator:31 ] - Logging persistence bundle has been started. 10:37:13.316 [DEBUG] [m.r.internal.engine.RuleEngine:305 ] - Executing rule 'Decode incoming MySensors data' 10:37:13.347 [DEBUG] [.p.internal.PersistenceManager:147 ] - Initializing logging persistence service. 10:37:13.369 [DEBUG] [.zwave.internal.ZWaveActivator:36 ] - Z-Wave binding started. Version 1.7.1 10:37:13.424 [DEBUG] [.z.internal.ZWaveActiveBinding:175 ] - ConverterHandler not initialised. Polling disabled. 10:37:13.424 [INFO ] [.z.internal.ZWaveActiveBinding:317 ] - ZWave 'updated' with null config 10:37:14.156 [DEBUG] [riptExtensionClassNameProvider:63 ] - Script actions have changed: PingActionService, AudioActionService, HTTPActionService, TransformationActionService, ExecActionService, 10:37:34.145 [DEBUG] [b.serial.internal.SerialDevice:194 ] - Received message '0;0;3;0;9;read: 1-1-0 s=255,c=0,t=17,pt=0,l=5,sg=0:1.4.1 1;255;0;0;17;1.4.1 0;0;3;0;9;read: 1-1-0 s=255,c=3,t=6,pt=1,l=1,sg=0:0 1;255;3;0;6;0 ' on serial port COM13 10:37:34.145 [DEBUG] [m.r.internal.engine.RuleEngine:305 ] - Executing rule 'Decode incoming MySensors data' 10:37:36.179 [DEBUG] [b.serial.internal.SerialDevice:194 ] - Received message '0;0;3;0;9;read: 1-1-0 s=255,c=3,t=11,pt=0,l=17,sg=0:Sensebender Micro 1;255;3;0;11;Sensebender Micro 0;0;3;0;9;read: 1-1-0 s=255,c=3,t=12,pt=0,l=3,sg=0:1.1 1;255;3;0;12;1.1 0;0;3;0;9;read: 1-1-0 s=1,c=0,t=6,pt=0,l=5,sg=0:1.4.1 1;1;0;0;6;1.4.1 0;0;3;0;9;read: 1-1-0 s=2,c=0,t=7,pt=0,l=5,sg=0:1.4.1 1;2;0;0;7;1.4.1 0;0;3;0;9;read: 1-1-0 s=255,c=3,t=0,pt=1,l=1,sg=0:80 1;255;3;0;0;80 0;0;3;0;9;read: 1-1-0 s=1,c=1,t=0,pt=7,l=5,sg=0:22.2 1;1;1;0;0;22.2 0;0;3;0;9;read: 1-1-0 s=2,c=1,t=1,pt=2,l=2,sg=0:47 1;2;1;0;1;47 ' on serial port COM13 10:37:36.179 [DEBUG] [m.r.internal.engine.RuleEngine:305 ] - Executing rule 'Decode incoming MySensors data' 10:37:47.968 [DEBUG] [b.serial.internal.SerialDevice:194 ] - Received message '0;0;3;0;9;read: 3-3-0 s=255,c=0,t=17,pt=0,l=3,sg=0:1.5 3;255;0;0;17;1.5 0;0;3;0;9;read: 3-3-0 s=255,c=3,t=6,pt=1,l=1,sg=0:0 3;255;3;0;6;0 ' on serial port COM13 10:37:47.968 [DEBUG] [m.r.internal.engine.RuleEngine:305 ] - Executing rule 'Decode incoming MySensors data' 10:37:50.078 [DEBUG] [b.serial.internal.SerialDevice:194 ] - Received message '0;0;3;0;9;read: 3-3-0 s=255,c=4,t=0,pt=6,l=10,sg=0:FFFFFFFFFFFFFFFF03 3;255;4;0;0;FFFFFFFFFFFFFFFF0300 0;0;3;0;9;read: 3-3-0 s=255,c=3,t=11,pt=0,l=17,sg=0:Sensebender Micro 3;255;3;0;11;Sensebender Micro 0;0;3;0;9;read: 3-3-0 s=255,c=3,t=12,pt=0,l=3,sg=0:1.3 3;255;3;0;12;1.3 0;0;3;0;9;read: 3-3-0 s=1,c=0,t=6,pt=0,l=0,sg=0: 3;1;0;0;6; 0;0;3;0;9;read: 3-3-0 s=2,c=0,t=7,pt=0,l=0,sg=0: 3;2;0;0;7; 0;0;3;0;9;read: 3-3-0 s=1,c=1,t=0,pt=7,l=5,sg=0:22.2 3;1;1;0;0;22.2 0;0;3;0;9;read: 3-3-0 s=2,c=1,t=1,pt=2,l=2,sg=0:48 3;2;1;0;1;48 0;0;3;0;9;read: 3-3-0 s=255,c=3,t=0,pt=1,l=1,sg=0:75 3;255;3;0;0;75 ' on serial port COM13 10:37:50.078 [DEBUG] [m.r.internal.engine.RuleEngine:305 ] - Executing rule 'Decode incoming MySensors data' 10:37:50.158 [ERROR] [o.o.c.s.ScriptExecutionThread :50 ] - Error during the execution of rule 'Decode incoming MySensors data': 5 10:38:42.965 [DEBUG] [b.serial.internal.SerialDevice:194 ] - Received message '0;0;3;0;9;read: 1-1-0 s=255,c=3,t=0,pt=1,l=1,sg=0:82 1;255;3;0;0;82 0;0;3;0;9;read: 1-1-0 s=1,c=1,t=0,pt=7,l=5,sg=0:22.1 1;1;1;0;0;22.1 0;0;3;0;9;read: 1-1-0 s=2,c=1,t=1,pt=2,l=2,sg=0:46 1;2;1;0;1;46 ' on serial port COM13 10:38:42.965 [DEBUG] [m.r.internal.engine.RuleEngine:305 ] - Executing rule 'Decode incoming MySensors data' 10:39:49.716 [DEBUG] [b.serial.internal.SerialDevice:194 ] - Received message '0;0;3;0;9;read: 1-1-0 s=1,c=1,t=0,pt=7,l=5,sg=0:22.1 1;1;1;0;0;22.1 0;0;3;0;9;read: 1-1-0 s=2,c=1,t=1,pt=2,l=2,sg=0:46 1;2;1;0;1;46 ' on serial port COM13 10:40:40.851 [DEBUG] [m.r.internal.engine.RuleEngine:305 ] - Executing rule 'Decode incoming MySensors data' 10:40:56.432 [DEBUG] [b.serial.internal.SerialDevice:194 ] - Received message '0;0;3;0;9;read: 1-1-0 s=1,c=1,t=0,pt=7,l=5,sg=0:22.2 1;1;1;0;0;22.2 0;0;3;0;9;read: 1-1-0 s=2,c=1,t=1,pt=2,l=2,sg=0:48 1;2;1;0;1;48 ' on serial port COM13 10:40:56.432 [DEBUG] [m.r.internal.engine.RuleEngine:305 ] - Executing rule 'Decode incoming MySensors data' 10:41:04.095 [DEBUG] [b.serial.internal.SerialDevice:194 ] - Received message '0;0;3;0;9;read: 3-3-0 s=1,c=1,t=0,pt=7,l=5,sg=0:24.2 3;1;1;0;0;24.2 0;0;3;0;9;read: 3-3-0 s=2,c=1,t=1,pt=2,l=2,sg=0:76 3;2;1;0;1;76 ' on serial port COM13 10:41:04.095 [DEBUG] [m.r.internal.engine.RuleEngine:305 ] - Executing rule 'Decode incoming MySensors data' 10:42:03.228 [DEBUG] [b.serial.internal.SerialDevice:194 ] - Received message '0;0;3;0;9;read: 1-1-0 s=1,c=1,t=0,pt=7,l=5,sg=0:22.2 1;1;1;0;0;22.2 ' on serial port COM13 10:42:03.230 [DEBUG] [m.r.internal.engine.RuleEngine:305 ] - Executing rule 'Decode incoming MySensors data' 10:42:03.437 [DEBUG] [b.serial.internal.SerialDevice:194 ] - Received message '0;0;3;0;9;read: 1-1-0 s=2,c=1,t=1,pt=2,l=2,sg=0:47 1;2;1;0;1;47 ' on serial port COM13 10:42:03.437 [DEBUG] [m.r.internal.engine.RuleEngine:305 ] - Executing rule 'Decode incoming MySensors data' 10:42:08.798 [DEBUG] [b.serial.internal.SerialDevice:194 ] - Received message '0;0;3;0;9;read: 3-3-0 s=1,c=1,t=0,pt=7,l=5,sg=0:23.5 3;1;1;0;0;23.5 0;0;3;0;9;read: 3-3-0 s=2,c=1,t=1,pt=2,l=2,sg=0:50 3;2;1;0;1;50 ' on serial port COM13 10:42:08.798 [DEBUG] [m.r.internal.engine.RuleEngine:305 ] - Executing rule 'Decode incoming MySensors data' 10:43:10.504 [DEBUG] [b.serial.internal.SerialDevice:194 ] - Received message '0;0;3;0;9;read: 1-1-0 s=1,c=1,t=0,pt=7,l=5,sg=0:22.1 1;1;1;0;0;22.1 0;0;3;0;9;read: 1-1-0 s=2,c=1,t=1,pt=2,l=2,sg=0:46 1;2;1;0;1;46 ' on serial port COM13 10:43:10.504 [DEBUG] [m.r.internal.engine.RuleEngine:305 ] - Executing rule 'Decode incoming MySensors data' 10:43:13.496 [DEBUG] [b.serial.internal.SerialDevice:194 ] - Received message '0;0;3;0;9;read: 3-3-0 s=1,c=1,t=0,pt=7,l=5,sg=0:23.2 3;1;1;0;0;23.2 0;0;3;0;9;read: 3-3-0 s=2,c=1,t=1,pt=2,l=2,sg=0:48 3;2;1;0;1;48 ' on serial port COM13 10:43:13.496 [DEBUG] [m.r.internal.engine.RuleEngine:305 ] - Executing rule 'Decode incoming MySensors data' 10:44:17.497 [DEBUG] [b.serial.internal.SerialDevice:194 ] - Received message '0;0;3;0;9;read: 1-1-0 s=1,c=1,t=0,pt=7,l=5,sg=0:22.0 1;1;1;0;0;22.0 ' on serial port COM13 10:44:17.500 [DEBUG] [m.r.internal.engine.RuleEngine:305 ] - Executing rule 'Decode incoming MySensors data' 10:44:18.176 [DEBUG] [b.serial.internal.SerialDevice:194 ] - Received message '0;0;3;0;9;read: 3-3-0 s=1,c=1,t=0,pt=7,l=5,sg=0:22.8 3;1;1;0;0;22.8 0;0;3;0;9;read: 3-3-0 s=2,c=1,t=1,pt=2,l=2,sg=0:46 3;2;1;0;1;46 ' on serial port COM13 10:44:18.176 [DEBUG] [m.r.internal.engine.RuleEngine:305 ] - Executing rule 'Decode incoming MySensors data' 10:45:24.715 [DEBUG] [b.serial.internal.SerialDevice:194 ] - Received message '0;0;3;0;9;read: 1-1-0 s=1,c=1,t=0,pt=7,l=5,sg=0:22.0 1;1;1;0;0;22.0 0;0;3;0;9;read: 1-1-0 s=2,c=1,t=1,pt=2,l=2,sg=0:46 1;2;1;0;1;46 ' on serial port COM13 10:45:24.717 [DEBUG] [m.r.internal.engine.RuleEngine:305 ] - Executing rule 'Decode incoming MySensors data' 10:46:31.704 [DEBUG] [b.serial.internal.SerialDevice:194 ] - Received message '0;0;3;0;9;read: 1-1-0 s=1,c=1,t=0,pt=7,l=5,sg=0:21.9 1;1;1;0;0;21.9 ' on serial port COM13 10:46:31.706 [DEBUG] [m.r.internal.engine.RuleEngine:305 ] - Executing rule 'Decode incoming MySensors data' 10:47:32.139 [DEBUG] [b.serial.internal.SerialDevice:194 ] - Received message '0;0;3;0;9;read: 3-3-0 s=1,c=1,t=0,pt=7,l=5,sg=0:22.3 3;1;1;0;0;22.3 0;0;3;0;9;read: 3-3-0 s=2,c=1,t=1,pt=2,l=2,sg=0:46 3;2;1;0;1;46 ' on serial port COM13 10:47:32.141 [DEBUG] [m.r.internal.engine.RuleEngine:305 ] - Executing rule 'Decode incoming MySensors data' 10:47:38.937 [DEBUG] [b.serial.internal.SerialDevice:194 ] - Received message '0;0;3;0;9;read: 1-1-0 s=1,c=1,t=0,pt=7,l=5,sg=0:21.9 1;1;1;0;0;21.9 0;0;3;0;9;read: 1-1-0 s=2,c=1,t=1,pt=2,l=2,sg=0:46 1;2;1;0;1;46 ' on serial port COM13 10:47:38.939 [DEBUG] [m.r.internal.engine.RuleEngine:305 ] - Executing rule 'Decode incoming MySensors data' 10:48:46.058 [DEBUG] [b.serial.internal.SerialDevice:194 ] - Received message '0;0;3;0;9;read: 1-1-0 s=2,c=1,t=1,pt=2,l=2,sg=0:46 1;2;1;0;1;46 ' on serial port COM13 10:48:46.060 [DEBUG] [m.r.internal.engine.RuleEngine:305 ] - Executing rule 'Decode incoming MySensors data' 10:49:53.042 [DEBUG] [b.serial.internal.SerialDevice:194 ] - Received message '0;0;3;0;9;read: 1-1-0 s=1,c=1,t=0,pt=7,l=5,sg=0:21.9 1;1;1;0;0;21.9 ' on serial port COM13 10:49:53.044 [DEBUG] [m.r.internal.engine.RuleEngine:305 ] - Executing rule 'Decode incoming MySensors data' 10:51:00.209 [DEBUG] [b.serial.internal.SerialDevice:194 ] - Received message '0;0;3;0;9;read: 1-1-0 s=255,c=3,t=0,pt=1,l=1,sg=0:82 1;255;3;0;0;82 0;0;3;0;9;read: 1-1-0 s=1,c=1,t=0,pt=7,l=5,sg=0:22.0 1;1;1;0;0;22.0 ' on serial port COM13 10:51:00.211 [DEBUG] [m.r.internal.engine.RuleEngine:305 ] - Executing rule 'Decode incoming MySensors data' 10:51:00.424 [DEBUG] [b.serial.internal.SerialDevice:194 ] - Received message '0;0;3;0;9;read: 1-1-0 s=2,c=1,t=1,pt=2,l=2,sg=0:46 1;2;1;0;1;46 ' on serial port COM13 10:51:00.426 [DEBUG] [m.r.internal.engine.RuleEngine:305 ] - Executing rule 'Decode incoming MySensors data' 10:52:07.248 [DEBUG] [b.serial.internal.SerialDevice:194 ] - Received message '0;0;3;0;9;read: 1-1-0 s=255,c=3,t=0,pt=1,l=1,sg=0:82 1;255;3;0;0;82 ' on serial port COM13 10:52:07.249 [DEBUG] [m.r.internal.engine.RuleEngine:305 ] - Executing rule 'Decode incoming MySensors data' 10:52:07.640 [DEBUG] [b.serial.internal.SerialDevice:194 ] - Received message '0;0;3;0;9;read: 1-1-0 s=1,c=1,t=0,pt=7,l=5,sg=0:21.9 1;1;1;0;0;21.9 0;0;3;0;9;read: 1-1-0 s=2,c=1,t=1,pt=2,l=2,sg=0:46 1;2;1;0;1;46 ' on serial port COM13 10:52:07.640 [DEBUG] [m.r.internal.engine.RuleEngine:305 ] - Executing rule 'Decode incoming MySensors data'The rule react fast and fill all the data (temp,hum,bat) on the openhab site for the node with the old firmware but with the new frimware i connect the batteries on the sensor and i must wait some minutes until the temp and hum appear on th site but the battery percent not,only after hours
Thanks
Nikos