Hi everyone. I am running openhab2 on raspberry-pi 3. I am struggling with openhab not updating the power status of sonoff basic on reboot. Is this normal? Please suggest. I have tried to get the switch status in logs, it says NULL.
hey, many thanks for the quick reply. I found a simple cheat solution to this.
I created a rule that runs when “System started” and added this http command
here xxx is my sonoff ip.
And now openhab shows the sonoff power state correctly on reboot.
Could you share exactly your rule for this?
sorry, I am quite a newbie. Could someone explain exactly how to create a rule that updates the sonoff power status on reboot?
You need to puzzle both pieces (from the rules link and @akhilmagotra’s example) together:
rule "Speedtest init" when System started then createTimer(now.plusSeconds(30), [| if (Speedtest_Summary.state == NULL || Speedtest_Summary.state == "") Speedtest_Summary.postUpdate("unknown") ]) end
rule "update power" when System started then sendHttpGetRequest(“http://192.168.0.xxx/cm?cmnd=power”) end
sendHttpGetRequest syntax depends on the firmware you are using on your device.