Areas no longer suck! Magic Areas will bring your Areas to life with area presence state tracking, aggregations and automations!

That seems to have done the trick!

When I try setup magic areas in the integration page I get this message, when I search for area entities they are not showing area’s

Being quite new to Home Assistant, I get an error trying to use/integrate magic areas.

I’ve tried so far different possibilities, resulting all in the same error.

My configuration.yaml looks like:


# Configure a default setup of Home Assistant (frontend, api, etc)
default_config:

# Text to speech
tts:
  - platform: google_translate

http:
  ssl_certificate: /config/.ssl/fullchain.pem
  ssl_key: /config/.ssl/privkey.pem

group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
logger: !include logger.yaml
sensor: !include_dir_merge_list sensors/
binary_sensor: !include_dir_merge_list binary_sensors/
device_tracker: !include_dir_merge_list device_tracker/
media_player: !include_dir_merge_list media_players/
switch: !include_dir_merge_list switches/

magic_areas: !include magicareas.yaml
    
homeassistant:
  #customize: !include customize.yaml
  customize: !include_dir_merge_named customize

and I’ve created a file called magicareas.yaml in the same directory with the following content:

buro:
    include_entities:
    - switch.allnet_plug

Even if I put everything in configuration.yaml, or if I do not add anything below magic_areas: in the configuration.yaml, I get the following error on startup:



Logger: homeassistant.setup
Source: custom_components/magic_areas/__init__.py:63
First occurred: 14:08:59 (1 occurrences)
Last logged: 14:08:59
Error during setup of component magic_areas

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/setup.py", line 213, in _async_setup_component
    result = await task
  File "/config/custom_components/magic_areas/__init__.py", line 63, in async_setup
    areas.append(AreaEntry(name=meta_area, id=meta_area.lower()))
TypeError: __init__() missing 1 required positional argument: 'normalized_name'

Any ideas, what I’m doing wrong?

I’m getting this error also, was working fine until latest HA update

Was corrected.

After having seen the updated version (2.0.4) I finally got magic areas running, however, I’ve got some basic questions which I couldn’t find an answer in the description or elsewhere.

  1. Are only binary sensors and media players supported? What about switches? If I use a custom switch, do I need to define a binary sensor to have the switch integrated in magic areas?

  2. I still try to figure out how to use the configuration. Is it possible to include the configuration for magic areas in a separate file, using the !include-functin of HA? And if so, how do I achieve this?

  3. I tried several ways to include a self defined binary sensor. The sensor itself works. I was not able to include the sensor.

I have several (shelly) devices which are assigned to areas but running magic_areas they are not auto assigned to the auto created areas of magic_areas. I tried putting the devices in the included_entries-section or by checking the sensors or switches directly in the integrations section. No success.
I also noticed, that changes to the presence_sensor_device_class in the integrations section, e. g. checking “power”, doesn’t do anything, whereas adding it in the configuration.yaml file seems to work (a look in the logfile shows that “power” was added)

Maybe someone can share his configuration or parts of it. Would be very helpful.
Thanks!

I’m trying to remove the magic areas. Uninstalled from hacs. Deleted all the areas entities. Deleted all the magic areas in integrations and the magic area integration disapeared but comes back always after reboot.Removed magic areas from yaml. It still shows up under integrations every reboot and I get this error on start up
Invalid config

The following integrations and platforms could not be set up:

  • magic_areas

Please check your config and logs.

and this error in logs:

Logger: homeassistant.setup
Source: setup.py:172
First occurred: 10:37:29 PM (1 occurrences)
Last logged: 10:37:29 PM

Setup failed for magic_areas: Integration not found.

What am I missing?

Sorry for the delay, did you managed to get it working?

Are only binary sensors and media players supported? What about switches? If I use a custom switch, do I need to define a binary sensor to have the switch integrated in magic areas?

Binary sensors, media players and device_trackers are currently supported. If you want to use a switch you will indeed need a template binary sensor (prolly presence device class) to be able to use in MA

I still try to figure out how to use the configuration. Is it possible to include the configuration for magic areas in a separate file, using the !include-functin of HA? And if so, how do I achieve this?

Documentation has been lacking since the move from config_flow (2.x.x). Sorry about that. If you’re using packages, you can create a magic_areas.yaml with the magic_areas: line on it. Everything else now is configured via the Web UI. To add new areas just create a regular area in HA and restart.

