Every single day in the evening when the sun is below -4.0, my outdoor light will be triggered.
That rule works and triggers every single day. What happens is; if someone interupts the signal to my IKEA Traadfri because of interference or a microwave, then some of my bulbs wont turn on.
So I was wonderring, if I wanted to create a seperate automation that checks whether my different light groups are on or not, and then notify me with an actionable notification if one or more groups are = off?
I’ve tried to set up some things but it simply wont work.
I wonder if it is my condition statements that are wrong. Can someone try to come up with an example?
IF Group one or Group two or Group 3 is off then do below action
action:
data:
message: 'Light Group 1 and 3 is of'
data:
actions:
- action: notification_outdoor_front
title: Turn on
- action: notification_outdoor_back
title: Turn on
Does it make sense or am I completely off?
I was thinkin about running the rule when the sun is below -5, then it have had the time to sent the signals to all bulbs initially.
- id: Outdoor light ON when sunset
alias: Outdoor Sunset
trigger:
platform: numeric_state
entity_id: sun.sun
value_template: '{{ state.attributes.elevation }}'
below: -4.0
condition:
platform: state
entity_id: group.group_lights # CHANGE THIS WITH YOUR GROUP
state: off
action:
service: notify.notify # CHANGE THIS WITH YOUR NOTIFY SERVICE. ARE YOU INCLUDING THE NOTIFICATION SERVICE OF YOUR DEVICE?
data:
...
Would you show the trigger part of the automation? What you do to trigger the iOS notification actions?
If I understand the situation, you want notification if some lights did not turn on for some reason, right?
First, a simple state trigger to off using group.group1_lights will not work, because if any of group1 light is on, group1 has state=on, even if one or more lights in group1 is off.
Second, even if the state trigger is based on individual light, not group, if the light never turn on, the state to off trigger will never fires, because the light state never changed.
You may want to try instead a time trigger like every 15 minutes within an hour after sunset, and use condition to see if any light is off.
Alternatively, you can use the group’s state changing from: offto: on as a trigger and use the sunset as a condition. This might suit you better perhaps.
But then I am sure if I am understanding your problem correctly.
Edit: No, this wouldn’t work because you wanted to be notified when the lights did NOT turn on. So refer to my first example. That might work?
Well, I was wondering, maybe I should just ask all the bulbs at once and then if just one bulb is off, then I should get the notification with an action to run the sunset automation again.
I’ve only come across this a few times, and every time I fire the sunset rule manually, the last bulbs turns on.
I just don’t know how to cycle all the bulbs through in a good way?
Did you intentionally remove the service: notify section in the code? Because, as far as I know, without you mentioning the service, HA won’t know what to notify.
Yes, but how do I go through all the bulbs. In your example I only look for the state of the group of the bulbs. Otherwise I should use the same example and the just list all bulbs with comma separation right?
All you have to do is create a group called ‘all_doors’ and that template automation will work without doctoring it. You just need to make sure all items in the group either have one of the 4 following states: ‘on’, ‘off’,‘open’,‘closed’.
Well, I was only showing the alarm thing with door sensors as an example. I still want to check whether the light bulbs are ‘off’ and then list them in a notification. Because if the automation detecs any lights that still are on, then I want to press a button that will be shown along with the notification and fire back my sunset automation, so that the light will be turned on again.