hass-magic_areas
hass-magic_areas copied to clipboard
Lights not turning on when presence is detected
Describe the bug
I expect lights within the area to turn on when presence is detected, they do not. However, if I turn the lights on manually then leave the area, then they turn off when the area state is clear
.
To Reproduce (config/screenshots in dropdowns)
Set up a magic area with default configuration + a light group.
{
"features": {
"light_groups": {
"overhead_lights": [],
"overhead_lights_states": [
"occupied",
"extended"
],
"overhead_lights_act_on": [
"occupancy",
"state"
],
"sleep_lights": [],
"sleep_lights_states": [],
"sleep_lights_act_on": [],
"accent_lights": [],
"accent_lights_states": [],
"accent_lights_act_on": [],
"task_lights": [],
"task_lights_states": [],
"task_lights_act_on": []
}
},
"type": "interior",
"exclude_entities": [],
"update_interval": 60,
"clear_timeout": 60,
"icon": "mdi:texture-box",
"presence_sensor_device_class": [
"motion",
"occupancy",
"presence"
],
"secondary_states": {
"sleep_state": "on",
"extended_time": 120,
"accent_state": "on",
"extended_timeout": 300,
"sleep_timeout": 60,
"sleep_entity": "",
"accent_entity": "",
"dark_state": "on",
"dark_entity": ""
},
"presence_device_platforms": [
"media_player",
"binary_sensor"
],
"on_states": [
"on",
"open"
],
"include_entities": [],
"name": "Hallway",
"id": "hallway"
}
Three entities are created
Turn on the `Area Light Control (Hallway)` entity.
Walk into the area -> presence is detected.
Lights do not turn on.
Logs:
2024-04-07 16:21:16.659 DEBUG (SyncWorker_3) [custom_components.magic_areas.binary_sensor] Area (Hallway): sensor 'binary_sensor.presence_sensor_fp2_7034_presence_sensor_4' changed to on
2024-04-07 16:21:16.659 DEBUG (SyncWorker_3) [custom_components.magic_areas.binary_sensor] [Area: hallway] Updating state. (Valid states: ['on', 'open'])
2024-04-07 16:21:16.660 DEBUG (SyncWorker_3) [custom_components.magic_areas.binary_sensor] [Area: hallway] Sensor binary_sensor.presence_sensor_fp2_7034_presence_sensor_4 state: on
2024-04-07 16:21:16.660 DEBUG (SyncWorker_3) [custom_components.magic_areas.binary_sensor] [Area: hallway] Valid presence sensor found: binary_sensor.presence_sensor_fp2_7034_presence_sensor_4.
2024-04-07 16:21:16.660 DEBUG (SyncWorker_3) [custom_components.magic_areas.binary_sensor] [Area: hallway] Active sensors: ['binary_sensor.presence_sensor_fp2_7034_presence_sensor_4']
2024-04-07 16:21:16.660 DEBUG (SyncWorker_3) [custom_components.magic_areas.binary_sensor] Hallway: State changed to True at 2024-04-07 15:21:16.660781
2024-04-07 16:21:16.661 DEBUG (SyncWorker_3) [custom_components.magic_areas.binary_sensor] Area (Hallway): Current state: {'dark', 'occupied'}, last state: {'dark', 'clear'} -> new states {'occupied'} / lost states {'clear'}
2024-04-07 16:21:16.661 DEBUG (SyncWorker_3) [custom_components.magic_areas.binary_sensor] Hallway: States updated. New states: {'occupied'} / Lost states: {'clear'}
2024-04-07 16:21:16.661 DEBUG (SyncWorker_3) [custom_components.magic_areas.binary_sensor] Reporting state change for Hallway (new states: ['dark', 'occupied']/lost states: [])
2024-04-07 16:21:16.670 DEBUG (SyncWorker_19) [custom_components.magic_areas.light] Light group Hallway Lights detected area state change
If I turn the lights on manually then leave the area, they turn off sucessfully:
2024-04-07 16:25:58.918 DEBUG (SyncWorker_3) [custom_components.magic_areas.binary_sensor] Refreshing sensor states Area (Hallway)
2024-04-07 16:25:58.918 DEBUG (SyncWorker_3) [custom_components.magic_areas.binary_sensor] [Area: hallway] Updating state. (Valid states: ['on', 'open'])
2024-04-07 16:25:58.919 DEBUG (SyncWorker_3) [custom_components.magic_areas.binary_sensor] [Area: hallway] Sensor binary_sensor.presence_sensor_fp2_7034_presence_sensor_4 state: off
2024-04-07 16:25:58.919 DEBUG (SyncWorker_3) [custom_components.magic_areas.binary_sensor] [Area: hallway] Active sensors: []
2024-04-07 16:25:58.919 DEBUG (SyncWorker_3) [custom_components.magic_areas.binary_sensor] Hallway: Area is on timeout
2024-04-07 16:25:58.919 DEBUG (SyncWorker_3) [custom_components.magic_areas.binary_sensor] Hallway: States updated. New states: [] / Lost states: []
2024-04-07 16:25:58.920 DEBUG (SyncWorker_3) [custom_components.magic_areas.binary_sensor] Reporting state change for Hallway (new states: []/lost states: [])
2024-04-07 16:25:58.927 DEBUG (SyncWorker_21) [custom_components.magic_areas.light] Light group Hallway Lights detected area state change
2024-04-07 16:26:16.660 DEBUG (SyncWorker_19) [custom_components.magic_areas.binary_sensor] Refreshing sensor states Area (Hallway)
2024-04-07 16:26:16.660 DEBUG (SyncWorker_19) [custom_components.magic_areas.binary_sensor] [Area: hallway] Updating state. (Valid states: ['on', 'open'])
2024-04-07 16:26:16.660 DEBUG (SyncWorker_19) [custom_components.magic_areas.binary_sensor] [Area: hallway] Sensor binary_sensor.presence_sensor_fp2_7034_presence_sensor_4 state: off
2024-04-07 16:26:16.660 DEBUG (SyncWorker_19) [custom_components.magic_areas.binary_sensor] [Area: hallway] Active sensors: []
2024-04-07 16:26:16.660 DEBUG (SyncWorker_19) [custom_components.magic_areas.binary_sensor] Hallway: Area is on timeout
2024-04-07 16:26:16.660 DEBUG (SyncWorker_19) [custom_components.magic_areas.binary_sensor] Hallway: Clear Timeout exceeded.
2024-04-07 16:26:16.661 DEBUG (SyncWorker_19) [custom_components.magic_areas.binary_sensor] Hallway: State changed to False at 2024-04-07 15:26:16.661446
2024-04-07 16:26:16.661 DEBUG (SyncWorker_19) [custom_components.magic_areas.binary_sensor] Area (Hallway): Current state: {'dark', 'clear'}, last state: {'dark', 'occupied'} -> new states {'clear'} / lost states {'occupied'}
2024-04-07 16:26:16.661 DEBUG (SyncWorker_19) [custom_components.magic_areas.binary_sensor] Hallway: States updated. New states: {'clear'} / Lost states: {'occupied'}
2024-04-07 16:26:16.661 DEBUG (SyncWorker_19) [custom_components.magic_areas.binary_sensor] Reporting state change for Hallway (new states: ['dark', 'clear']/lost states: [])
2024-04-07 16:26:16.662 DEBUG (SyncWorker_6) [custom_components.magic_areas.light] Light group Hallway Lights detected area state change
2024-04-07 16:26:16.663 DEBUG (SyncWorker_6) [custom_components.magic_areas.light] Hallway Lights: Area is clear, should turn off lights!
2024-04-07 16:26:16.665 DEBUG (SyncWorker_6) [custom_components.magic_areas.light] {self.name}: Control Reset.
2024-04-07 16:26:16.825 DEBUG (SyncWorker_22) [custom_components.magic_areas.light] {self.name}: Control Reset.
I've tried various combinations of restarting and reinstalling magic areas to no avail. I've also tried other areas with the same results.
Seems like you didn't added any lights to any of the groups.
"light_groups": {
"overhead_lights": [],
....
"sleep_lights": [],
....
"accent_lights": [],
....
"task_lights": [],
}
Try adding some lights into the "Overhead lights" through the config UI.
Also check out the wiki for Light Groups https://github.com/jseidl/hass-magic_areas/wiki/Light-Groups
Closing this due lack of interaction, please reopen if you still have issues.
I have the same issue with version 4: I recreated everything cause it broke with version 4. No lights turn on automatically. Seems to be broken.
2024-06-08 11:06:30.312 DEBUG (SyncWorker_17) [custom_components.magic_areas.light] Sleep Lights: Area state change event not for us. Skipping. (req: badezimmer/self: duschbad)
2024-06-08 11:06:30.312 DEBUG (SyncWorker_17) [custom_components.magic_areas.light] All Lights: Area state change event not for us. Skipping. (req: badezimmer/self: duschbad)
2024-06-08 11:06:30.312 DEBUG (SyncWorker_17) [custom_components.magic_areas.base.presence] Badezimmer: Binary presence sensor detected area state change.
2024-06-08 11:06:30.312 DEBUG (SyncWorker_17) [custom_components.magic_areas.light] Overhead Lights: Light group detected area state change
2024-06-08 11:06:30.313 DEBUG (SyncWorker_17) [custom_components.magic_areas.light] Sleep Lights: Light group detected area state change
2024-06-08 11:06:30.313 DEBUG (SyncWorker_17) [custom_components.magic_areas.light] All Lights: Light group detected area state change
2024-06-08 11:06:30.313 DEBUG (SyncWorker_17) [custom_components.magic_areas.base.presence] Küche: Area state change event not for us. Skipping. (req: badezimmer}/self: kuche)
2024-06-08 11:06:30.313 DEBUG (SyncWorker_17) [custom_components.magic_areas.light] Overhead Lights: Area state change event not for us. Skipping. (req: badezimmer/self: kuche)
2024-06-08 11:06:30.313 DEBUG (SyncWorker_17) [custom_components.magic_areas.light] Sleep Lights: Area state change event not for us. Skipping. (req: badezimmer/self: kuche)
2024-06-08 11:06:30.313 DEBUG (SyncWorker_17) [custom_components.magic_areas.light] All Lights: Area state change event not for us. Skipping. (req: badezimmer/self: kuche)
2024-06-08 11:06:30.313 DEBUG (SyncWorker_17) [custom_components.magic_areas.base.presence] Flur: Area state change event not for us. Skipping. (req: badezimmer}/self: flur)
2024-06-08 11:06:30.313 DEBUG (SyncWorker_17) [custom_components.magic_areas.light] Overhead Lights: Area state change event not for us. Skipping. (req: badezimmer/self: flur)
2024-06-08 11:06:30.314 DEBUG (SyncWorker_17) [custom_components.magic_areas.light] Sleep Lights: Area state change event not for us. Skipping. (req: badezimmer/self: flur)
2024-06-08 11:06:30.314 DEBUG (SyncWorker_17) [custom_components.magic_areas.light] All Lights: Area state change event not for us. Skipping. (req: badezimmer/self: flur)
One of the configurations:
@d4g did you turned on the light control switch?
Yes. It just doesn't do anything. Do I have to restart after turning it on?
You will need to make sure of the following
-
Ensure area is
dark
-
Ensure the light group is configured to the
occupied
state and also haveoccupancy
on "when should lights be controlled". (seems like you have from your previous screenshot) -
Ensure light control switch is on
-
With the area in the
clear
state, trigger presence in the area (you can use the presence hold switch for that). The lights should turn on.
If you did that and didn't worked, can you send me screenshots from your area sensor attributes (like my first screenshot) and the full configuration of the light group?