All Projects → Mohlsson → Replaylightshistory

Mohlsson / Replaylightshistory

Licence: apache-2.0
AppDaemon App for Home Assistant to replay light switch history when no one is home.

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Replaylightshistory

entur-card
Home Assistant Lovelace card card for the Entur public transport component.
Stars: ✭ 38 (+123.53%)
Mutual labels:  home-assistant, homeassistant
addon-mopidy
Mopidy - Home Assistant Community Add-ons
Stars: ✭ 42 (+147.06%)
Mutual labels:  home-assistant, homeassistant
addon-airsonos
AirSonos - Home Assistant Community Add-ons
Stars: ✭ 50 (+194.12%)
Mutual labels:  home-assistant, homeassistant
esphome-weather-station
ESPHome version of Elektor weather station v2
Stars: ✭ 140 (+723.53%)
Mutual labels:  home-assistant, homeassistant
Vacuum Card
Vacuum cleaner card for Home Assistant Lovelace UI
Stars: ✭ 295 (+1635.29%)
Mutual labels:  home-assistant, homeassistant
hass-actron
Actron Air Conditioner Add-On for Home Assistant
Stars: ✭ 14 (-17.65%)
Mutual labels:  home-assistant, homeassistant
ha-zoom-automation
Custom Home Assistant component for Zoom. Tracks when you are connected to a Zoom call by default but may allow you to track more.
Stars: ✭ 47 (+176.47%)
Mutual labels:  home-assistant, homeassistant
wyzesense2mqtt
Configurable WyzeSense to MQTT Gateway intended for use with Home Assistant or other platforms that use MQTT discovery mechanisms.
Stars: ✭ 55 (+223.53%)
Mutual labels:  home-assistant, homeassistant
Unifiprotect
Control and monitor your Unifi Protect Cameras from Home Assistant
Stars: ✭ 279 (+1541.18%)
Mutual labels:  home-assistant, homeassistant
Awesome Home Assistant
A curated list of amazingly awesome Home Assistant resources.
Stars: ✭ 3,487 (+20411.76%)
Mutual labels:  home-assistant, homeassistant
home-assistant-frigidaire
Custom component for the Frigidaire integration
Stars: ✭ 11 (-35.29%)
Mutual labels:  home-assistant, homeassistant
Homeassistant
Home Assistant Configuration Files and Documentation
Stars: ✭ 395 (+2223.53%)
Mutual labels:  home-assistant, homeassistant
HomeAssistant
My Home Assistant Configuration
Stars: ✭ 71 (+317.65%)
Mutual labels:  home-assistant, homeassistant
Ble monitor
Xiaomi Mijia BLE MiBeacon monitor
Stars: ✭ 611 (+3494.12%)
Mutual labels:  home-assistant, homeassistant
home
Monorepo for all home automation related development, including integrated firmware, PCBs, configuration, and bridges
Stars: ✭ 104 (+511.76%)
Mutual labels:  home-assistant, homeassistant
addon-appdaemon
AppDaemon4 - Home Assistant Community Add-ons
Stars: ✭ 66 (+288.24%)
Mutual labels:  home-assistant, homeassistant
addon-example
Example - Home Assistant Community Add-ons
Stars: ✭ 73 (+329.41%)
Mutual labels:  home-assistant, homeassistant
Tuya-v2-Supported-Devices
A collection of all of the known working Tuya v2 Devices
Stars: ✭ 30 (+76.47%)
Mutual labels:  home-assistant, homeassistant
Home assistant
My personal Home Assistant setup - Running on a HassOS VM.
Stars: ✭ 270 (+1488.24%)
Mutual labels:  home-assistant, homeassistant
Home Assistantconfig
🏠 Home Assistant configuration & Documentation for my Smart House. Write-ups, videos, part lists, and links throughout. Be sure to ⭐ it. Updated FREQUENTLY!
Stars: ✭ 3,687 (+21588.24%)
Mutual labels:  home-assistant, homeassistant

ReplayLightsHistory hacs_badge

This is an AppDaemon App for Home Assistant that is designed to replays your lights behavior when no one is home. There are multiple other approaches out there that try to simulate behavior, which is hard. This approach simply uses your smart devices previous behavior to control their pending behavior. As the code exist today it has been tested with lights and smart switches. The smart switches include TP Link smart switches and plugs, as they are both labeled switch entities in Home Assistant. It has also been used with shelly 2 switches. It currently can only be configured to control one category of entities, which is specified in the configuration information.

