ITEAD Sonoff TelePeriod item

I now have a bunch of Sonoff devices. And I’d like to set and read the TelePeriod for them.
What I’d like to achieve is to have the TelePeriod on a high frequency if the device is ON and on a low frequency if it’s OFF.

So now, what do I do:

  1. I send the TelePeriod command, if the item state changes
  2. the Sonoff responds with stat/sonoffHeatingIR/RESULT = {"TelePeriod":"20"}

so far so good. But what’s not so good, also if the device gets some other command (e.g. POWER ON/OFF), the topic stays the same stat/sonoffHeatingIR/RESULT, so I get ERRORs in my log, if the device responds to commands.

21:44:44 MQT: stat/sonoffHeatingIR/RESULT = {"POWER":"OFF"}
2018-01-17 21:44:45.516 [ERROR] [.mqtt.internal.MqttMessageSubscriber] - Error processing MQTT message.
org.openhab.core.transform.TransformationException: Invalid path '$.TelePeriod' in '{"POWER":"ON"}'
	at org.openhab.core.transform.TransformationHelper$TransformationServiceDelegate.transform( [200:org.openhab.core.compat1x:2.2.0]
	at org.openhab.binding.mqtt.internal.MqttMessageSubscriber.processMessage( [219:org.openhab.binding.mqtt:1.11.0]
	at []
	at org.eclipse.paho.client.mqttv3.internal.CommsCallback.deliverMessage( []
	at org.eclipse.paho.client.mqttv3.internal.CommsCallback.handleMessage( []
	at []
	at [?:?]

my item Looks like this:

Number Sensoren_SonoffHeatingIR_TelePeriod	"IR-Heizung Intervall [%d s]" 	{ mqtt=">[mqttoh2:cmnd/sonoffHeatingIR/TelePeriod:command:*:default],<[mqttoh2:stat/sonoffHeatingIR/RESULT:state:JSONPATH($.TelePeriod)]" }

is there a way to avoid the ERRORs?

Use the REGEX to only match on those messages that contain TelePeriod. Something like

.*TelePeriod.* should do it.

Put that after your JSONPATH;


All messages that fail to match the REGEX will be ignored.

1 Like

Thanks - works as usual! :wink:

1 Like