jseidl / hass-magic_areas

Areas with batteries included for Home Assistant
MIT License
275 stars 28 forks source link
automation homeassistant python

Build Status GitHub Release License GitHub Last Commit Project Maintenance BuyMeCoffee

![integration-usage-badge] Discord

ma-logo

Your areas so smart it's almost magic! 🪄

Magic Areas is a custom component for Home Assistant that magically makes sense of the devices and entities in your areas so you don't have to! Its main purpose is tracking presence in your Home Assistant's areas but in reality it's much, much more than that.

Multiple sources of presence

Motion-activated lights are so 2000s. Magic Areas tracks multiple sources of presence in order to gauge an area's occupancy state, which you can use in automations but as you'll see, you might not even have to.

Motion sensors, doors, media devices, device presence (device_trackers) are supported and you can use Threshold and Template binary sensors to track presence from power consumption and other entities' states!

In the demo on the left, the area gets cleared instantly for illustration purposes but in reality you can configure the timeout you want for an area to not receive any presence event before it gets marked as clear/not occupied.

The "Presence Hold" feature gives you a switch that is considered a source of presence and will let users hold an area occupied while the switch is on.

Meta-areas

Magic Areas allows you to specify if an area is interior or exterior which allows it to create Meta-areas which groups all entities from said areas into their respective meta-areas.

Since the addition of floors to Home Assistant, Magic Areas now supports floor meta-areas in the same way as it does for the exterior / interior ones!

Some features (such as aggregation and groups) are available for meta-areas which allows you to control all your lights, media player devices, covers and climate devices of exterior areas, interior areas or whole floors in a single place.

Meta-areas simplify things by allowing you to use their aggregate sensors such as "Interior Motion" and "Exterior Door" in your alarm setups, "Exterior Light" as your area light sensors and much more!

Aggregate sensors

Group and automatically convert different unit sensors of the same device class together!

Aggregates are plain Home Assistant Groups and behave the same. Sensors of the same device class but with different units of measurement will be normalized and converted according to your unit system.

Even if you only have one sensor of each device class, aggregates allows you to reference a single entity in your automations while considering all others of the same device class but also allowing you to add new devices/entities to an area and having them automatically be considered in your automations that reference their aggregates.

Light Groups

Probably the most utilized feature of Magic Areas, allows you to automatically control your area's lights according an area's state. Would you like to have your overhead lights turned on when dark, but only your accent lights when watching TV unless you're sleeping then only a small light strip under your bed? Magic Areas has got you covered!

Our light groups are also smarter, meaning when you, for example, change brightness or color in a Magic Light Group, unlike regular Light Groups, it won't turn on other lights that are members of the same group that are off, effecively allowing changes in a light group to affect only lights that are currently on!

When an area is clear or it gets bright, Magic Areas will take care of turning the lights off for you!

Climate Groups

It (usually) doesn't make sense to have your fans running when you're not there, right? If you pair your fans with Generic Thermostats, you can have Magic Areas turn your fans on (and off!) for you! A clever twist is that areas have an extended state and you can set your climate group to only turn on after you've been there for a while, to avoid them coming on when you're just passing by.

Area-aware media player

Sending Text-to-speech notifications to media players is awesome, but sending notifications where no-one will hear isn't very smart and not magical at all. Area-aware media player is a media player group that will only forward play events to configured notification devices (i.e. media players) in areas that are currently occupied.

But wait, you won't wake up your kids! Magic areas allows you to specify states in which an area must be in order to receive notifications. Since Magic Areas supports a sleep state, if you leave that state out, areas that are sleeping won't be notified!

_And that's just the coolest ones, for all the features Magic Areas provides, check out the wiki._

Demo

Video coming soon!

Installation

Magic Areas is available on HACS! For installation instructions check the installation wiki.

Configuration

Configuration options for Magic Areas are on a per-area basis.

⚠️ Before you start: Please make sure you understand all the Concepts on the wiki.

💡 Light Groups won't control any lights unless the Light Control switch for that area is turned on!

Go to Configuration > Integrations. You will see the Magic Areas integration and configure each area (and Meta-Areas!).

See all configuration options in the wiki.

Magic Areas in your language!

Magic Areas has full translation support, meaning even your entities will be translated and is available in the following languages:

If your language isn't available and you would like to contribute, please check out the language files and submit your language file on a pull request!

Problems/bugs, questions, feature requests?

Questions?

Come talk to me on the #support channel at my Discord server or pop a question on our Q&A Discussions page!

Issues?

Please enable debug logging by putting this in configuration.yaml:

logger:
    default: warning
    logs:
        custom_components.magic_areas: debug

As soon as the issue occurs capture the contents of the log (/config/home-assistant.log) and open up a ticket or join the #support channel on my Discord server!

Feature requests

Please do not open issues for feature requests. Use the Feature Request discussions area to contribute with your ideas!

Contributions are welcome!

If you want to contribute to this please read the Contribution guidelines