Tasmota: Using Tasmota as remote turn off and turn on again without MQTT

Created on 13 Mar 2018  路  12Comments  路  Source: arendst/Tasmota

I use some Sonoff Pow and Switches.

My use case is I'd like to use the Tasmota on a Sonoff to turn off the power and turn it on after some time. But - and that's the tricky part: it should turn on/off the router, meaning after turning the power off, there's no more chance to send another MQTT command to turn it on. Is there a way to achieve this?

help needed

Most helpful comment

@binderth - don't use PulseTime for delayed power on, simply use the Backlog feature with Delay, e. g.

Backlog Power OFF;Delay 600;Power ON

switches the power off, wait 60 sec and switches the power on

Using http

http://sonoff/cm?user=admin&password=joker&cmnd=Backlog%20Power%20OFF;Delay%20600;Power%20ON

Using MQTT

Topic tasmota/mydevice/cmnd/Backlog Payload Power OFF;Delay 600;Power ON

All 12 comments

Not yet tried. I think it should be possible with command pulsetime
Take a look in the wiki -> commands

Unfortunately pulsetime only works with ON and it'll shut OFF after specified time... Would be great you if it worked both ways!
So you can not only use it as staircase circuit, but also to shut something down after a specified time! Would come in handy not only in my use case I bet! So I can shut on some device after shutting it down without further commands.

I was also thinking about a solution for an unreliable modem and router using tasmota. I think it would be even better to leave this tasmota in AP mode so you can connect to it directly in case your wifi goes down completely. This would remove the need to have it power cycle automatically and you can use the existing firmware.

hmmm... if the Sonoff is in AP mode in tasmota how would it get "normal" mqtt-messages?

on the other hand, I'm still thinking, if pulsetime worked both ways it would be not only good for our modem/router issue, but other use cases also. I don't think, it had unwanted side effects, does it? for the very least, pulsetime could have an option for

  • use it only with OFF
  • use it only with ON or
  • use it both ways?

@binderth back to your first topic. Quick and dirty solution
Define your own module with inverted (false definend) relay.
With that you could invert command Pulsetime (mqtt states ON, in real it is OFF)

Thanks for the tipp: But how do I make a own module? ;)
could you point me to a start? Thanks!

Take a look for the configuration for your module in: sonoff_template.h
After that go in the web console and change module to type "generic"
Copy config from orig. setup 1:1 except relay. Invert this (if orig Relay1 new Relay1i)

@binderth - don't use PulseTime for delayed power on, simply use the Backlog feature with Delay, e. g.

Backlog Power OFF;Delay 600;Power ON

switches the power off, wait 60 sec and switches the power on

Using http

http://sonoff/cm?user=admin&password=joker&cmnd=Backlog%20Power%20OFF;Delay%20600;Power%20ON

Using MQTT

Topic tasmota/mydevice/cmnd/Backlog Payload Power OFF;Delay 600;Power ON

@curzon01 Better solution!

That's great @curzon01 Thank you!

Unfortunately pulsetime only works with ON and it'll shut OFF after specified time... Would be great you if it worked both ways!
So you can not only use it as staircase circuit, but also to shut something down after a specified time! Would come in handy not only in my use case I bet! So I can shut on some device after shutting it down without further commands.

Had the same problem; needed a switch to turn on 10 seconds after turning it off and ended using this solution (on tasmota console):

RULE1 ON Power1#state=0 DO ruletimer1 10 ENDON ON rules#timer=1 DO Power1 1 ENDON

RULE1 1

Many ways to solve with Tasmota 馃憤

Was this page helpful?
0 / 5 - 0 ratings