Jump to content
WallDisplay: 2.0.0-beta3 is uploaded and ready for test ×

How to delay automatic on

Recommended Posts

I have a shelly plus 1 mounted as a switch to turn on a RPI3B running HomeAssistant. The reason is that in the area of this mountain cabin the power falls out sometimes, leaving the cabin in the dark. When power comes back, all network and computing starts up again, with different speeds. My Unifi Dream Router takes a couple of minutes to be back in function. The RPI starts up immeadiately and cannot find the LAN and is not given the ip. 

I use Wireguard to log on remotely to the cabin. I quickly find the Unifi Dream Router, but the Home Assistant is not running. I can then log in on the shelly and turn it on and off, and use the port management in the Unifi switch to turn on and off the internett. With some luck and after some time, I normally can enter the HomeAssistant.

But it would be nice to find a way to have the shelly toggle on some minutes after the power is back in the cabin. Make it wait for 5 minutes or so.

Is there anybody in here with an idea how this could be done?

Good suggestions will be highly appreciated

  • Like 1
Link to comment
Share on other sites

I would use such script:

const CONF = {
  period: 1000 * 60 * 5, // 5 minutes (in milliseconds)
  repeat: false,
const SWITCH = {
  on: function() { Shelly.call("Switch.Set", { id: 0, on: true }); },
  off: function() { Shelly.call("Switch.Set", { id: 0, on: false }); },

// make sure switch is OFF at first

function main() {
  // turn switch ON after configured time:

Timer.set(CONF.period, CONF.repeat, main);

- make sure you have correct switch ID (I have id: 0)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...