Geekzone: technology news, blogs, forums
Guest
Welcome Guest.
You haven't logged in yet. If you don't have an account you can register now.


peejayw

1841 posts

Uber Geek


#271905 31-May-2020 19:52
Send private message

I have a simple (I thought) requirement. I want to turn off a Sonoff wifi switch if it has been on for 5 minutes.

 

So, here is my config............

 

- id: '1590906894888'
  alias: Switch Off After 5Min
  description: ''
  trigger:
  - entity_id: switch.00343721dc4f225b74f8
    for: 5 minutes
    from: 'Off'
    platform: state
    to: 'On'
  condition: []
  action:
  - device_id: 428fc41b503e4d2aa8aa0ec49821999f
    domain: switch
    entity_id: switch.00343721dc4f225b74f8
    type: turn_off

 

The entity_id is the sonoff switch in question. Trouble is, the switch never turns off. If I manually execute, it does so at least I know the Sonoff is the correct one.

 

Any thoughts?

 

 

 

 

 

 

 



 

 





 I'm supposed to respect my elders, but it's getting harder and harder for me to find one now.


Create new topic
hairy1
3332 posts

Uber Geek

ID Verified
Trusted
Lifetime subscriber

  #2495918 31-May-2020 19:56
Send private message

To be honest I gave up on native automations and switched to Node Red... Amazing and much easier to debug.

Sorry this doesn't answer your question.

Cheers, Matt.




My views (except when I am looking out their windows) are not those of my employer.




hio77
12999 posts

Uber Geek

ID Verified
Trusted
Lizard Networks

  #2495923 31-May-2020 20:03
Send private message

sonoff on a hotblanket... .now that's an idea...





#include <std_disclaimer>

 

Any comments made are personal opinion and do not reflect directly on the position my current or past employers may have.

 

 


peejayw

1841 posts

Uber Geek


  #2495924 31-May-2020 20:03
Send private message

Thanks, will have a look at Node Red but I would still like to find out where I am going wrong with this setup, frustrating.





 I'm supposed to respect my elders, but it's getting harder and harder for me to find one now.




hairy1
3332 posts

Uber Geek

ID Verified
Trusted
Lifetime subscriber

  #2495939 31-May-2020 21:42
Send private message

There seems to be so many examples floating around of incorrect / outdated formats for automation. This is the problem. Even the ordering of elements in YAML is "fickle". I highly recommend Node Red for automation. I spent hours on native automations and found there was just no language consistency and ability to debug.





My views (except when I am looking out their windows) are not those of my employer.


muppet
2568 posts

Uber Geek

Trusted

  #2495950 31-May-2020 21:59
Send private message

First of all, Node-Red is so much easier. You will honestly feel like a chump when you realise the hours you spent figuring out what's what with your YAML would have been 2 minutes of click and drop in Node-Red.

 

Regardless:

 

 

action:
  - device_id: 428fc41b503e4d2aa8aa0ec49821999f
    domain: switch
    entity_id: switch.00343721dc4f225b74f8
    type: turn_off

 

 

You don't seem to be calling a service?  Usually to get a light to turn off you'd call a service:

 

From my old backed up before-i-moved-to-node-red autmational.yaml (gosh I just SO miss yaml)

 

 

 

- id: hallway_light_auto_on
  alias: Hallway Light Auto On Mode
  trigger:
  - entity_id: binary_sensor.motion_sensor_158d0002274d4d
    platform: state
    to: 'on'
  condition:
  - after: sunset
    before: sunrise
    condition: sun
  action:
  - entity_id: light.gateway_light_7811dcfd599a
    service: homeassistant.turn_on

 

 

 

See how I call a service of homeassistant.turn_on?  I would guess you need to call some sort of service of turn_off.  You have an action of turn_off, maybe that's a new way to do it?  But that's what I used to have to do, call a service.


peejayw

1841 posts

Uber Geek


  #2496000 1-Jun-2020 06:28
Send private message

Thanks, looks like I should start learning Node-Red then. Any suggestions on a good place to start?




 I'm supposed to respect my elders, but it's getting harder and harder for me to find one now.


hairy1
3332 posts

Uber Geek

ID Verified
Trusted
Lifetime subscriber

  #2496009 1-Jun-2020 08:34
Send private message

Great choice. I offer a 100% money back guarantee. The thing about Node Red is that it is very intuitive. Either of these guides will get you going:

 

https://www.youtube.com/watch?v=SuoSXVqjyfc

 

https://www.youtube.com/watch?v=dYN1Lp-XYKA

 

Here is your flow to turn your blanket off after 5 minutes. The reason for the switch is that you only want to wait 5 minutes if the blanket is set to on.

 

Click to see full size

 

More than happy to help with flows if required.

 

Cheers, Matt.





My views (except when I am looking out their windows) are not those of my employer.


 
 
 

Free kids accounts - trade shares and funds (NZ, US) with Sharesies (affiliate link).
peejayw

1841 posts

Uber Geek


  #2496010 1-Jun-2020 08:37
Send private message

Many thanks, will start bashing the brain cells into order 😄




 I'm supposed to respect my elders, but it's getting harder and harder for me to find one now.


Nate001
640 posts

Ultimate Geek


  #2496033 1-Jun-2020 09:48
Send private message

This is what I use to turn off a fan after it has been on for 1 hour. Just as others have posted above.

 


muppet
2568 posts

Uber Geek

Trusted

  #2496153 1-Jun-2020 14:43
Send private message

Nate001:

 

This is what I use to turn off a fan after it has been on for 1 hour. Just as others have posted above.

 

 

 

Yup, you're calling a service.

 

I suspect that's what's missing in OP's post.


Create new topic





News and reviews »

Air New Zealand Starts AI adoption with OpenAI
Posted 24-Jul-2025 16:00


eero Pro 7 Review
Posted 23-Jul-2025 12:07


BeeStation Plus Review
Posted 21-Jul-2025 14:21


eero Unveils New Wi-Fi 7 Products in New Zealand
Posted 21-Jul-2025 00:01


WiZ Introduces HDMI Sync Box and other Light Devices
Posted 20-Jul-2025 17:32


RedShield Enhances DDoS and Bot Attack Protection
Posted 20-Jul-2025 17:26


Seagate Ships 30TB Drives
Posted 17-Jul-2025 11:24


Oclean AirPump A10 Water Flosser Review
Posted 13-Jul-2025 11:05


Samsung Galaxy Z Fold7: Raising the Bar for Smartphones
Posted 10-Jul-2025 02:01


Samsung Galaxy Z Flip7 Brings New Edge-To-Edge FlexWindow
Posted 10-Jul-2025 02:01


Epson Launches New AM-C550Z WorkForce Enterprise printer
Posted 9-Jul-2025 18:22


Samsung Releases Smart Monitor M9
Posted 9-Jul-2025 17:46


Nearly Half of Older Kiwis Still Write their Passwords on Paper
Posted 9-Jul-2025 08:42


D-Link 4G+ Cat6 Wi-Fi 6 DWR-933M Mobile Hotspot Review
Posted 1-Jul-2025 11:34


Oppo A5 Series Launches With New Levels of Durability
Posted 30-Jun-2025 10:15









Geekzone Live »

Try automatic live updates from Geekzone directly in your browser, without refreshing the page, with Geekzone Live now.



Are you subscribed to our RSS feed? You can download the latest headlines and summaries from our stories directly to your computer or smartphone by using a feed reader.