I tried several ways to include a self defined binary sensor. The sensor itself works. I was not able to include the sensor.

The binary sensor must be in one of those device classes hass-magic_areas/custom_components/magic_areas/const.py at 894bacd5e4881f5306d14d2fb3bee41c14b3eefa ¡ jseidl/hass-magic_areas ¡ GitHub or you can configure additional device classes in the area configuration in the UI

I have several (shelly) devices which are assigned to areas but running magic_areas they are not auto assigned to the auto created areas of magic_areas. I tried putting the devices in the included_entries-section or by checking the sensors or switches directly in the integrations section. No success.

They might be missing the appropriate device_class. Try adding via customize

I also noticed, that changes to the presence_sensor_device_class in the integrations section, e. g. checking “power”, doesn’t do anything, whereas adding it in the configuration.yaml file seems to work (a look in the logfile shows that “power” was added)

YAML configuration shouldn’t being used anymore. Try using the latest version because changing config should reload the area and start using your new power binary_sensor

I’m trying to remove the magic areas. Uninstalled from hacs. Deleted all the areas entities. Deleted all the magic areas in integrations and the magic area integration disapeared but comes back always after reboot.Removed magic areas from yaml. It still shows up under integrations every reboot and I get this error on start up

This is weird but I must admit that i never gave removal the proper testing, can you open an issue on github?

Finished the first pass of the wiki Home ¡ jseidl/hass-magic_areas Wiki ¡ GitHub

Hope that helps!

Hello,

i don’t want to open an issue.
I want to know, how you implatet an manual_on state in magic areas? in my case, i want to override automatic light, when i push a butten, or manual turn on light, or use google assistant…

I’m new in HA and want to implement these feature

Hi, I’m getting to love this integration!! But is there any way to populate a Lovelace control with the Magic Areas information? For example, populate an Entities control with all the lights in an Area?

I appreciate this can be done using filters - but Magic Areas already has this information so it would be good if this could be automatically be used to populate (and update on any changes) a control,

Ok, I am gettting an error “User input malformed” when I try to make a change (any change) to one of my Magic Areas. The only thing odd about it that I can see is that it refers to an entity that no longer exists for one of the additional light entities (it was an old zwave entity and I deleted it). If I use the drop down to change this to a valid light entity I still get the error.

I can delete the Magic Area - but will it then be re-created on the next system restart? Happy just to recongigure if that’s easier.

would it be possible to create a general area that depends on the other areas of the house?
in order to directly have a sensor that can indicate if someone is at home?
Example:
If someone is in the kitchen then someone is home

I imagined that
global = internal + external
internal = kitchen + living room + bedroom

I have seen the global area but it does not refer to the other areas of the house but directly to the sensors, so if specific configurations have been made in an area or specific devices have been added in an area, these configurations must also be redone for the global area

I want to know, how you implatet an manual_on state in magic areas? in my case, i want to override automatic light, when i push a butten, or manual turn on light, or use google assistant…

There are two ways (mainly) that you can acomplish that:

  1. Use the area’s presence_hold switch
  2. Create a template binary sensor with the presence device_class and add it to the area

But is there any way to populate a Lovelace control with the Magic Areas information? For example, populate an Entities control with all the lights in an Area?

You might be able to do it with auto-entities. MagicAreas does not provide any Lovelace cards currently.

I can delete the Magic Area - but will it then be re-created on the next system restart?

Yes, if you delete the area using the Integrations menu, it will be re-created fresh after restart

would it be possible to create a general area that depends on the other areas of the house?

This is not currently supported.

I have seen the global area but it does not refer to the other areas of the house but directly to the sensors

Currently yes, this is true. This will probably change on 3.0.0 when meta areas will track the area’s binary sensors themselves.

Although it referes to the sensors directly, it pulls the entities from the areas themselves so altering configuration (say, excluding or including) shall reflect on the global areas as well. Can you post your use case? Why binary_sensor.area_interior is not working for you?

Hi @jseidl , thax for your works.

In my case global/interior/exterior does not reflect the same results as the other areas put together because I differentiate clear_timeout by room (
because in some rooms I have pirs placed only in the entry / exit position of the room and they do not “see” the person while “working/stay” inside the room )
Example
kitchen clear_timeout = 60
dining room clear_timeout = 600

I see, indeed, this fix shall be coming up on the next release IIRC. Keep an eye out!