I think i have it working now.
When i listed the triggers in use, i should have specified that the Garage motion group any on was not a trigger listed in the blueprint and was only being used to try to keep the lights on when they were already on.
What i ended up doing was creating a group:
Garage Lighting Automation Sensor Group with the following members:
- Garage Bird Lights Time of day sensor
- Garage Door Sensor
- Garage House Door Sensor
- Garage Motion Sensor Group - All On
- Garage Occupancy Sensor ( new sensor made based off of your bee in the hive yaml)
Any one of these being active will make the group turn On.
For the New Occupancy Sensor i did the following so that when the automation runs, it turns on another switch that enables the occupancy sensor.
I created a Input Boolean helper first then used the following yaml in my templates.yaml
# Garage Occupancy Sensor
- trigger:
- trigger: state
entity_id: binary_sensor.garage_motion_sensor_group_any_on
to: "on"
- trigger: state
entity_id: binary_sensor.garage_motion_sensor_group_any_on
to: "off"
for:
seconds: 30
- trigger: state
entity_id: input_boolean.garage_occupancy_enable
- trigger: homeassistant
event: start
- switch:
- name: "Garage Occupancy Enable"
unique_id: "garage_occupancy_enable_switch"
state: "{{ is_state('input_boolean.garage_occupancy_enable_helper', 'on') }}"
turn_on:
service: input_boolean.turn_on
target:
entity_id: input_boolean.garage_occupancy_enable_helper
turn_off:
service: input_boolean.turn_off
target:
entity_id: input_boolean.garage_occupancy_enable_helper
binary_sensor:
- name: "Garage Occupancy Sensor"
unique_id: "garage_occupancy_sensor"
device_class: occupancy
icon: mdi:account-box-outline
state: >
{{ is_state('input_boolean.garage_occupancy_enable', 'on') and
is_state('binary_sensor.garage_motion_sensor_group_any_on', 'on') }}
The input boolean and the switch stay synced and then i can use the switch in your blueprint without modification and this occupancy sensor now works only when the enable switch is on, which is turned on and off by the automation.
And yes on occasion the birds will keep the occupancy on, but its pretty rare and normally only lasts one cycle.
I think this will cover most cases of the garage lighting.
I need to think about what happens if someone manually turns the light on or off and when that happens it should still turn the lights off after time runs out but only if its not during the Bird lights schedule.
Also if someone does accidentally turns the lights off while they should be on for the birds, i want them to come back on.
I have a similar scenario in my kitchen and bathrooms using this same blueprint i need to think through.
The guest bathroom does not have a window and will be pretty simple to figure out i think.
But the kitchen and master bathroom have windows and i use the ambient light sensor from my weather station to determine if the lights should come on.
Both rooms have motion and door sensors.
But i see when doing that if i turn them on manually, they do not automatically turn off.
I think i can take what i came up with here and apply some of the same logic to these rooms and move the ambient sensor and a manual switch press from these into the triggers.
Unless there is a better way to do this?
Maybe ideas for future features of your blueprint. This blueprint almost does everything i need coming from Hubitat and using the room lighting app.
Maybe if there was a separate set of triggers that only turn off the automation.
Maybe an option to have the ambient sensor or device tracker only keep the automation from turning lights on, that way if it was turned on manually the rest of the automation would run to turn them off.
Id be happy to help and test it all, but trying to modify your blueprint myself is proving to be difficult for me.
EDIT: I have seen your Manual Control status tracker and have messed with it some. I am thinking i would use this combined with the bypass options for my bathrooms and kitchen.
I do not think it will be that simple for the garage.