Giter Site home page Giter Site logo

c-st / auto_areas Goto Github PK

View Code? Open in Web Editor NEW
24.0 2.0 5.0 436 KB

๐Ÿค– A custom component for Home Assistant which automates your areas.

License: MIT License

Python 98.12% Shell 1.88%
home-assistant home-assistant-custom custom-component home-automation

auto_areas's People

Contributors

c-st avatar dependabot[bot] avatar jlverhagen avatar misa1515 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

auto_areas's Issues

Add general override

This system is very cool but until the user sets it up completely, there should be a general on/off switch that turns Auto Areas completely on and off so it doesn't interfere with existing automations.

All of my areas are "managed" even with no motion/occupancy/presence or light entities in them

Version of the custom_component

v1.0.3

Configuration

auto_areas:
  bedroom:
    is_sleeping_area: true

Describe the bug

"It checks each of your areas for relevant devices and starts managing them automatically. Additionally, it creates a few sensors and switches which allow you to adjust its behaviour as needed." - As it stands now, it manages all of my areas, even if there are no motion, occupancy or presence sensors in the area.

image

image

Debug log

N/A

Integration is using deprecated `DEVICE_CLASS_*` constants

Version of the custom_component

Any

Configuration

n/a

Describe the bug

This custom integration uses deprecated DEVICE_CLASS_* constants in its codebase.

The DEVICE_CLASS_* constants have been deprecated and replaced in Home Assistant Core 2021.12 (over a year ago). I would highly suggest updating/migrating this integration to the new enums.

For example, for the device classes supported by the sensor platform, there is now a SensorDeviceClass enum. So if a sensor previously used the DEVICE_CLASS_ENERGY constant, it should now use SensorDeviceClass.ENERGY. Other platforms (like binary_sensor, and number) provide similar enumerations for their supported device classes.

The migration thus only consists of replacing constants with an enumeration member and is, therefore, very low impact and should be fairly straightforward.

If I can help resolve any questions regarding this change or migration, feel free to ask or respond to this issue. I'm happy to help!

Kindest regards,

../Frenck

Debug log


n/a

Do not use deprecated HA API

Describe the bug

Auto Areas uses deprecated functionality from HA:

2023-01-10 21:58:25.604 WARNING (MainThread) [homeassistant.helpers.frame] Detected integration that uses deprecated `async_get_registry` to access area registry, use async_get instead. Please report issue to the custom integration author for auto_areas using this method at custom_components/auto_areas/binary_sensor.py, line 27: area_registry: AreaRegistry = await hass.helpers.area_registry.async_get_registry()
2023-01-10 21:58:25.611 WARNING (MainThread) [homeassistant.helpers.frame] Detected integration that uses deprecated `async_get_registry` to access entity registry, use async_get instead. Please report issue to the custom integration author for auto_areas using this method at custom_components/auto_areas/binary_sensor.py, line 29: await hass.helpers.entity_registry.async_get_registry()
2023-01-10 21:58:25.619 WARNING (MainThread) [homeassistant.helpers.frame] Detected integration that uses deprecated `async_get_registry` to access device registry, use async_get instead. Please report issue to the custom integration author for auto_areas using this method at custom_components/auto_areas/binary_sensor.py, line 32: await hass.helpers.device_registry.async_get_registry()

Only turn on lights if illuminance is below a certain threshold

  • aggregate illuminance in additional sensor
  • make threshold configurable (brightness below n lux)
  • evaluate sensor before turning on light
  • during presence, if brightness goes below threshold, turn on light
  • only turn on lights once (not repeatedly with every illuminance change)
  • stop turning on lights after they have been manually controlled

Define how to handle:

  • it goes dark while there is presence but lights are not on. For example: sun is setting in a consistently occupied room or blinds are closed during the day. illuminance threshold is also evaluated during presence
  • outdated illuminance sensor values? Battery-based devices don't broadcast their state very often. Take time of last update into account? always the latest state of all entities is considered
  • if light is turned off during presence it should not be turned on automatically based on illuminance

Can not configure

System Health details

System Information

