Documentation #2
Replies: 9 comments 53 replies
-
Yes absolutely. It has been quite complex with everything I wanted to include when writing something that needs to work for every room in the house. The whole idea is to have mode events controlling most of the house and with either bed sensors or some observations on "bad habits" you do every day, it should be easy to trigger morning/night automatically. I have posted my mode event code here: Mode event You should rewrite to your needs as it is not written to be adaptable in the same way as lightwand. I can start with the living room, and then add more rooms later when I have some spare time. Please comment if it is clear or more specific on what is still unclear. The living room here is lit when someone is home, unless I select a off mode. There is no motion/presence detection sensors. I like it a bit dimmer than my wife so there are some lights that only is lit when she is home. You'll need a listen_sensor defined to react to when she leaves and comes home, and a if statement under conditions for the lights to turn off when she is away. I have two tv's with second one being used as a computer screen (both is connected to Home Assistant, so I get an on/off sensor). Turning one of them one will change the light to "media mode" automatically if mode is normal/morning. I have opted to define every dimmer with its own configurations due to reflections it the tv, so that I only dim down where the light reflects in the tv. That list is in priority, meaning the tv will set tv mode when turned on regardless of the pc mode being current mode or not. For starters you could define every light in one configuration like this and later copy if you need to separate configuration: MQTTLights:
- lights:
- zigbee2mqtt/LEDSTRIP1
- zigbee2mqtt/LEDSTRIP2
- zigbee2mqtt/LEDSTRIP3 The last thing controlling lights on/off is a lux sensor. The whole part under "automations" is where you set the preferred light, and the light will be on in "normal" mode unless it hits the lux_constraint threshold. This is the tricky part getting the brightness right during the day. If you have trouble setting up times if you mix solar based an clock based times, I suggest you uncomment the logging described in the tip, and check if it corresponds to what you want. Here is a copy from the yaml file for my living room. I have removed some lights that are similar to others and tried to change names from Norwegian to English. I have included lights controlled over MQTT that are both with color settings and only dim. Both of those will be lit unless lux or off/away mode. In addition I have included a light connected to an on/off switch that are only lit between 15:00 and 22:00 if lux is below 600. See: zigbee2mqtt/STUE_Stikk_2_South. At last I have included the dining table light. It is a standard Home Assistant light entity. We only use that for when we eat or the kids sit there and do their homework. There I have defined all brightness settings with automations, but the state is adjust so other modes will turn on/off with the dim set for all modes. livingroom:
module: lightwand
class: Room
json_path: /conf/persistent/Lightwand/
MQTT_namespace: mqtt
OutLuxMQTT: zigbee2mqtt/OutdoorHueLux
rain_sensor: sensor.netatmo_regnsensor_rain
listen_sensors:
- person.mywife
# Media players for light presets
mediaplayers: # Sorted by rooms and priority pr room
- mediaplayer: switch.sony_vlp_hw65
mode: projector
- mediaplayer: media_player.samsung_q6_series_82
mode: tv
delay: 33
- mediaplayer: media_player.samsung_s95ba_55_tv
mode: pc
MQTTLights:
- lights:
- zigbee2mqtt/LEDSTRIP1
automations:
- time: '00:00:00'
light_data:
brightness: 30
transition: 3
color: # Late night
x: 0.5512
y: 0.3956
- time: '06:30:00'
light_data:
brightness: 80
transition: 3
color:
x: 0.5075
y: 0.4102
- time: '08:30:00'
orLater: 'sunrise + 00:15:00'
dimrate: 2
light_data:
brightness: 60
color:
x: 0.5075
y: 0.4102
- time: 'sunset - 00:30:00'
light_data:
brightness: 50
transition: 3
color:
x: 0.5178
y: 0.3971
- time: 'sunset + 00:30:00'
orLater: '20:00:00'
dimrate: 2
light_data:
brightness: 30
color:
x: 0.5512
y: 0.3956
light_modes:
- mode: eat
state: turn_on
offset: 30
- mode: decor
state: turn_on
offset: 20
- mode: x-mas
state: turn_on
offset: 50
- mode: morelight
state: turn_on
offset: 50
- mode: evenmorelight
state: turn_on
offset: 80
- mode: wash
light_data:
brightness: 230
color_temp: 427
- mode: tv
light_data:
brightness: 7
transition: 3
color:
x: 0.5178
y: 0.3971
- mode: pc
light_data:
brightness: 30
transition: 3
color:
x: 0.5178
y: 0.3971
- mode: movie
state: turn_off
lux_constraint: 5000
lux_turn_on: 4500
lux_turn_off: 5000
- lights:
- zigbee2mqtt/STUE_Spot
automations:
- time: '00:00:00'
light_data:
brightness: 35
transition: 3
- time: '06:30:00'
light_data:
brightness: 55
transition: 3
- time: 'sunset + 00:30:00'
orLater: '20:00:00'
dimrate: 6
light_data:
brightness: 35
transition: 3
light_modes:
- mode: eat
state: turn_on
offset: 30
- mode: decor
state: turn_on
offset: 20
- mode: x-mas
state: turn_on
offset: 30
- mode: morelight
state: turn_on
offset: 50
- mode: evenmorelight
state: turn_on
offset: 80
- mode: tv
state: lux_controlled
offset: -20
- mode: projector
state: turn_off
- mode: movie
state: turn_off
lux_constraint: 6000
lux_turn_on: 5500
lux_turn_off: 6000
conditions:
- "self.ADapi.get_tracker_state('person.mywife') == 'home'"
- lights:
- zigbee2mqtt/STUE_Stikk_2_South
automations:
- time: '15:00:00' # No need to specify other than time to get lux control
- time: '22:00:00'
state: turn_off
light_modes:
- mode: decor
state: turn_on
- mode: x-mas
state: turn_on
- mode: morelight
state: turn_on
- mode: evenmorelight
state: turn_on
- mode: tv
state: turn_off
- mode: projector
state: turn_off
- mode: movie
state: turn_off
lux_constraint: 600
lux_turn_on: 400
lux_turn_off: 600
conditions:
- "self.ADapi.get_tracker_state('person.mywife') == 'home'"
Lights:
- lights:
- light.stue_spisebord
automations:
- time: '00:00:00'
state: adjust # Only adjust lights. Other modes or switches turns on/off
light_data:
brightness: 1
- time: '06:30:00'
state: adjust
light_data:
brightness: 80
transition: 3
- time: 'sunset - 01:00:00'
state: adjust
dimrate: 3
light_data:
brightness: 60
transition: 3
- time: 'sunset + 01:00:00'
state: adjust
dimrate: 2
light_data:
brightness: 1
transition: 3
light_modes:
- mode: eat
state: turn_on
- mode: x-mas
state: turn_on
- mode: morelight
state: turn_on
offset: 10
- mode: evenmorelight
state: turn_on
offset: 20
- mode: tv
state: turn_off
- mode: projector
state: turn_off
- mode: movie
state: turn_off
- mode: Mywifes_mode
state: manual
lux_constraint: 35000
conditions:
- "self.ADapi.get_tracker_state('person.mywife') == 'home'"
|
Beta Was this translation helpful? Give feedback.
-
For the kids bedroom I have some minor differences but here is the code for the youngest one Here I use the "exclude_from_custom" option. As I touched on in previous comment you can use mode "custom" to disable all automations. I do not use it much but remember to set this mode before you do something special with the colors or similar for birthdays or special days, or simply need some changes not yet programmed.. But as I experienced quickly it was then really hard to remember to turn on outdoor lights and lights reacting to motions, so I created an option to still do regular automations for the rooms you do not need that special light in. The motion sensor is a presence detector so I set a short delay for the light to turn off. The bed sensor is just to pause the light being turned on until he gets out of bed. The mode is kept as night for that room, so if you need some light to turn on at given time to wake them up or similar, you need to specify automations in night mode. Presence is a way to set room as away when no one in the list is home, and return to normal mode when one returns. The first light is motion/presence detection controlled. I used to force the light off at 21:00 but now he has a mode switch in his room with two buttons so we can set the lightmode to off during daytime or night for his room after 20:00 with the off button, and morning/normal mode during day or nightpath if he needs to go to the bathroom during night with the on button. The second light is manually controlled. It is achieved with "state: adjust". It does not turn on or off with motion detection bu 8000 t away/night will turn it off. Hitting that lux constraint will also turn the light off. The last light is just a decorative light that is on whenever there is motion. During nighttime he may want it off sometimes so state is manual to disable any automations. lys_nathaniel:
module: lightwand
class: Room
log: info_log
json_path: /conf/persistent/Lightwand/
MQTT_namespace: mqtt
OutLuxMQTT: zigbee2mqtt/OutdoorHueLux
RoomLuxMQTT: zwave_hus/NATH_Multisensor_Seng/sensor_multilevel/endpoint_0/Illuminance
rain_sensor: sensor.netatmo_regnsensor_rain
options:
- exclude_from_custom
motion_sensors:
- motion_sensor: binary_sensor.nathaniel_presence_sensor_rom
delay: 60
MQTT_motion_sensors:
- motion_sensor: zwave_hus/ENTRE_Motion/notification/endpoint_0/Home_Security/Motion_sensor_status
delay: 10
motion_constraints: "self.now_is_between('sunset + 00:30:00', '22:00:00')"
bed_sensors:
- binary_sensor.nathaniel_presence_sensor_seng
presence:
- tracker: person.nathaniel
tracker_constraints: "self.now_is_between('06:30:00', '22:00:00') "
MQTTLights:
- lights:
- zwave/NATH_Dimmer_Spot/switch_multilevel/endpoint_0/targetValue
motionlights:
- time: '00:00:00'
light_data:
value: 1
- time: '06:30:00'
light_data:
value: 51
- time: 'sunset - 00:30:00'
orLater: '19:00:00'
light_data:
value: 31
- time: '21:00:00'
light_data:
value: 20
#fixed: True # Locks time from being moved or deleted
#state: turn_off
light_modes:
- mode: nightNathaniel
state: adjust
light_data:
value: 1
- mode: night_path
light_data:
value: 3
lux_constraint: 4000
room_lux_constraint: 60
conditions:
- "self.ADapi.get_tracker_state('person.nathaniel') == 'home' or self.ADapi.get_tracker_state('person.camilla') == 'home'"
Lights:
- lights:
- light.nath_dimmer_taklys
automations:
- time: '06:30:00'
state: adjust
light_data:
brightness: 100
- time: sunset - 00:30:00
state: adjust
light_data:
brightness: 115
- time: sunset + 00:30:00
state: adjust
light_data:
brightness: 70
- time: '21:00:00'
fixed: True
state: turn_off
light_modes:
- mode: nightNathaniel
state: turn_off
lux_constraint: 10000
room_lux_constraint: 100
- lights:
- switch.nath_nattlys
motionlights:
state: turn_on
light_modes:
- mode: nightNathaniel
state: manual
- mode: night
state: manual
lux_constraint: 20000
room_lux_constraint: 200
conditions:
- "self.ADapi.get_tracker_state('person.nathaniel') == 'home'" |
Beta Was this translation helpful? Give feedback.
-
What would be the best way to create the following scenario: My morning mode starts between 05:30-10:00. And i want different settings for the lights depending if my girlfriend is home or not for the same light. Can i have different settings for the light_mode: morning depending on a constraint(presence). I want the lights to come on at 05:50 only if I'm home and an hour later if my girlfriend is home too. |
Beta Was this translation helpful? Give feedback.
-
Here is my configuration for the kitchen. It is partly open so especially when watching movies I would like most of the light to be off. For the main light: I have a different automation setting for motion light. Motion is also constrained by: kjokkenlys:
module: lightwand
class: Room
json_path: /conf/persistent/Lightwand/
MQTT_namespace: mqtt
OutLuxMQTT: zigbee2mqtt/OutdoorHueLux
RoomLuxMQTT: zwave/KITCH_FibaroSensor/sensor_multilevel/endpoint_0/Illuminance
rain_sensor: sensor.netatmo_regnsensor_rain
listen_sensors:
- person.mywife
MQTT_motion_sensors:
- motion_sensor: zigbee2mqtt/KITCH_motion_Aqara
delay: 300
motion_constraints: "self.now_is_between('06:50:00', '23:00:00') and self.get_tracker_state('person.mywife') == 'home' and self.LIGHT_MODE != 'movie' or self.get_state('switch.kitch_espresso') == 'on'"
- motion_sensor: zwave/KITCH_FibaroSensor/notification/endpoint_0/Home_Security/Motion_sensor_status
delay: 300
motion_constraints: "self.now_is_between('06:50:00', '23:00:00') and self.get_tracker_state('person.camilla') == 'home' and self.LIGHT_MODE != 'movie' or self.get_state('switch.kitch_espresso') == 'on'"
Lights:
- lights:
- light.kitch_dimmer_underskap
automations: # Define some light for normal automation when motion is not detected/constrained.
- time: '00:00:00'
light_data:
brightness: 5
transition: 3
- time: '06:00:00'
light_data:
brightness: 50
transition: 3
- time: 'sunrise - 00:40:00'
dimrate: 1
light_data:
brightness: 60
transition: 3
- 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: 50
transition: 3
- time: 'sunrise + 01:30:00'
state: turn_off
light_data: # Input light_data even if state is turn_off if you have modes with offset +-
brightness: 50
transition: 3
- time: 'sunset - 01:30:00'
light_data:
brightness: 40
transition: 3
- time: 'sunset + 00:30:00'
orLater: '21:00:00'
dimrate: 2 # Will start to dim from previous brightness (40) - 1 per x minutes. In this case every 2 minutes.
light_data:
brightness: 5
transition: 3
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: 5
transition: 3
- time: '06:00:00'
light_data:
brightness: 80
transition: 3
- time: '06:50:00'
light_data:
brightness: 160
transition: 3
- time: '07:30:00'
orLater: 'sunrise - 00:20:00'
light_data:
brightness: 180
transition: 3
- time: 'sunrise + 01:00:00'
light_data:
brightness: 120
transition: 3
- time: '21:00:00'
orLater: 'sunset + 00:30:00'
dimrate: 2
light_data:
brightness: 5
transition: 3
light_modes:
- mode: lagmat
state: turn_on
offset: 130
- mode: morning
light_data:
brightness: 200
- mode: decor
state: turn_on
offset: -20
- mode: movie
state: turn_off
- mode: x-mas
state: turn_on
offset: 10
- lights:
- switch.kitch_lys_vindu_sor
# 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 # Set to lux controlled during night in stead of default off for night.
- mode: decor
state: turn_on
- mode: x-mas
state: turn_on
- mode: morelight
state: turn_on
- mode: evenmorelight
state: turn_on
- mode: away
state: lux_controlled
lux_constraint: 5000
lux_turn_on: 4000
lux_turn_off: 5000 |
Beta Was this translation helpful? Give feedback.
-
ModeQuestion. For example, if i activate normal night-mode, every room is acting on this mode and light turns off, OK. But what if i activate night_master_bedroom during night-mode, in rooms that not has the corresponding light_mode, will they keep night mode or switch to normal? |
Beta Was this translation helpful? Give feedback.
-
Hello, Finally almost back in business with a shiny Proxmox-server, and a couple of VM´s and LXC´s. Fun stuff, and thanks for the recommendation. I have one question about "OutLuxMQTT". I have an outdoor Hue motion sensor that also sends the illuminance as an attribute. But how to use that in Lightwand? If i do "OutLuxMQTT: zigbee2mqtt/Frontporch Motion Sensor" i believe its only the motion state that is captured. I have tried also "OutLuxMQTT: zigbee2mqtt/Frontporch Motion Sensor/illuminance_lux" but i dont think its working. From MQTT Explorer it löoks like like below: |
Beta Was this translation helpful? Give feedback.
-
Ever tried to combine the use of Lightwand and Adaptive Lighting? I think it would be nice to have the brightness and color temp to adjust per auto by Adaptive Lighting and Lightwand to handle on/off/motion and modes. And of course I mean using both apps as they are but using a combination of them. |
Beta Was this translation helpful? Give feedback.
-
Yes, HA detects on/off-states with Mqtt. The media-stuff is working fine for me, because there is just a turn_off state in the lightmode, then its not put to manual control. So when media is off, the lights turns on as it should and continuing adapting. The problem that i can see is about lights that is dimmed but on when no motion, and then brightened on motion. Maybe... |
Beta Was this translation helpful? Give feedback.
-
A question: Is it possible to just set the offset for motionlights, when there is no lightdata in the automation? automation:
- time: "00:00:00" # AL is controling the lights during the day except from on/off
state: turn_on
motionlights:
- time: "00:00:00"
offset: 80 It would be a solution to let the AL control the lights, and set a min and max brightness, and then on motion, do the offset and crank up the brightness from whatever brightness the light actual have. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, really great app you made. Is it possible for you to share your usecase of this and how you set it up. Struggling a bit with the documentation to get it clear about all the settings.
Beta Was this translation helpful? Give feedback.
All reactions