OpenHab 2.4 MySensors Binding: string: Off, from gateway could not be used as OnOff state

OpenHab 2.4 and MySensors Binding 2.4.0.201812040738

Hi, I’m having a problem with a couple of my MySensors (Light actuators) that send “On” and “Off” messages (i.e. 5;0;1;0;2;Off) while the Light thing for the MySensors binding seems not to accpet those strings as valid OnOff states. Is there anything I can do to pre-transform the incoming strings to something valid or I will have to update my sketches on the MySensors devices for it to work?

This is what I can see in the log:

2019-06-10 09:56:09.430 [DEBUG] [ensors.handler.MySensorsThingHandler] - Setting last update for node/child 5/4 to 2019-06-10T09:56:09.000+0200
2019-06-10 09:56:09.430 [DEBUG] [rsAbstractConnection$MySensorsReader] - Message from gateway received: 5;0;1;0;2;Off
2019-06-10 09:56:09.430 [DEBUG] [rs.internal.gateway.MySensorsGateway] - Node 5 found in gateway
2019-06-10 09:56:09.432 [DEBUG] [rs.internal.gateway.MySensorsGateway] - Child 0 found in node 5
2019-06-10 09:56:09.432 [ERROR] [nternal.event.MySensorsEventRegister] - Event broadcasting throw an exception
java.lang.IllegalArgumentException: String: Off, could not be used as OnOff state
	at org.openhab.binding.mysensors.converter.MySensorsOnOffTypeConverter.fromString(MySensorsOnOffTypeConverter.java:31) ~[?:?]
	at org.openhab.binding.mysensors.converter.MySensorsTypeConverter.stateFromChannel(MySensorsTypeConverter.java:32) ~[?:?]
	at org.openhab.binding.mysensors.handler.MySensorsThingHandler.handleChildUpdateEvent(MySensorsThingHandler.java:303) ~[?:?]
	at org.openhab.binding.mysensors.handler.MySensorsThingHandler.sensorUpdateEvent(MySensorsThingHandler.java:227) ~[?:?]
	at org.openhab.binding.mysensors.internal.event.MySensorsEventRegister.lambda$4(MySensorsEventRegister.java:126) ~[?:?]
	at java.lang.Iterable.forEach(Iterable.java:75) ~[?:?]
	at org.openhab.binding.mysensors.internal.event.MySensorsEventRegister.notifyNodeUpdateEvent(MySensorsEventRegister.java:122) ~[?:?]
	at org.openhab.binding.mysensors.internal.gateway.MySensorsGateway.handleSetReqMessage(MySensorsGateway.java:560) ~[?:?]
	at org.openhab.binding.mysensors.internal.gateway.MySensorsGateway.handleIncomingMessage(MySensorsGateway.java:458) ~[?:?]
	at org.openhab.binding.mysensors.internal.gateway.MySensorsGateway.messageReceived(MySensorsGateway.java:371) ~[?:?]
	at org.openhab.binding.mysensors.internal.event.MySensorsEventRegister.lambda$1(MySensorsEventRegister.java:83) ~[?:?]
	at java.lang.Iterable.forEach(Iterable.java:75) [?:?]
	at org.openhab.binding.mysensors.internal.event.MySensorsEventRegister.notifyMessageReceived(MySensorsEventRegister.java:79) [233:org.openhab.binding.mysensors:2.4.0.201812040738]
	at org.openhab.binding.mysensors.internal.protocol.MySensorsAbstractConnection$MySensorsReader.run(MySensorsAbstractConnection.java:358) [233:org.openhab.binding.mysensors:2.4.0.201812040738]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:?]
	at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:?]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:?]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:?]
	at java.lang.Thread.run(Thread.java:748) [?:?]

Any idea of what can I try?

Thank you!

You can only use “ON” and “OFF” with a Switch. You will need to transform the “On” to “ON” and “Off” to “OFF”. I don’t know the binding, but if it supports transforms the Map transform is what you want. If not, you will either have to set up proxy Items and Rules which would be ugly, or fix your devices to send all caps.

Thanks Rich,

I was fearing this could happen, as the binding seems not to care about getting the messages transformed before evaluating them. So it looks like I’ll have to go the reflashing-devices way (they’ve been working for 3 years now, attached to a basement wall that gets wet when it rains, encased in a waterproof electric box (with openings for thermo/higro sensors and long range antenna)… so it’s gonna be fun going there with a laptop (wish me luck, I could be not returning!) :smile:

It doesn’t help you now, but I really really like some of the newer firmwares like Tasmota and ESP Easy with their OTA updates.