I have a remote rental property where I have a Zoom router and a Wink Hub that connect various things like thermostats, door locks, etc… which will sometimes go offline and require a reboot.
I have solved the Wink thing with a tuya switched outlet that I can manually toggle remotely to turn off/on to take care of that issue (which is very rare)
Now on the router… I would like to do the same but… turning off the router is no big deal if the tuya outlet is connected to my wan but I cannot turn it back on after I turn the wan off.
I tried bootlegging on the Xfinity wan cloud here at the condoplex but I can’t connect the tuya outlets to the cloud (which I have access to) because I think I need to be in close proximity to the Xfininty cloud router… which nobody really knows where that is.
I am at a loss right now.
A Tasmota flashed sonoff device could be what you are after.
Use the Backlog command:
Backlog power off; delay 40; power on
Would switch the sonoff off for 4 seconds then turn it back on.
You can issue it with a curl command. The http format is:
http://sonoff/cm?user=admin&password=yourwebadminpassword&cmnd=Backlog%20Power%20Toggle;Power1%20off
@tom thank you. was looking for this.
@Dixey you can use mqtt for this as well. See my example:
restart_wifi:
alias: 'Restart Wifi'
sequence:
- service_template: mqtt.publish
data_template:
topic: 'cmnd/sonoff10/satellite/Backlog' #https://github.com/arendst/Sonoff-Tasmota/wiki/Commands#using-backlog
payload_template: Power 0; delay 3300; Power 1
Would this be under “automation:” sorry still new to this…
restart_wifi:
alias: 'Restart Wifi'
sequence:
- service_template: mqtt.publish
data_template:
topic: 'cmnd/sonoff10/satellite/Backlog' #https://github.com/arendst/Sonoff-Tasmota/wiki/Commands#using-backlog
payload_template: Power 0; delay 3300; Power
Script… (but you could do it either way. A script would be more appropriate for an “on demand” kinda thing, an automation would be more for a scheduled event… but that’s just my opinion)
Thanks Dixey I have it working now!
One small thing the delay 100 = 1 sec? right? I added delay 1000 for 10 sec but it’s far longer than 10 sec
delay 10 = 1 sec.
Ok I read up on the…
E.g. in case of command Backlog Power1 OFF; **Delay 600**; Power1 ON
the usage of an additional Backlog
command without any argument within the delay time of 1 minute will delete the whole queue Power1 OFF; Delay 600; Power1 ON
. Therefore Power1 ON
command will not be executed and the relay would remain off.
That is why I asked from this 100 would be 1 sec, but your right 10 is 1 sec
Hi @Dixey one more question, I have set the PowerOnState to 1
(Since I want the switch to be on after a reboot)
But I have a 4CH Pro switch and I need the last switc to stay off
But I haven found a way to do this in the console of the switch its all ON or all OFF
I think they are defined in the console by:
POWER1
POWER2
POWER3
POWER4
Again thanks for all your help!
I am not familiar with it. Yer on yer own now bud, unless someone with more knowledge can chime in.
Okay maybe someone can help me forward, the script works! BUT only for switch 1?
So each script below restarts switch 1 (Also for switch 2 and 3)
I am using the Sonoff 4CH Pro with tasmota
script:
# KILLSWITCH - Turn off and automatic on again after 10 sec
restart_server1:
alias: 'Restart server1'
sequence:
- service_template: mqtt.publish
data_template:
topic: 'cmnd/Sonoff_4CHPRO/power1/Backlog'
#https://github.com/arendst/Sonoff-Tasmota/wiki/Commands#using-backlog
payload_template: Power 0; delay 100; Power 1
restart_server1:
alias: 'Restart server2'
sequence:
- service_template: mqtt.publish
data_template:
topic: 'cmnd/Sonoff_4CHPRO/power2/Backlog'
payload_template: Power 0; delay 100; Power 1
restart_modem:
alias: 'Restart modem'
sequence:
- service_template: mqtt.publish
data_template:
topic: 'cmnd/Sonoff_4CHPRO/power3/Backlog'
payload_template: Power 0; delay 100; Power 1
The switch is setup and working like this:
- platform: mqtt
name: "Sonoff_4CHPRO1"
command_topic: "cmnd/Sonoff_4CHPRO/power1"
state_topic: "stat/Sonoff_4CHPRO/POWER1"
availability_topic: "tele/Sonoff_4CHPRO/LWT"
qos: 1
payload_on: "ON"
payload_off: "OFF"
payload_available: "Online"
payload_not_available: "Offline"
retain: false
- platform: mqtt
name: "Sonoff_4CHPRO2"
command_topic: "cmnd/Sonoff_4CHPRO/power2"
state_topic: "stat/Sonoff_4CHPRO/POWER2"
availability_topic: "tele/Sonoff_4CHPRO/LWT"
qos: 1
payload_on: "ON"
payload_off: "OFF"
payload_available: "Online"
payload_not_available: "Offline"
retain: false
- platform: mqtt
name: "Sonoff_4CHPRO3"
command_topic: "cmnd/Sonoff_4CHPRO/power3"
state_topic: "stat/Sonoff_4CHPRO/POWER3"
availability_topic: "tele/Sonoff_4CHPRO/LWT"
qos: 1
payload_on: "ON"
payload_off: "OFF"
payload_available: "Online"
payload_not_available: "Offline"
retain: false
# Power on Masterstorage Expansion box (Default)
- platform: mqtt
name: "Sonoff_4CHPRO4"
command_topic: "cmnd/Sonoff_4CHPRO/power4"
state_topic: "stat/Sonoff_4CHPRO/POWER4"
availability_topic: "tele/Sonoff_4CHPRO/LWT"
qos: 1
payload_on: "ON"
payload_off: "OFF"
payload_available: "Online"
payload_not_available: "Offline"
retain: false
What about with this payload
payload_template: power1 ON; delay 100; power1 OFF
Likewise for power2 and power3.
That did !!! THANKS @tom_l (I’m stupid - each is defined by the switch number! its my first multi switch)
Now I am only missing a way to instruct the switch to be:
Always ON (after a reboot) for switch 1-3
Always OFF (after a reboot for switch 4)
Sofar running this in the console:
PowerOnState 1
for the switch starts by always on for 1-4 :frowning and then after 3 sec it tursn switch 4 Off?
Looking at the console it looks like this
16:17:27 MQT: tele/Sonoff_4CHPRO/LWT = Online (retained)
16:17:27 MQT: cmnd/Sonoff_4CHPRO/POWER =
16:17:27 MQT: tele/Sonoff_4CHPRO/INFO1 = {"Module":"Sonoff 4CH Pro","Version":"6.6.0.21(0ebec1f-sonoff)","FallbackTopic":"cmnd/Sonoff_4CHPRO_fb/","GroupTopic":"sonoffs"}
16:17:27 MQT: tele/Sonoff_4CHPRO/INFO2 = {"WebServerMode":"Admin","Hostname":"Sonoff_4CHPRO","IPAddress":"192.168.0.63"}
16:17:27 MQT: tele/Sonoff_4CHPRO/INFO3 = {"RestartReason":"Power on"}
16:17:27 MQT: stat/Sonoff_4CHPRO/RESULT = {"POWER1":"ON"}
16:17:27 MQT: stat/Sonoff_4CHPRO/POWER1 = ON
16:17:27 MQT: stat/Sonoff_4CHPRO/RESULT = {"POWER2":"ON"}
16:17:27 MQT: stat/Sonoff_4CHPRO/POWER2 = ON
16:17:27 MQT: stat/Sonoff_4CHPRO/RESULT = {"POWER3":"ON"}
16:17:27 MQT: stat/Sonoff_4CHPRO/POWER3 = ON
16:17:27 MQT: stat/Sonoff_4CHPRO/RESULT = {"POWER4":"ON"}
16:17:27 MQT: stat/Sonoff_4CHPRO/POWER4 = ON
16:17:29 MQT: stat/Sonoff_4CHPRO/RESULT = {"POWER4":"OFF"}
16:17:29 MQT: stat/Sonoff_4CHPRO/POWER4 = OFF
16:17:35 MQT: tele/Sonoff_4CHPRO/STATE = {"Time":"2019-10-27T16:17:35","Uptime":"0T00:00:17","UptimeSec":17,"Heap":27,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":40,"MqttCount":1,"POWER1":"ON","POWER2":"ON","POWER3":"ON","POWER4":"OFF","Wifi":{"AP":1,"SSId":"MYWIFI","BSSId":"F2:9F:C2:27:D3:55","Channel":8,"RSSI":78,"LinkCount":1,"Downtime":"0T00:00:06"}}
Have you tried the obvious:
poweronstate1 1
poweronstate2 1
Etc...
Yes but after cutting the power I just got:
16:34:08 MQT: tele/Sonoff_4CHPRO/LWT = Online (retained)
16:34:08 MQT: cmnd/Sonoff_4CHPRO/POWER =
16:34:08 MQT: tele/Sonoff_4CHPRO/INFO1 = {"Module":"Sonoff 4CH Pro","Version":"6.6.0.21(0ebec1f-sonoff)","FallbackTopic":"cmnd/Sonoff_4CHPRO_fb/","GroupTopic":"sonoffs"}
16:34:08 MQT: tele/Sonoff_4CHPRO/INFO2 = {"WebServerMode":"Admin","Hostname":"Sonoff_4CHPRO","IPAddress":"192.168.0.63"}
16:34:08 MQT: tele/Sonoff_4CHPRO/INFO3 = {"RestartReason":"Power on"}
16:34:08 MQT: stat/Sonoff_4CHPRO/RESULT = {"POWER1":"OFF"}
16:34:08 MQT: stat/Sonoff_4CHPRO/POWER1 = OFF
16:34:08 MQT: stat/Sonoff_4CHPRO/RESULT = {"POWER2":"OFF"}
16:34:08 MQT: stat/Sonoff_4CHPRO/POWER2 = OFF
16:34:08 MQT: stat/Sonoff_4CHPRO/RESULT = {"POWER3":"OFF"}
16:34:08 MQT: stat/Sonoff_4CHPRO/POWER3 = OFF
16:34:08 MQT: stat/Sonoff_4CHPRO/RESULT = {"POWER4":"OFF"}
16:34:08 MQT: stat/Sonoff_4CHPRO/POWER4 = OFF
16:34:10 MQT: stat/Sonoff_4CHPRO/RESULT = {"POWER4":"OFF"}
16:34:10 MQT: stat/Sonoff_4CHPRO/POWER4 = OFF
I read that the console settings override any settings in Hassio, but maybee its some retain setting there?
Looking at the Tasmota command reference I don’t think you can use poweronstate<x> 1
Might be best to raise an issue on the Tasmota github.
Thanks have asked in a open Multiswitch topic:
One other thing I just noticed is that if I call the “Reboot” scripts one by one running them after each other, this will result in the previous switch turning on before the timer delay and switching on the next
The easiest fix would probably be to add a delay of each script running = the delay of the reboot?
Maybee somthing like this:
restart_gigabit_modem:
alias: '3-Restart Gigabit'
sequence:
- service_template: mqtt.publish
data_template:
topic: 'cmnd/Sonoff_4CHPRO/power3/Backlog'
delay: '00:00:10'
payload_template: Power3 0; delay 100; Power3 1
Nice. Looks like they have a solution for you:
Rule1 ON System#Boot DO Backlog Power1 1; Power2 1; Power3 1; Power4 0 ENDON
Rule1 1