jseidl / hass-magic_areas

Areas with batteries included for Home Assistant
MIT License
273 stars 28 forks source link

Light Control not working for most Areas #261

Closed Zipties closed 12 months ago

Zipties commented 2 years ago

I have exhausted everything I can think to try on this one.

I was running 2x and everything worked fine. I followed instructions before upgrading to 3x and removed all magic area integrations and then setup 3x. For whatever reason, I can only get light control to work for one room (pantry in the logs) and occasionally it works for the garage.

In the logs I activated the "Hallway" area by opening a contact sensor. The MA presence sensor detects the state change and occupies the room, but the light never comes on. I also made sure the light control switch was turned on for all areas. home-assistant.log The logs are noisy, but I can see where the state change happens...but then just nothing else happens.

jseidl commented 2 years ago

Is the area in the dark state? You can check by expanding the area attributes and looking at the states attribute. Also, have you configured the light groups, setting lights to overhead/sleep and such?

Can you post a screenshot with your expanded attributes for both the areas working and not working?

pservais commented 2 years ago

I think he's making the same mistake I've made. Searched for hours, before finally seeing that the Light Control switch was Off Stupid me...

Zipties commented 2 years ago

Is the area in the dark state? You can check by expanding the area attributes and looking at the states attribute. Also, have you configured the light groups, setting lights to overhead/sleep and such?

Can you post a screenshot with your expanded attributes for both the areas working and not working?

Here are two areas that don't work CleanShot 2022-10-11 at 14 03 21 (the door was left open)

CleanShot 2022-10-11 at 13 57 56

Here is one that does work

CleanShot 2022-10-11 at 13 59 33

Area light control is on in all rooms

CleanShot 2022-10-11 at 14 00 54

All areas properly detect presence, they just do not control lights (except the pantry shown above)

jseidl commented 1 year ago

Does any light group gets created? Did you assigned lights to light groups (accent, overhead, task etc)

Sorry for the delay getting back to you, this end of year was a rush!

tyme2tb commented 1 year ago

I am having the same issue. Except none of my light controls is working.

jseidl commented 1 year ago

@tyme2tb do you still have this issue? Sorry I missed your comment

jseidl commented 12 months ago

Closing as no response from affected users.

GabrielGoldsteinAnidea commented 11 months ago

I suspect I'm having the same issue.

Area control is switched on.

There are two lights in my office. If I put one or both of the lights in the "Overhead lights (Leave blank for all area lights)" location, they turn on and off with the binary_sensor.area_office. If I leave blank, the light group will only turn off the lights. I have to turn them on manually.

jseidl commented 11 months ago

I suspect I'm having the same issue.

Area control is switched on.

There are two lights in my office. If I put one or both of the lights in the "Overhead lights (Leave blank for all area lights)" location, they turn on and off with the binary_sensor.area_office. If I leave blank, the light group will only turn off the lights. I have to turn them on manually.

That's exactly what is supposed to happen. You assign lights to the groups and you add the states where the group should be turned on. An area being cleared will turn off all lights and an area losing a state that is tied to a group will cause the group to turn off.

GabrielGoldsteinAnidea commented 11 months ago

Ok, rereading it and writing this message, I see how the 'Light Groups' page will only make the groups. However the 'States which overhead lights are turned on' has occupiedand extendedset. 'When should overhead lights be controlled has stateand occupancyset. What else do I do to get it to actually turn on the lights? (some variations from images as I've been experimenting.)

I have nothing in 'Secondary States': image

I ask it to create light groups on the next screen.

image image

Here is the binary_sensor.area_office in the dev tool screen: Activated: image

Deactivated: image

jseidl commented 11 months ago

Right, yes so the automatic lights / light group feature is a bit "not straightforward" but that's just because I suck at explaining things in the UI.

Alright taking from the top:

First let's talk about the area states. In the simplest form, an area can be occupied or clear, depending if the black magic of it detected presence in the past X seconds yada yada. Cool.

Then there's secondary states. The built-in one is extended which will be set after the area has been occupied for over Y seconds (configured on the "Secondary States" screen) and will be set until the area clears. This is useful if you wanna turn on only a dim light at first but then turn on the ceiling lights if MA think you're there for a while. That is very useful for me on the garage since I often go there for quick things it only turns on the small light I have there, but if I'm there for a while (doing laundry) it turns on the bright ones.

The other secondary states are sleep and accented that you can configure a entity that will set them if they're on on state. For that I use Adaptive Lighting's Sleep Switch for sleep and usually use accented for when I'm watching tv, for example.

The last and probably most important for light control is the dark/bright states. If you don't have a dark entity configured, MA will assume your rooms are always dark. If you do have one, your area will be dark depending on the state of that entity. MA will only turn lights ON when dark.

Now about the Light groups only. You get this 4 pre-named groups where you can put your lights. Cool, that will create a light entity that actually controls all of the lights you select. MA will also create a light_control switch for each area so you can toggle if you wanna this automatic light control to act or not. This comes disabled by default to prevent people going crazy so you need to turn that switch on.

With the light group, you can then set to which states the light will turn on. Occupied means as soon as the room is occupied, and the other ones you can now infer by my previous explanation. The last setting, which tells if the group will act on state or occupancy means that this light will either (or both) act whenever the area gains (turn on) or lose (turn off) a state (on state setting) or if it will only act when the area goes from clear to occupied. If you use the latter, that means that a light set to only to accented (on states) and occupancy (on when), will only turn on if you enter the room and the entity that controls the accented state is on.

If you still have issues please come to our discord at https://discord.gg/8vxJpJ2vP4 and I can follow up from there.