version core-2023.5.3
installation_type Home Assistant OS
dev false
hassio true
docker true
user root
virtualenv false
python_version 3.10.11
os_name Linux
os_version 6.1.25
arch aarch64
timezone Europe/Amsterdam
config_dir /config
Home Assistant Community Store
GitHub API ok
GitHub Content ok
GitHub Web ok
GitHub API Calls Remaining 5000
Installed Version 1.32.1
Stage running
Available Repositories 1294
Downloaded Repositories 57
HACS Data ok
AccuWeather
can_reach_server ok
remaining_requests 26
Home Assistant Cloud
logged_in true
subscription_expiration August 1, 2023 at 2:00 AM
relayer_connected true
relayer_region eu-central-1
remote_enabled true
remote_connected true
alexa_enabled false
google_enabled true
remote_server eu-central-1-10.ui.nabu.casa
certificate_status ready
can_reach_cert_server ok
can_reach_cloud_auth ok
can_reach_cloud ok
Home Assistant Supervisor
host_os Home Assistant OS 10.1
update_channel stable
supervisor_version supervisor-2023.04.1
agent_version 1.5.1
docker_version 23.0.3
disk_total 117.3 GB
disk_used 38.0 GB
healthy true
supported true
board odroid-n2
supervisor_api ok
version_api ok
installed_addons Home Assistant Google Drive Backup (0.107.2), AppDaemon (0.13.0), File editor (5.6.0), Glances (0.19.2), Mosquitto broker (6.2.1), Samba share (10.0.1), Terminal & SSH (9.7.0), Log Viewer (0.15.1), ESPHome (2023.5.3), Studio Code Server (5.6.0), Rhasspy Assistant (2.5.11), Dutch TTS voice (rdh) (1.0.3), FTP (4.7.0), InfluxDB (4.7.0), Grafana (8.3.0), Music Assistant BETA (2.0.0b30), Node-RED (14.2.0)
Dashboards
dashboards 1
resources 30
views 16
mode yaml
Recorder
oldest_recorder_run May 13, 2023 at 2:22 PM
current_recorder_run May 23, 2023 at 3:58 PM
estimated_db_size 1624.13 MiB
database_engine sqlite
database_version 3.40.1
Sonoff
version 3.5.1 (122751c)
cloud_online 1 / 2
local_online 1 / 1
[home-assistant_2023-05-23T14-05-41.282Z.log](https://github.com/c-st/auto_areas/files/11544962/home-assistant_2023-05-23T14-05-41.282Z.log)
Xiaomi MIoT
logged_in true
can_reach_micloud_server ok
accounts_count 1
account_devices_count 4
added_devices 1

Checklist

  • I have enabled debug logging for my installation.
  • I have filled out the issue template to the best of my ability.
  • This issue only contains 1 issue (if you have multiple issues, open one issue for each issue).
  • This issue is not a duplicate issue of currently previous issues..

Describe the issue

When I try to configure an area I get the following error:
Config flow could not be loaded: 500 Internal Server Error Server got itself in trouble

Reproduction steps

  1. try to configure an area

...

Debug logs

see attachment

Diagnostics dump

NA

Have the option to use switches for lights.

Checklist

  • I have filled out the template to the best of my ability.
  • This only contains 1 feature request (if you have multiple feature requests, open one feature request for each feature request).
  • This issue is not a duplicate feature request of previous feature requests.

Is your feature request related to a problem? Please describe.

I would like to include switches as well as lights, as we have zonoff mini switches in our bathrooms that control fans and lights and so I can't control just the light without the switch also being on.

Describe the solution you'd like

For an Area to have the option to include switches as well that are triggered along with the lights.

Describe alternatives you've considered

Automations, but this would just make life easier as they can be a pain.

Additional context

None

Utilize scene.turn_on instead of turning on ALL lights when presence detected

Currently auto_areas assumes that ALL lights assigned to a room should be turned on (full) upon entry to the room.

Ideally, a scene could be assigned for room entry which allows setting which lights to turn on, at what dimmable level, as well as other devices in a room that might be turned on (e.g. a fan, or climate setting). For leaving a room, a second scene would be needed to set the "away" settings for a room.

Aggregate sensor values

Measurement values for

  • temperature (avg)
  • humidity (max)
  • illuminance (min)

from multiple devices are aggregated per area and exposed as additional sensors (for example sensor.area_temperature_bedroom).

more device_classes

Aggregate sensor values

Measurement values for

  • temperature
  • humidity
  • illuminance
  • pressure

from multiple devices are aggregated per area (median) and exposed as additional sensors (for example sensor.area_temperature_bedroom).

Also the presence of all areas could be aggregated in a single binary_sensor.any_area_occupied that determines if ANY of the areas occupancy switches are on (device_class: presence) (cc @rsnodgrass)

more device_classes

Cover control

A new cover entity for all covers in an area is created. This can be used to quickly

  • close
  • open
  • set to a given position

all shades in an area at the same time.

Considerations:

  • happy path: all covers have the same position and are always controlled at the same time. This way a position for the entity can be determined.
  • think about: how to handle different position among all covers in an area (don't publish a position?)

Automatic lighting only at night?

Is your feature request related to a problem? Please describe.
I do not need automatic lighting in all areas.
"Downstairs", "Garage" & "Bathroom" would be the only areas needing 24x7 artificial lighting.

Describe the solution you'd like
Additional entitiies utilized to control automatic lighting.
Eg.

  1. binary_sensor, device class light.
  2. sensor, device class illuminance. This entity would require a threshold though to be specified which could get tricky so, a user created binary_sensor template with device_class light would be the easiest and the integration need only check if that sensor is off.

Describe alternatives you've considered
Create automations to control the area_presence_lock entity, which is kludgy!

Additional context
None.

Join forces with magic_areas?

Checklist

  • I have filled out the template to the best of my ability.
  • This only contains 1 feature request (if you have multiple feature requests, open one feature request for each feature request).
  • This issue is not a duplicate feature request of previous feature requests.

Is your feature request related to a problem? Please describe.

Hey, this looks great but also closely resembles magic_areas integration. Maybe you can combine forces?

https://github.com/jseidl/hass-magic_areas

Describe the solution you'd like

Have 1 integration that is better than choosing between 2

Describe alternatives you've considered

See above

Additional context

None needed

Lock or Sleep Mode Switch do not stay on

System Health details

System Information

version | core-2023.6.3
installation_type | Home Assistant OS
dev | false
hassio | true
docker | true
user | root
virtualenv | false
python_version | 3.11.4
os_name | Linux
os_version | 6.1.21-v8
arch | aarch64

Home Assistant Supervisor

host_os | Home Assistant OS 10.3
update_channel | stable
supervisor_version | supervisor-2023.06.2
agent_version | 1.5.1
docker_version | 23.0.6

Checklist

  • I have enabled debug logging for my installation.
  • I have filled out the issue template to the best of my ability.
  • This issue only contains 1 issue (if you have multiple issues, open one issue for each issue).
  • This issue is not a duplicate issue of currently previous issues..

Describe the issue

The app itself works well, but there are problems with the switches.
Sometimes I have the problem that, for example, the sleep mode can be activated initially. Later (sporadically) it jumps back to disabled and can no longer be switched on.

I just noticed it when I deleted another integration.
When I restart Homeassistant, this error is briefly resolved.

The whole thing also affects every created room and not just individual ones.

Reproduction steps

  1. Configure Room and take the switch on
  2. Delete some integration or change config

Debug logs

2023-06-26 15:01:46.498 WARNING (MainThread) [homeassistant.helpers.service] Unable to find referenced entities light.kuche or it is/they are currently not available
2023-06-26 15:01:46.501 WARNING (MainThread) [homeassistant.helpers.service] Unable to find referenced entities light.kuche or it is/they are currently not available
2023-06-26 15:01:46.505 WARNING (MainThread) [homeassistant.helpers.service] Unable to find referenced entities light.kuche or it is/they are currently not available
2023-06-26 15:01:46.507 WARNING (MainThread) [homeassistant.helpers.service] Unable to find referenced entities light.kuche or it is/they are currently not available
2023-06-26 15:01:46.510 WARNING (MainThread) [homeassistant.helpers.service] Unable to find referenced entities light.kuche or it is/they are currently not available
2023-06-26 15:01:46.512 WARNING (MainThread) [homeassistant.helpers.service] Unable to find referenced entities light.kuche or it is/they are currently not available
2023-06-26 15:01:46.514 WARNING (MainThread) [homeassistant.helpers.service] Unable to find referenced entities light.kuche or it is/they are currently not available
2023-06-26 15:01:46.517 WARNING (MainThread) [homeassistant.helpers.service] Unable to find referenced entities light.kuche or it is/they are currently not available
2023-06-26 15:01:46.521 WARNING (MainThread) [homeassistant.helpers.service] Unable to find referenced entities light.kuche or it is/they are currently not available
2023-06-26 15:01:46.525 WARNING (MainThread) [homeassistant.helpers.service] Unable to find referenced entities light.kuche or it is/they are currently not available
2023-06-26 15:01:46.528 WARNING (MainThread) [homeassistant.helpers.service] Unable to find referenced entities light.kuche or it is/they are currently not available
2023-06-26 15:01:46.530 WARNING (MainThread) [homeassistant.helpers.service] Unable to find referenced entities light.kuche or it is/they are currently not available
2023-06-26 15:01:46.533 WARNING (MainThread) [homeassistant.helpers.service] Unable to find referenced entities light.kuche or it is/they are currently not available
2023-06-26 15:01:46.535 WARNING (MainThread) [homeassistant.helpers.service] Unable to find referenced entities light.kuche or it is/they are currently not available

Diagnostics dump

No response

Scenes auto discovery (naming convention)

If scenes are found which are named according to a given pattern, they will automatically be used - no configuration necessary.

Suggestion by @rsnodgrass

        # Auto discovery of scenes ... decided EXPLICIT scene setting is better for V1
        #        self.presence_scene_entity_id = f"scene.{self.area_name}_presence"
        #        self.goodbye_scene_entity_id = f"scene.{self.area_name}_goodbye"
        #        for entity in all_entities:
        #            if not entity.domain in SCENE_DOMAIN:
        #                continue
        #            if 'Presence' in entity.name:
        #                self.presence_scene_entity_id = ''

Reset presence lock automatically

The motivation behind presence lock is to keep the light from going out if there is not much movement in an area. However, if forgotten It will keep the lights on indefinitely.

Discover how it could be reset automatically:

  • based on time (after x minutes/hours)
  • x hours after last presence was detected
  • on the next day (sunrise)

Additionally it should be disabled if:

  • sleep mode is turned on
  • lights are turned off manually (?)

Add switch for presence lock to each area

Sometimes an area is occupied but the motion sensors are not receiving enough movement. For example this could be happening if someone is reading. In order to avoid clearing presence an additional switch could be added.
If enabled, this switch locks presence and avoids that the lights turn off.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.