hass-magic_areas icon indicating copy to clipboard operation
hass-magic_areas copied to clipboard

Lights not turning on when presence is detected

Open twindebank opened this issue 10 months ago • 1 comments

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 image
Turn on the `Area Light Control (Hallway)` entity. image
Walk into the area -> presence is detected. image
Lights do not turn on. image

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.

twindebank avatar Apr 07 '24 15:04 twindebank

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

jseidl avatar Apr 24 '24 08:04 jseidl

Closing this due lack of interaction, please reopen if you still have issues.

jseidl avatar May 27 '24 06:05 jseidl

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: image

d4g avatar Jun 08 '24 09:06 d4g

@d4g did you turned on the light control switch?

jseidl avatar Jun 09 '24 18:06 jseidl

Yes. It just doesn't do anything. Do I have to restart after turning it on?

d4g avatar Jun 10 '24 18:06 d4g

You will need to make sure of the following

  1. Ensure area is dark image

  2. Ensure the light group is configured to the occupied state and also have occupancy on "when should lights be controlled". (seems like you have from your previous screenshot) image

  3. Ensure light control switch is on image

  4. 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. image

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?

jseidl avatar Jun 11 '24 05:06 jseidl