Manually installing this AppDaemon App is relatively simply. The replay_lights.py file needs to be placed in the appdaemon/apps/ directory on your Home assistant install. Then you need to added lines to the appdaemon/apps/apps.yaml file to enable this application. At a minimum you would add these lines to the file apps/yaml file:

replay_lights: module: replay_lights class: ReplayLights

A maximum configuration can include the following lines, modified for your install:

replay_lights:
  hassDir: '/home/jondoe/.homeassistant'
  databaseType: sqlite3
  databaseHost: "localhost"
  databaseUser: "homeassistant"
  databasePassword: "PASSWORD"
  databaseSchema: "homeassistant"
  module: replay_lights
  class: ReplayLights
  numberOfDaysBack: 7
  deviceType: "light"
  enableTag: "alarm_control.home_alarm"
  enableVal: "armed_away"
  smartControlledByDumb: "switch.master_bed,switch.living_room_lamp"
  excludeList: "switch.garage,switch.garagecam"

example_apps.yaml in the repo includes similar records

All of the parameters are optional. Their use follows:

  • hassDir - Home Assistant config directory (assumed to have home-assistant_v2.db in there). Defaults /config.

  • databaseType - Defines database type either sqlite3 which is default or MariaDB

  • databaseHost - Hostname or IP address of host where MariaDB is installed (optional, default localhost)

  • databaseUser - User for MariaDB defaults to homeassistant

  • databasePassword - Password for MariaDB

  • databaseSchema - Name of DB schema akka database name. This is normally same as user name. (optional, default homeassistant)

  • numberOfDaysBack – this value that indicates how many days back in time the application should look for behavior that is to be replayed. This value can also be provided as a Home Assistant input number entity named input_number.replay_days_back. The advantage of specifying the value as an input number is that you can then change the value via the Home Assistant Lovelace interface. From a precedent perspective the application first looks for the input number entity, it looks for numberOfDaysBack from the apps.yaml file and finally if neither of these value is defined it uses the default of 7 days back.

  • deviceType – this has been tested with “switch” and “light”. It’s possible that it could work with other entity types. If not specified in the configuration, the default is “switch”. You can determine this value by looking at the entities off the configuration panel in your Home Assistant user interface. All of the devices you want to control will start with this label.

  • enableTag – This value, along with enableVal, determine if automated control of the lights is enabled. This is the name of the Home Assistant entity that the app looks at to determine if it should actually turn something off or on. The example_groups.yaml file shows how you might set up a Home Assistant group of persons entities to control this app’s behavior. The value for this field would be set to “group.persons”. You could then set the enableVal to “away”, and if all persons in this group are away the app will control the devices. The default value is a Home Assistant input boolean, "input_boolean.light_replay_enabled", that you need to create in your Home Assistant configuration.yaml file if you aren’t using some other entity, like the group.persons entity mentioned above, or the alarm control panel entity shown in the example configuration file above.

  • enableVal – This is the “state” value the “enableTag” must have in order for the app to actually turn something on or off. For the default enableTag, "input_boolean.light_replay_enabled", a state value of “on” would indicate that the app should controls the smart devices. As mentioned above if you created a group of persons and you wanted control to happen when they were all away from home then this parameter would be set to “away”. The default for this field is “on”

  • smartControlledByDumb – If you have smart light bulbs or smart plugs there is a possibility that a dumb switch could be inline. If used the dumb switch would could remove power from the device. If someone turns the dumb switch off then the device will be assigned a status of “unavailable” in Home Assistant instead of off. This parameter tells the application which devices can be disabled by dumb switches. This is a comma separated list. In the example configuration above it shows two smart plugs that could also be powered off via a dumb switch. If you have no devices in this situation then this parameter isn’t required.

  • excludeList - This is a comma separated list of switches you don't want included in the replay action, such as a switch on your garage or maybe a basement light you don't want to have turned on while you're out.

NOTE: A recent update added the ability to use MariaDB as an alternative to sqlite3. This change requires the python package to be included in your appdaemon docker container. You include PyMySQL by adding it to the addons.json file found in the home assistant base directory. The easist way to make this modification is directly from the Home Assistant GUI. From Supervisor -> AppDaemon -> Configuration you can update the configuration to look like this:

system_packages: []
python_packages:
  - PyMySQL
init_commands: []

For the change to take effect you need to restart AppDaemon, which can be done from the AppDaemon Info tab.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].