From e433b557c86ad67e3de760a0024638aaf583cb03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anders=20Heib=C3=B8?= Date: Fri, 24 Nov 2023 21:50:50 +0100 Subject: [PATCH] Update documentation --- README.md | 62 +++-- apps/Lightwand/lightwand.py | 30 ++- apps/Lightwand/lightwand.yaml | 495 +++++++++++----------------------- 3 files changed, 222 insertions(+), 365 deletions(-) diff --git a/README.md b/README.md index 4e0e357..b11c28a 100644 --- a/README.md +++ b/README.md @@ -3,22 +3,24 @@ an Appdaemon app for complete control of your lights in every situation ## Updates coming Try to clean up configuration of the app to make it easier to get started. -Set brightness transition over time. -/+ 1 brightness pr x minutes. +Set brightness transition over time. -/+ 1 brightness pr x minutes. Will be defined with dimrate ## Installation -Download the `Lightwand` directory from inside the `apps` directory here to your `apps` directory, then add configuration to a yaml file to enable the `Lightwand` module. +Download the `Lightwand` directory from inside the `apps` directory here to your Appdaemon `apps` directory, then add configuration to a yaml file to enable the `Lightwand` module. See configuration below or my lightwand.yaml file for examples. ## App usage and tips to configure All sections and configurations are optional, so you use only what is applicable. -Each app contains one 'Room' with all of the sensors you want to use for that room and all the lights that are natural to control based on the given sensors. +Each app contains one 'Room' with all of the sensors you want to use for that room and define all the lights to automate the way you want. ### Mode change events This app listens to event "MODE_CHANGE" in Home Assistant to set different light modes with 'normal' mode as default setting. See my ModeManagement example code if you want to automate some default away/morning/night modes. Options is to call new mode from another app with: + self.fire_event("MODE_CHANGE", mode = 'your_mode_name') Or define scripts and activate in lovelace to trigger an event like this: + day: alias: "Day" sequence: @@ -27,7 +29,7 @@ Or define scripts and activate in lovelace to trigger an event like this: mode: 'normal' -I have chosen this approach because I also base some other automations on mode change. E.g. 'dinner' mode will also send a notification to childrens phones and tablets. +I have chosen this approach because I also base some other automations on mode change. E.g. calling 'dinner' mode from iPhone with ios_event will also send a notification to childrens phones and tablets. When a event with "MODE_CHANGE" is triggered, it will check thru all defined modes for all lights in the app/Room.
- If mode is defined in room and in light it will update light with attributes defined in mode @@ -50,24 +52,34 @@ Other modes with additional behaviour: morning, night* When custom mode is triggered it will disable all automation and keep light as is for all lights. Useful for special days you want to do something different with the lights. Be aware that it does not do any mediaplayer/motion or lux detection either.
- Use 'exclude_from_custom: True' in configuration to exclude the room from custom mode. Can be useful for rooms you forget to adjust light like outdoor lights and kid's bedroom. +

+You can define an Home Assistant input_text in one of the apps/rooms to display current LightMode in Lovelace. It will allways update with latest mode even if mode is not present in room ### Default light behaviour -is configured with automations for each set of light and is activated with mode normal. If you only want lux control on/off you do not need to set up any automations. Both Lux constraint and conditions need to be meet before lights turns on in normal mode. Automations is based on 'time' that can be both time with sunrise/sunset +- or fixed time. App deletes automations that are later than next in cases where both time with sunrise/sunset and fixed time is given. Yes I live quite far North so sunrise/sunset varies a lot. In addition to 'time' you can also specify 'orLater' to have more accurate control of when lights changes depending on season. E.g. +is configured with automations for each set of light and is activated with mode normal. If you only want lux control on/off you do not need to set up any automations. Both Lux constraint and conditions need to be meet before lights turns on in normal mode. + +Automations is based on 'time' that can be both time with sunrise/sunset +- or fixed time. App sorts thru and deletes automations that are earlier than previous time when both time with sunset and fixed time is given in automations in cases where both time with sunrise/sunset and fixed time is given. I live quite far North so sunrise/sunset varies a lot and might be a bigger problem here than other places. In addition to 'time' you can also specify 'orLater' to have more accurate control of when lights changes depending on season. E.g. + - time: '08:00:00' orLater: 'sunrise + 00:15:00' + If 'orLater' is later than 'time' it will shift all times following the same timedelta as here until a new 'orLater' is defined. +You can in prevent shifts and deletions with a 'fixed: True' under time that locks time from beeing moved of deleted. I only use this to make sure the lights for the children turns off at bedtime even when sun sets after. + ### Motion behaviour Configure motionlights to change light based on motion sensors in room. Easiest configuration is + motionlights: state: turn_on + to have the light turn on if lux constraints and conditions are met. If light is dimmable you can provide offset to 'state: turn_on' to increase or decrease brightness compared to 'light_data' in automation for normal light. You can also define light_data here or even a new set of automations with times same as automations for normal mode if you want different brightness etc during the day. -
- motionlights will not turn down brightness in case other modes sets brightness higher e.g. 'wash'. +
- motionlights will not turn down brightness in case other modes sets brightness higher e.g. wash.
- If media players is on or night* mode is active motion detection is deactivated. ### Lights -All lights for the room is configured under 'Lights' or 'ToggleLights if you have that. There you can configure multiple '-lights' that contains a list of the lights you want to configure with the same settings and automations, motionlights, light_modes, lux on/off/constraints and conditions +All lights for the room is configured under Lights or ToggleLights if you have that. There you can configure multiple -lights that contains a list of the lights you want to configure with the same settings and automations, motionlights, light_modes, lux on/off/constraints and conditions ### Configure automations and motionlights Each time can have a state and/or a light_data @@ -75,7 +87,7 @@ Each time can have a state and/or a light_data state defines behavior. No need to define state in time for the times you want light to turn on, or based on lux constraints and conditions if any restrictions is defined.
- turn_off: Turns off light at given time. Can also be defined in motionlights to turn off and keep light off after given time until next time. E.g. turn off at kid's bedroom at 21:00.
- adjust: Does not turn on or off light but adjusts light_data at given time. Turn on/off with other modes or manual switch. Not applicable for motion. - +

