Hi all,
I am on openHAB latest running on an Ubuntu container. Jdk8 headless from apt. I have mosquitto running on a different container.
MQTT seems to be working fine using the MQTT binding which I have setup to look at the Mosquitto container IP address. I have taken the leap for this setup and am configuring everything in PaperUI (I used to only use the config files). Using the HomeAssistant style autodiscovery and so far my Sonoff Basics, Sonoff 4ch, Hue and Google devices are working well in the Control tab of PaperUI.
I’ve hit a stumbling block when trying to setup a Sonoff RF 433 Bridge (Tasmota 6.6.0). The only Thing showing up is status, nothing for the 16 RF inputs; I sortof expected this.
The channel in the MQTT Binding that I have added subscribes to:
sonoff-rf/tele/RESULT
Am I right in assuming the only way to configure the RF is to do it the old fashioned way using the config files?
I am receiving MQTT messages from the RF and it is showing up in Karaf:
15:49:57.034 [INFO ] [smarthome.event.ChannelTriggeredEvent] - mqtt:systemBroker:mosquitto:1 triggered {“RfReceived”:{“Sync”:17230,“Low”:550,“High”:1670,“Data”:“623386”,“RfKey”:1}}
For info, the only bit I am interested is the value of “RfKey” which will be from 1 to 16.
How do I extract this string, so that I can then do the usual JSONPATH transform on it which I am comfortable with?
I tried writing a rule (I have others working fine on Things/Items that were auto discovered), which does fire, but the “receivedEvent” is always coming through as null:
rule "RF Channel 1"
when Channel "mqtt:systemBroker:mosquitto:1" triggered
then
rf_ch_1.postUpdate(transform("JSONPATH", "$RfReceived.RfKey", receivedEvent))
end
The error in Karaf:
16:03:54.236 [ERROR] [untime.internal.engine.RuleEngineImpl] - Rule 'RF Channel 1': An error occurred during the script execution: Could not invoke method: org.eclipse.smarthome.core.transform.actions.Transformation.transform(java.lang.String,java.lang.String,java.lang.String) on instance: null
and the corresponding item for completeness:
Switch rf_ch_1
Happy to provide more info if I’ve missed anything.
Ideally I’d love to configure the payload condition in the MQTT Binding Channel to only fire if RfKey == 1 but I think you can only put values to compare against, and not a JSON parse? Then I could have a channel for each of the 16 keys.
Using MQTT - Bindings | openHAB for reference.
Kind regards
Simon