How can i send command status 0 / status 5 using rule when the service start?
Hi
Have you read this resource?
Search for “System started”
And please be more specific. I’m guessing you’re talking about MQTT, but only since you are mentioning Tasmota:
1 Like
Got it.
Thanks to this https://community.openhab.org/t/using-sonoff-power-switches-with-tasmota-firmware-and-openhab2-mqtt2-binding/59969/54?u=sldm
val sonoff_device_ids = newArrayList("sonoffs")
val actions = getActions("mqtt","mqtt:broker:myMQTTBroker")
rule "Update Sonoff Status"
Time cron "0 0 0/1 1/1 * ? *" or
System started
then
for (String device_id : sonoff_device_ids) {
logDebug("sonoff.rules", "Updating Status Item for Device: " + device_id )
actions.publishMQTT("cmnd/" + device_id + "/STATUS", "2")
actions.publishMQTT("cmnd/" + device_id + "/STATUS", "5")
}
end
2 Likes