Some considerations when writing your automations:
If '00:00:00' is not defined a 'turn_off' state will be default at midnight if other times is configured in automations or motionlights in defined for lights. 'light_data' contains a set of attributes to be set to light: brightness, transition, color_temp, rgb_color, effect, etc. All attributes are optional. @@ -89,12 +101,19 @@ You can create as many modes in light_mode as you are able to have the ti
- 'lux_controlled' only turns/keeps light on if lux is below lux_constraint
- 'turn_off' Turns off light
- 'manual' Completly manual on/off/brightness etc. - +

'offset' can be provided to state 'lux_controlled' or 'turn_on' to increase or decrease brightness based on 'light_data' in normal automation ### Sensors -Zigbee and Zwave motion and lux sensors listens to MQTT events. Default namespace is mqtt -If you have not set up mqtt you can use HA sensors to listen for HA state change +
Zigbee and Zwave motion and lux sensors listens to MQTT events. Default namespace is mqtt +
If you have not set up mqtt you can use HA sensors to listen for HA state change. +
You can define time after sensor not longer detects motion before it turns light back with delay in seconds, and define constraints to each motion sensor as an if statement that must be true for motion to activate. Inherits Appdaemon API to self. Same applies to trackers and if presence mode is defined it will stay in that mode for seconds defined with delay. + +### Media players +Sorted by priority if more than one mediaplayer is defined in room. Can be any sensor or switch with on/off state. Define name of mode for each sensor and define light attributes in 'light_modes'. Media mode will set light and keep as media mode when motion is detected as well as morning, normal and night* modes are called. Calling any other modes will set light to the new mode. If any of the morning, normal or night* modes is called when media is on, media mode will be active again. + +### Conditions and constraints +You can use Lux sensors to control or constrain lights. Optionally you can provide if statement to be meet for light to turn on at normal/morning/motion mode or with automations defined. Inherits Appdaemon Api as ADapi. ### Get started Easisest to start off with is to copy this example. There is a lot of list/dictionaries that needs to be correctly indented. And remember: All sections and configurations are optional, so you use only what is applicable @@ -120,7 +139,7 @@ your_room_name: # HA sensor for detection of rain. If rain is detected, it will raise lux constraint by * 1.5 rain_sensor: sensor.netatmo_rain - # You can define an Home Assistant input_text in one of the apps/rooms to display current LightMode in Lovelace. It will allways update with latest mode even if mode is not present in room + # Home Assistant input_text to display current LightMode in Lovelace haLightModeText: input_text.lightmode # Exclude the room from custom mode @@ -201,28 +220,33 @@ your_room_name: light_data: brightness: 80 effect: fireplace + - time: '22:01:00' + dimrate: 2 # Will start to dim from previous brightness (80) - 1 per x minutes. In this case every 2 minutes. + light_data: + brightness: 10 + effect: fireplace - time: '23:00:00' state: turn_off # Configure motion lights same way as normal automations motionlights: - - time: '00:00:00' - light_data: - brightness: 90 - - time: sunrise - 00:30:00 + - time: '06:30:00' light_data: brightness: 160 - - time: sunrise + 00:30:00 + - time: '08:30:00' + orLater: 'sunrise + 00:30:00' light_data: brightness: 120 - - time: sunset - 00:30:00 + - time: 'sunset - 00:30:00' + orLater: '19:00:00' light_data: brightness: 140 - - time: sunset + 00:30:00 + - time: 'sunset + 00:30:00' light_data: brightness: 110 - time: '21:00:00' state: turn_off + fixed: True # Define light modes to change light accordingly. # Modes can be configured with automations, light_data or state: turn_on, lux_controlled or turn_off diff --git a/apps/Lightwand/lightwand.py b/apps/Lightwand/lightwand.py index 346dc93..4e3f9e4 100644 --- a/apps/Lightwand/lightwand.py +++ b/apps/Lightwand/lightwand.py @@ -503,17 +503,22 @@ def __init__(self, api, timeToAdd += datetime.timedelta(days = 1) automation['time'] = automation['orLater'] elif timeToAdd > datetime.timedelta(minutes = 0) : + if 'fixed' in automation : + continue newtime = self.ADapi.parse_datetime(automation['time']) + timeToAdd automation['time'] = str(newtime.time()) - # Deletes automations that are later than next. Useful when both time with sunset and fixed time is given in automations + # Deletes automations that are earlier than previous time. Useful when both time with sunset and fixed time is given in automations if test_time <= self.ADapi.parse_time(automation['time']) : test_time = self.ADapi.parse_time(automation['time']) elif test_time > self.ADapi.parse_time(automation['time']) : - #self.ADapi.log(f"Deletes automation: {self.automations[num]}") # For logging purposes to check if your times are as planned - automationsToDelete.append(num) + if not 'fixed' in automation : + #self.ADapi.log(f"Deletes automation: {self.automations[num]}") # For logging purposes to check if your times are as planned + automationsToDelete.append(num) + for num in reversed(automationsToDelete) : del self.automations[num] + self.ADapi.log(f"Automation: {self.automations}") for automation in self.automations : if not 'state' in automation : @@ -542,15 +547,18 @@ def __init__(self, api, timeToAdd += datetime.timedelta(days = 1) automation['time'] = automation['orLater'] elif timeToAdd > datetime.timedelta(minutes = 0) : + if 'fixed' in automation : + continue newtime = self.ADapi.parse_datetime(automation['time']) + timeToAdd automation['time'] = str(newtime.time()) - # Deletes automations that are later than next. Useful when both time with sunset and fixed time is given in automations + # Deletes automations that are earlier than previous time. Useful when both time with sunset and fixed time is given in automations if test_time <= self.ADapi.parse_time(automation['time']) : test_time = self.ADapi.parse_time(automation['time']) elif test_time > self.ADapi.parse_time(automation['time']) : - #self.ADapi.log(f"Deletes automation: {self.automations[num]}") # For logging purposes to check if your times are as planned - automationsToDelete.append(num) + if not 'fixed' in automation : + #self.ADapi.log(f"Deletes automation: {self.automations[num]}") # For logging purposes to check if your times are as planned + automationsToDelete.append(num) for num in reversed(automationsToDelete) : del self.motionlight[num] @@ -581,15 +589,18 @@ def __init__(self, api, timeToAdd += datetime.timedelta(days = 1) automation['time'] = automation['orLater'] elif timeToAdd > datetime.timedelta(minutes = 0) : + if 'fixed' in automation : + continue newtime = self.ADapi.parse_datetime(automation['time']) + timeToAdd automation['time'] = str(newtime.time()) - # Deletes automations that are later than next. Useful when both time with sunset and fixed time is given in automations + # Deletes automations that are earlier than previous time. Useful when both time with sunset and fixed time is given in automations if test_time <= self.ADapi.parse_time(automation['time']) : test_time = self.ADapi.parse_time(automation['time']) elif test_time > self.ADapi.parse_time(automation['time']) : - #self.ADapi.log(f"Deletes mode automation: {self.automations[num]}") # For logging purposes to check if your times are as planned - automationsToDelete.append(num) + if not 'fixed' in automation : + #self.ADapi.log(f"Deletes mode automation: {self.automations[num]}") # For logging purposes to check if your times are as planned + automationsToDelete.append(num) for num in reversed(automationsToDelete) : del mode['automations'][num] @@ -1216,3 +1227,4 @@ def setMotion(self): lightwand_data.update({ light : {"toggle" : self.current_toggle }}) with open(self.JSON_PATH, 'w') as json_write : json.dump(lightwand_data, json_write, indent = 4) + diff --git a/apps/Lightwand/lightwand.yaml b/apps/Lightwand/lightwand.yaml index f132d71..d1df071 100644 --- a/apps/Lightwand/lightwand.yaml +++ b/apps/Lightwand/lightwand.yaml @@ -1,14 +1,14 @@ -############################## LYS KJØKKEN ############################## +############################## Lights Kitchen ############################## kjokkenlys: module: lightwand class: Room log: lights_log - json_path: /homeassistant/appdaemon/apps/Lightwand/wand_ + #json_path: /homeassistant/db/Lightwand/ OutLuxZigbee: OutdoorHueLux RoomLuxZwave: KITCH_FibaroSensor - rain_sensor: sensor.netatmo_kvernabekkvegen_59_stue_regnsensor_rain # Regnsensor - HALightModeText: input_text.lightmode #Home Assistant input_text. to display current LightMode in Lovelace + rain_sensor: sensor.netatmo_kvernabekkvegen_59_stue_regnsensor_rain + HALightModeText: input_text.lightmode #To display current LightMode in Lovelace zigbee_motion_sensors: - motion_sensor: KITCH_motion_Aqara delay: 300 @@ -21,129 +21,79 @@ kjokkenlys: - lights: - light.kjokkenlys - automations: + automations: # Define some light for normal automation when motion is not detected/constrained. - time: '00:00:00' light_data: brightness: 3 - - time: '04:00:00' + - time: '06:00:00' light_data: brightness: 50 - time: 'sunrise - 00:15:00' - light_data: - brightness: 60 - - time: 'sunrise + 00:20:00' light_data: brightness: 80 + - time: '08:30:00' + orLater: 'sunrise + 00:15:00' # Want to keep brightness at 80 until 08:30 or if sun rises later it will keep 80 until 15 minutes past sunrise. + light_data: + brightness: 60 - time: 'sunrise + 01:30:00' state: turn_off - light_data: - brightness: 80 + light_data: # Input light_data even if state is turn_off if you have modes with offset +- + brightness: 60 - time: 'sunset - 01:30:00' + orLater: '21:00:00' light_data: brightness: 50 - - time: '21:00:00' - light_data: - brightness: 30 - time: 'sunset + 00:30:00' + dimrate: 2 # Will start to dim from previous brightness (50) - 1 per x minutes. In this case every 2 minutes. light_data: - brightness: 30 - - time: 'sunset + 01:00:00' - light_data: - brightness: 12 - - time: 'sunset + 01:20:00' - light_data: - brightness: 8 - - time: '23:00:00' - light_data: - brightness: 8 + brightness: 3 - motionlights: + motionlights: # Brightness for light when motion is detected. As long as motion is detected brightness will not be turned down. New brightness will be set when motion is redetected. - time: '00:00:00' light_data: brightness: 3 - - time: '04:00:00' - light_data: - brightness: 140 - - time: 'sunrise - 00:15:00' - light_data: - brightness: 180 - - time: 'sunrise + 00:20:00' - light_data: - brightness: 200 - - time: 'sunrise + 00:40:00' + - time: '06:00:00' light_data: - brightness: 180 - - time: 'sunrise + 01:00:00' + brightness: 80 + - time: '06:50:00' light_data: brightness: 160 - - time: 'sunrise + 01:20:00' + - time: '08:30:00' + orLater: 'sunrise + 00:15:00' light_data: - brightness: 140 + brightness: 180 - time: 'sunrise + 01:30:00' light_data: brightness: 120 - - time: 'sunset - 01:00:00' - light_data: - brightness: 100 - - time: 'sunset + 00:40:00' - light_data: - brightness: 80 - - time: '21:00:00' - light_data: - brightness: 60 - - time: 'sunset + 01:00:00' - light_data: - brightness: 60 - - time: 'sunset + 01:20:00' + - time: '20:00:00' + orLater: 'sunset + 00:30:00' + dimrate: 2 light_data: - brightness: 40 + brightness: 3 light_modes: - mode: lagmat - automations: - - time: '00:00:00' - light_data: - brightness: 60 - - time: '04:00:00' - light_data: - brightness: 180 - - time: 'sunrise - 00:15:00' - light_data: - brightness: 200 - - time: 'sunrise + 00:20:00' - light_data: - brightness: 220 - - time: 'sunrise + 00:40:00' - light_data: - brightness: 200 - - time: 'sunrise + 01:00:00' - light_data: - brightness: 180 - - time: 'sunset - 01:00:00' - light_data: - brightness: 180 - - time: 'sunset + 00:40:00' - light_data: - brightness: 160 - - time: 'sunset + 01:00:00' + light_data: + brightness: 220 - mode: morning light_data: - brightness: 230 - - mode: guest + brightness: 220 + - mode: decor state: turn_on offset: -20 - mode: movie state: turn_off - lights: - - switch.lys_kjokkenvindu # Kjøkkenvindu sør + - switch.lys_kjokkenvindu + # Decor light in window. No need to input automations or motion when lux controlled. light_modes: - mode: lagmat state: turn_on - mode: night - state: lux_controlled - - mode: guest + state: lux_controlled # Set to lux controlled during night in stead of default off for night. + - mode: decor state: turn_on - mode: morelight state: turn_on @@ -156,7 +106,8 @@ kjokkenlys: lux_turn_off: 1100 - lights: - - switch.kitch_plantelys # Aqara smartplug Kjøkkenvindu øst (Plantelys) + - switch.kitch_plantelys + # A light for the plants to help them in the winter darkness. It is lux constrained but I do not want it on before 02:00 and off at no later than 12:00. automations: - time: '02:00:00' @@ -164,9 +115,9 @@ kjokkenlys: state: turn_off light_modes: - - mode: movie + - mode: movie # The light is quite pink so I do not want it turning on if I watch a late movie. state: turn_off - - mode: away + - mode: away # Copy/paste same automation to away/night mode. Be aware of 4 more indents when configuring mode light when copying automations: - time: '02:00:00' - time: '12:00:00' @@ -179,19 +130,17 @@ kjokkenlys: lux_constraint: 300 lux_turn_on: 200 lux_turn_off: 300 - conditions: - - "self.ADapi.now_is_between('02:00:00', '12:00:00')" -############################## LYS STUE ############################## +############################## Lights Livingroom ############################## stuelys: module: lightwand class: Room log: lights_log - json_path: /homeassistant/appdaemon/logs/ + #json_path: /homeassistant/db/Lightwand/ OutLuxZigbee: OutdoorHueLux - rain_sensor: sensor.netatmo_kvernabekkvegen_59_stue_regnsensor_rain # Regnsensor + rain_sensor: sensor.netatmo_kvernabekkvegen_59_stue_regnsensor_rain # Media players for light presets mediaplayers: # Sorted by rooms and priority pr room - mediaplayer: switch.sony_vlp_hw65 @@ -216,7 +165,7 @@ stuelys: - 255 - 160 - 60 - - time: '04:00:00' + - time: '06:30:00' light_data: brightness: 70 transition: 3 @@ -232,18 +181,12 @@ stuelys: - 255 - 184 - 84 - - time: 'sunrise + 00:30:00' - light_data: - brightness: 70 - transition: 3 - rgb_color: - - 255 - - 184 - - 84 - - time: 'sunrise + 01:00:00' + - time: '08:30:00' + orLater: 'sunrise + 00:15:00' + dimrate: 2 light_data: brightness: 50 - transition: 5 + transition: 3 rgb_color: - 255 - 184 @@ -258,22 +201,7 @@ stuelys: - 86 - time: 'sunset + 00:30:00' orLater: '21:00:00' - light_data: - brightness: 30 - transition: 3 - rgb_color: - - 255 - - 160 - - 60 - - time: 'sunset + 01:00:00' - light_data: - brightness: 20 - transition: 3 - rgb_color: - - 255 - - 160 - - 60 - - time: 'sunset + 01:30:00' + dimrate: 2 light_data: brightness: 10 transition: 3 @@ -294,7 +222,7 @@ stuelys: - mode: mat state: turn_on offset: 30 - - mode: guest + - mode: decor state: turn_on offset: 20 - mode: morelight @@ -340,7 +268,7 @@ stuelys: - 255 - 160 - 60 - - time: '04:00:00' + - time: '06:30:00' light_data: brightness: 70 transition: 3 @@ -356,18 +284,12 @@ stuelys: - 255 - 184 - 84 - - time: 'sunrise + 00:30:00' - light_data: - brightness: 70 - transition: 3 - rgb_color: - - 255 - - 184 - - 84 - - time: 'sunrise + 01:00:00' + - time: '08:30:00' + orLater: 'sunrise + 00:15:00' + dimrate: 2 light_data: brightness: 50 - transition: 5 + transition: 3 rgb_color: - 255 - 184 @@ -382,22 +304,7 @@ stuelys: - 86 - time: 'sunset + 00:30:00' orLater: '21:00:00' - light_data: - brightness: 30 - transition: 3 - rgb_color: - - 255 - - 160 - - 60 - - time: 'sunset + 01:00:00' - light_data: - brightness: 20 - transition: 3 - rgb_color: - - 255 - - 160 - - 60 - - time: 'sunset + 01:30:00' + dimrate: 2 light_data: brightness: 10 transition: 3 @@ -418,7 +325,7 @@ stuelys: - mode: mat state: turn_on offset: 30 - - mode: guest + - mode: decor state: turn_on offset: 20 - mode: morelight @@ -457,7 +364,6 @@ stuelys: lux_turn_on: 4500 lux_turn_off: 5000 - - lights: - light.ledstrip_vegg @@ -470,7 +376,7 @@ stuelys: - 13 - 124 - 255 - - time: '04:00:00' + - time: '06:30:00' light_data: brightness: 100 transition: 3 @@ -486,26 +392,12 @@ stuelys: - 255 - 0 - 255 - - time: 'sunrise + 00:30:00' - light_data: - brightness: 90 - transition: 3 - rgb_color: - - 255 - - 0 - - 255 - - time: 'sunrise + 01:00:00' + - time: '08:30:00' + orLater: 'sunrise + 00:30:00' + dimrate: 2 light_data: brightness: 50 transition: 3 - rgb_color: - - 255 - - 0 - - 255 - - time: 'sunrise + 01:30:00' - light_data: - brightness: 30 - transition: 3 rgb_color: - 0 - 255 @@ -518,23 +410,9 @@ stuelys: - 13 - 124 - 255 - - time: 'sunset - 00:30:00' - light_data: - brightness: 100 - transition: 3 - rgb_color: - - 13 - - 124 - - 255 - time: 'sunset + 00:30:00' - light_data: - brightness: 50 - transition: 3 - rgb_color: - - 13 - - 124 - - 255 - - time: 'sunset + 01:00:00' + orLater: '21:00:00' + dimrate: 2 light_data: brightness: 30 transition: 3 @@ -555,7 +433,7 @@ stuelys: - mode: mat state: turn_on offset: 30 - - mode: guest + - mode: decor state: turn_on offset: 20 - mode: morelight @@ -614,7 +492,7 @@ stuelys: - 13 - 124 - 255 - - time: '04:00:00' + - time: '06:30:00' light_data: brightness: 100 transition: 3 @@ -630,26 +508,12 @@ stuelys: - 255 - 0 - 255 - - time: 'sunrise + 00:30:00' - light_data: - brightness: 90 - transition: 3 - rgb_color: - - 255 - - 0 - - 255 - - time: 'sunrise + 01:00:00' + - time: '08:30:00' + orLater: 'sunrise + 00:30:00' + dimrate: 2 light_data: brightness: 50 transition: 3 - rgb_color: - - 255 - - 0 - - 255 - - time: 'sunrise + 01:30:00' - light_data: - brightness: 30 - transition: 3 rgb_color: - 0 - 180 @@ -662,26 +526,11 @@ stuelys: - 13 - 124 - 255 - - time: 'sunset - 00:30:00' - light_data: - brightness: 100 - transition: 3 - rgb_color: - - 13 - - 124 - - 255 - time: 'sunset + 00:30:00' - light_data: - brightness: 50 - transition: 3 - rgb_color: - - 13 - - 124 - - 255 - - time: 'sunset + 01:00:00' + orLater: '21:00:00' + dimrate: 2 light_data: brightness: 30 - transition: 3 rgb_color: - 13 - 124 @@ -699,7 +548,7 @@ stuelys: - mode: mat state: turn_on offset: 30 - - mode: guest + - mode: decor state: turn_on offset: 20 - mode: morelight @@ -779,19 +628,19 @@ stuelys: light_data: brightness: 5 transition: 3 - - time: 'sunrise + 00:30:00' + - time: '06:30:00' light_data: brightness: 40 transition: 3 - - time: 'sunrise + 00:45:00' + - time: '08:30:00' + orLater: 'sunrise + 00:30:00' + dimrate: 1 light_data: brightness: 30 transition: 3 - - time: 'sunset - 01:00:00' - light_data: - brightness: 20 - transition: 3 - time: 'sunset + 00:30:00' + orLater: '21:00:00' + dimrate: 1 light_data: brightness: 15 transition: 3 @@ -799,7 +648,7 @@ stuelys: light_modes: - mode: mat state: turn_on - - mode: guest + - mode: decor state: turn_on offset: 20 - mode: morelight @@ -831,7 +680,7 @@ stuelys: light_data: brightness: 5 transition: 3 - - time: '05:30:00' + - time: '06:30:00' light_data: brightness: 55 transition: 3 @@ -850,7 +699,7 @@ stuelys: - mode: mat state: turn_on offset: 30 - - mode: guest + - mode: decor state: turn_on offset: 35 - mode: morelight @@ -882,23 +731,17 @@ stuelys: light_data: brightness: 25 transition: 3 - - time: '04:00:00' + - time: '06:30:00' light_data: brightness: 70 transition: 3 - - time: 'sunrise + 00:30:00' - light_data: - brightness: 50 - transition: 3 - - time: 'sunrise + 01:30:00' - light_data: - brightness: 80 - transition: 3 - time: 'sunset - 00:30:00' light_data: - brightness: 50 + brightness: 60 transition: 3 - - time: 'sunset + 01:30:00' + - time: 'sunset + 00:30:00' + orLater: '21:00:00' + dimrate: 2 light_data: brightness: 30 transition: 3 @@ -911,7 +754,7 @@ stuelys: - mode: mat state: turn_on offset: 40 - - mode: guest + - mode: decor state: turn_on offset: 30 - mode: morelight @@ -945,23 +788,17 @@ stuelys: light_data: brightness: 25 transition: 3 - - time: '04:00:00' + - time: '06:30:00' light_data: brightness: 70 transition: 3 - - time: 'sunrise + 00:30:00' - light_data: - brightness: 50 - transition: 3 - - time: 'sunrise + 01:30:00' - light_data: - brightness: 80 - transition: 3 - time: 'sunset - 00:30:00' light_data: - brightness: 50 + brightness: 60 transition: 3 - - time: 'sunset + 01:30:00' + - time: 'sunset + 00:30:00' + orLater: '21:00:00' + dimrate: 2 light_data: brightness: 30 transition: 3 @@ -974,7 +811,7 @@ stuelys: - mode: mat state: turn_on offset: 30 - - mode: guest + - mode: decor state: turn_on offset: 20 - mode: morelight @@ -987,8 +824,6 @@ stuelys: light_data: brightness: 10 transition: 3 - - mode: projector - state: turn_off - mode: movie state: turn_off @@ -1000,7 +835,6 @@ stuelys: - lights: - switch.stue_stikk_1_south - #- switch.stue_stikk_5_west automations: - time: '06:50:00' # No need to specify other than time to get lux control @@ -1008,7 +842,7 @@ stuelys: state: turn_off light_modes: - - mode: guest + - mode: decor state: turn_on - mode: morelight state: turn_on @@ -1024,7 +858,6 @@ stuelys: lux_turn_on: 400 lux_turn_off: 600 conditions: - - "self.ADapi.now_is_between('06:50:00', '22:00:00')" - "self.ADapi.get_tracker_state('person.camilla_nordvik_2') == 'home'" - lights: @@ -1035,12 +868,11 @@ stuelys: state: adjust light_data: brightness: 1 - - time: '05:30:00' + - time: '06:30:00' state: adjust light_data: - brightness: 100 + brightness: 80 transition: 3 - - time: 'sunset - 01:00:00' state: adjust dimrate: 3 @@ -1079,15 +911,15 @@ stuelys: lux_constraint: 35000 -############################## LYS Gang ############################## +############################## Lights hallway ############################## ganglys: module: lightwand class: Room log: lights_log - json_path: /homeassistant/appdaemon/apps/Lightwand/wand_ + #json_path: /homeassistant/db/Lightwand/ OutLuxZigbee: OutdoorHueLux - rain_sensor: sensor.netatmo_kvernabekkvegen_59_stue_regnsensor_rain # Regnsensor + rain_sensor: sensor.netatmo_kvernabekkvegen_59_stue_regnsensor_rain presence: - tracker: person.camilla_nordvik_2 Lights: @@ -1099,11 +931,12 @@ ganglys: light_data: brightness: 10 transition: 3 - - time: '04:00:00' + - time: '06:30:00' light_data: brightness: 90 transition: 3 - - time: 'sunrise + 00:30:00' + - time: '09:30:00' + orLater: 'sunrise + 00:30:00' light_data: brightness: 60 transition: 3 @@ -1116,12 +949,13 @@ ganglys: brightness: 50 transition: 3 - time: 'sunset + 00:30:00' + orLater: '21:00:00' light_data: brightness: 30 transition: 3 light_modes: - - mode: guest + - mode: decor state: turn_on offset: 20 - mode: morelight @@ -1146,12 +980,13 @@ ganglys: automations: - time: '06:50:00' - state: turn_on - time: '22:00:00' state: turn_off light_modes: - - mode: guest + - mode: morning + state: turn_on + - mode: decor state: turn_on - mode: morelight state: turn_on @@ -1163,23 +998,21 @@ ganglys: lux_turn_on: 600 lux_turn_off: 900 conditions: - - "self.ADapi.now_is_between('06:50:00', '22:00:00')" - "self.ADapi.get_tracker_state('person.camilla_nordvik_2') == 'home'" - -############################## LYS Entre ############################## +############################## Lights Outer Hallway ############################## entrelys: module: lightwand class: Room log: lights_log - json_path: /homeassistant/appdaemon/apps/Lightwand/wand_ + #json_path: /homeassistant/db/Lightwand/ OutLuxZigbee: OutdoorHueLux - rain_sensor: sensor.netatmo_kvernabekkvegen_59_stue_regnsensor_rain # Regnsensor + rain_sensor: sensor.netatmo_kvernabekkvegen_59_stue_regnsensor_rain zwave_motion_sensors: - motion_sensor: ENTRE_Multisensor delay: 120 - motion_constraints: "self.now_is_between('08:00:00', '22:00:00')" + motion_constraints: "self.now_is_between('06:30:00', '22:00:00')" Lights: - lights: - light.entre_spot @@ -1189,11 +1022,12 @@ entrelys: light_data: brightness: 5 transition: 3 - - time: '04:00:00' + - time: '06:30:00' light_data: brightness: 40 transition: 3 - - time: 'sunrise + 00:30:00' + - time: '08:30:00' + orLater: 'sunrise + 00:30:00' light_data: brightness: 30 transition: 3 @@ -1202,10 +1036,6 @@ entrelys: brightness: 20 transition: 3 - time: 'sunset - 00:30:00' - light_data: - brightness: 25 - transition: 3 - - time: 'sunset + 00:30:00' light_data: brightness: 30 transition: 3 @@ -1215,7 +1045,7 @@ entrelys: offset: 30 light_modes: - - mode: guest + - mode: decor state: turn_on offset: 20 - mode: morelight @@ -1236,17 +1066,17 @@ entrelys: lux_turn_off: 13000 -############################## LYS NATHANIELS ROM ############################## +############################## Lights Nathaniels room ############################## lys_nathaniel: module: lightwand class: Room log: lights_log - json_path: /homeassistant/appdaemon/apps/Lightwand/wand_ + #json_path: /homeassistant/db/Lightwand/ OutLuxZigbee: OutdoorHueLux RoomLuxZwave: NATH_Multisensor_Seng #RoomLuxZigbee: NATH_motion_door - rain_sensor: sensor.netatmo_kvernabekkvegen_59_stue_regnsensor_rain # Regnsensor + rain_sensor: sensor.netatmo_kvernabekkvegen_59_stue_regnsensor_rain exclude_from_custom: True zigbee_motion_sensors: - motion_sensor: NATH_motion_door @@ -1268,35 +1098,36 @@ lys_nathaniel: state: turn_off motionlights: - - time: '00:00:00' - light_data: - brightness: 90 - - time: sunrise - 00:30:00 + - time: '06:30:00' light_data: brightness: 160 - - time: sunrise + 00:30:00 + - time: '08:30:00' + orLater: 'sunrise + 00:30:00' light_data: brightness: 120 - - time: sunset - 00:30:00 + - time: 'sunset - 00:30:00' + orLater: '19:00:00' light_data: brightness: 140 - - time: sunset + 00:30:00 + - time: 'sunset + 00:30:00' light_data: brightness: 110 - time: '21:00:00' state: turn_off + fixed: True # Locks time from beeing moved of deleted light_modes: - mode: nightNathaniel state: adjust light_data: brightness: 20 + lux_constraint: 4000 room_lux_constraint: 60 conditions: - "self.ADapi.get_tracker_state('person.nathaniel') == 'home' or self.ADapi.get_tracker_state('person.camilla_nordvik_2') == 'home' or self.ADapi.get_tracker_state('person.anders_heibo') == 'home'" - - lights: # Taklampe Nathaniel + - lights: - light.fibaro_walli_dimmer automations: @@ -1304,15 +1135,12 @@ lys_nathaniel: state: turn_off motionlights: - - time: '00:00:00' - state: adjust - light_data: - brightness: 90 - - time: sunrise - 00:30:00 + - time: '06:30:00' state: adjust light_data: brightness: 160 - - time: sunrise + 00:30:00 + - time: '08:30:00' + orLater: 'sunrise + 00:30:00' state: adjust light_data: brightness: 120 @@ -1324,10 +1152,6 @@ lys_nathaniel: state: adjust light_data: brightness: 110 - - time: sunset + 01:30:00 - state: adjust - light_data: - brightness: 70 - time: '21:00:00' state: turn_off @@ -1340,7 +1164,7 @@ lys_nathaniel: conditions: - "self.ADapi.get_tracker_state('person.nathaniel') == 'home' or self.ADapi.get_tracker_state('person.camilla_nordvik_2') == 'home'" - - lights: #Nattlys + - lights: - switch.nattlys_nathaniel #- fan.mi_air_purifier_nathaniel #Mi Air Purifier @@ -1369,10 +1193,10 @@ lys_oliver: module: lightwand class: Room log: lights_log - json_path: /homeassistant/appdaemon/apps/Lightwand/wand_ + #json_path: /homeassistant/db/Lightwand/ OutLuxZigbee: OutdoorHueLux RoomLuxZwave: OLLI_Multisensor_illuminance - rain_sensor: sensor.netatmo_kvernabekkvegen_59_stue_regnsensor_rain # Regnsensor + rain_sensor: sensor.netatmo_kvernabekkvegen_59_stue_regnsensor_rain zwave_motion_sensors: - motion_sensor: OLLI_Multisensor delay: 360 @@ -1380,8 +1204,7 @@ lys_oliver: presence: - tracker: person.oliver tracker_constraints: "self.now_is_between('06:30:00', '23:00:00') " - # Media players for light presets - mediaplayers: # Sorted by priority pr room + mediaplayers: - mediaplayer: binary_sensor.makrell587 mode: oliver_pc Lights: @@ -1404,10 +1227,11 @@ lys_oliver: light_data: brightness: 80 effect: fireplace - - time: '23:00:00' + - time: '22:10:00' state: turn_on + dimrate: 2 light_data: - brightness: 40 + brightness: 20 effect: fireplace light_modes: @@ -1420,7 +1244,6 @@ lys_oliver: room_lux_constraint: 100 conditions: - "self.ADapi.get_tracker_state('person.oliver') == 'home'" - - "self.ADapi.now_is_between('06:50:00', '23:30:00')" - lights: - light.0x086bd7fffe5d394a # Zigbee dimmer Olivers rom @@ -1429,22 +1252,18 @@ lys_oliver: - time: '00:00:00' light_data: brightness: 10 - - time: '06:00:00' - light_data: - brightness: 110 - - time: sunrise - 00:10:00 + - time: '06:30:00' light_data: brightness: 160 - - time: sunrise + 00:30:00 + - time: '08:30:00' + orLater: 'sunrise + 00:30:00' light_data: brightness: 144 - - time: sunset - 01:00:00 - light_data: - brightness: 120 - time: sunset - 00:20:00 light_data: brightness: 80 - time: sunset + 00:30:00 + orLater: '21:00:00' light_data: brightness: 60 - time: sunset + 01:30:00 @@ -1486,19 +1305,17 @@ lys_oliver: lux_turn_off: 4000 conditions: - "self.ADapi.get_tracker_state('person.oliver') == 'home'" - - "self.ADapi.now_is_between('06:50:00', '23:30:00')" -############################## Lys gang oppe ############################## +############################## Lights gaming tv ############################## lys_gaming_krok: module: lightwand class: Room log: lights_log - json_path: /homeassistant/appdaemon/apps/Lightwand/wand_ + #json_path: /homeassistant/db/Lightwand/ OutLuxZigbee: OutdoorHueLux - rain_sensor: sensor.netatmo_kvernabekkvegen_59_stue_regnsensor_rain # Regnsensor - # Media players for light presets - mediaplayers: # Sorted by rooms and priority pr room + rain_sensor: sensor.netatmo_kvernabekkvegen_59_stue_regnsensor_rain + mediaplayers: - mediaplayer: media_player.ue55d6500 mode: gaming ToggleLights: @@ -1517,15 +1334,15 @@ lys_gaming_krok: lux_turn_on: 600 lux_turn_off: 900 -############################## UTELYS ############################## +############################## Outdoor lights ############################## utelys: module: lightwand class: Room log: lights_log - json_path: /homeassistant/appdaemon/apps/Lightwand/wand_ + #json_path: /homeassistant/db/Lightwand/ OutLuxZigbee: OutdoorHueLux - rain_sensor: sensor.netatmo_kvernabekkvegen_59_stue_regnsensor_rain # Regnsensor + rain_sensor: sensor.netatmo_kvernabekkvegen_59_stue_regnsensor_rain presence: - tracker: device_tracker.truls_location_tracker @@ -1544,10 +1361,11 @@ utelys: - time: '06:30:00' light_data: brightness: 50 - - time: sunrise - 00:10:00 + - time: '07:30:00' + orLater: 'sunrise + 00:10:00' light_data: brightness: 70 - - time: sunrise + 00:10:00 + - time: sunrise + 01:10:00 light_data: brightness: 25 - time: sunset - 01:00:00 @@ -1560,6 +1378,7 @@ utelys: light_data: brightness: 60 - time: sunset + 00:15:00 + orLater: '21:00:00' light_data: brightness: 50 - time: sunset + 00:45:00 @@ -1579,7 +1398,7 @@ utelys: - mode: presence light_data: brightness: 250 - - mode: guest + - mode: decor light_data: brightness: 200 transition: 3 @@ -1604,12 +1423,13 @@ utelys: - time: '06:30:00' light_data: brightness: 160 - - time: sunrise - 00:20:00 + - time: '07:30:00' + orLater: 'sunrise + 00:10:00' light_data: brightness: 200 - - time: sunrise + 00:20:00 + - time: sunrise + 01:10:00 light_data: - brightness: 180 + brightness: 140 - time: sunset - 01:00:00 light_data: brightness: 160 @@ -1617,6 +1437,7 @@ utelys: light_data: brightness: 200 - time: sunset + 00:20:00 + orLater: '21:00:00' light_data: brightness: 180 - time: sunset + 00:40:00 @@ -1630,7 +1451,7 @@ utelys: - mode: presence light_data: brightness: 250 - - mode: guest + - mode: decor light_data: brightness: 250 transition: 3 @@ -1648,10 +1469,10 @@ utelys_inngang_leil: module: lightwand class: Room log: lights_log - json_path: /homeassistant/appdaemon/apps/Lightwand/wand_ + #json_path: /homeassistant/db/Lightwand/ OutLuxZigbee: OutdoorHueLux RoomLuxZigbee: LEIL_OutdoorHueLux - rain_sensor: sensor.netatmo_kvernabekkvegen_59_stue_regnsensor_rain # Regnsensor + rain_sensor: sensor.netatmo_kvernabekkvegen_59_stue_regnsensor_rain exclude_from_custom: True zigbee_motion_sensors: - motion_sensor: LEIL_OutdoorHueLux