Sign in
Log inSign up
Marco Mornati

5 comments

Erwin Berkouwer
Erwin Berkouwer
Jan 7, 2023

Although I really like the setup, I could not get your script to work. Using Home Assistant's group helper what you create as a group is slightly different from a group like you created.

Using the following change it now works. Less elegant than via a group but I could not get that to work and this does the trick:

action:
  - service: script.light_duration
    data:
      light: >-
        light.{{["mini_dimmer","philips_lwa004_huelight","philips_lwa004_huelight_2","plug_10_werkkamer_lamp_switch"]|random}}
      duration: 00:{{ '{:02}'.format(range(5,30) | random | int) }}:00
1
·
·1 reply
Marco Mornati
Marco Mornati
Author
·Jan 8, 2023

Personally I love your version of the script. All needed for the automation is inside the automation itself... Maybe a bit more difficult to select other lights, but I prefer in this way than with my custom group. I will push this on my side too. Thanks for sharing.

·
Marco Mornati
Marco Mornati
Author
·Jan 8, 2023

Hey sorry... I missed your comment (the side effect of disabling all the notifications everywhere 😅).

Great to know you found a solution, but I'm surprised with the group it wasn't working.

·
·2 replies
Erwin Berkouwer
Erwin Berkouwer
Jan 8, 2023

Thank you for the feedback.

The only thing missing for me is that I have to activate the away-mode manually now. There has to be a way of making that autonomous too. Typically a household would have something they use every day you're at home (in our case the kitchen lights. I saw someone using home-assistant.io/integrations/history_stats to track 'away' state in a more reliable way. Unfortunately I could not yet wrap my head around how to set 'away' if those lights have not been manually turned on for (say) 8 hours.

·
Marco Mornati
Marco Mornati
Author
·Feb 8, 2023

Erwin Berkouwer hey. On my side all is link e to the alarm. When it is "away" mode it is started in Hass too.

Another way is to use the geofencing with your mobile phones... But it can be difficult if not all the people in your house have a mobile.

·