|
| 1 | +Light Controller |
| 2 | +=============== |
| 3 | +Controls light according to programmed scenes based on multiple inputs |
| 4 | +like switches, motions sensors and door/window sensors. |
| 5 | +Suitable for users, that have smart light always power on and zigbee switches. |
| 6 | + |
| 7 | +Main features: |
| 8 | +* Supports 3 build-in, configurable scenes |
| 9 | + - cold - used during daylight |
| 10 | + - warm - used for afternoon |
| 11 | + - dimmed - as a night light |
| 12 | +* Speed - where it is possible, state is cached to speed up calculation of response |
| 13 | +* Commands and responses are send via mqtt, but light can be controlled via HA as well |
| 14 | +* Sun on/off detection |
| 15 | +* Support motions sensors |
| 16 | +* Support contact sensors |
| 17 | + |
| 18 | +Minimal configuration: |
| 19 | +```yaml |
| 20 | +# Name of app instance |
| 21 | +light_ctrl: |
| 22 | + # Module name |
| 23 | + module: lightcontroller |
| 24 | + # Module class |
| 25 | + class: LightController |
| 26 | + # Define light entity to control. |
| 27 | + light_entity: light.light_1 |
| 28 | + # Define z2m names of switches. |
| 29 | + # Switch needs to support at least single click, ideally double and hold as well |
| 30 | + switches: |
| 31 | + - name: switch_1 |
| 32 | +``` |
| 33 | +
|
| 34 | +Notes: |
| 35 | +* z2m main topic needs to de default one (zigbee2mqtt) |
| 36 | +
|
| 37 | +Switch event behavior: |
| 38 | +* single - turn off or turn on default scene (warm or cold depending on current time) |
| 39 | +* double - when off or not warm - set to warm. If warm - set to cold. Convenient way to change scene. |
| 40 | +* hold - set dimmed scene |
| 41 | +
|
| 42 | +Full configuration: |
| 43 | +```yaml |
| 44 | +# Name of app instance |
| 45 | +light_ctrl: |
| 46 | + # Module name |
| 47 | + module: lightcontroller |
| 48 | + # Module class |
| 49 | + class: LightController |
| 50 | + # Scenes configuration. If not defined, some defaults will be used. |
| 51 | + scene_cold: |
| 52 | + color_temp: 250 |
| 53 | + brightness: 255 |
| 54 | + scene_warm: |
| 55 | + color_temp: 389 |
| 56 | + brightness: 150 |
| 57 | + scene_dimm: |
| 58 | + color_temp: 500 |
| 59 | + brightness: 1 |
| 60 | + # If light don't support color_temp, then it is needed to set following flag to false: |
| 61 | + color_temp_support: True |
| 62 | + # If you want to automatically change the light color on some events like sunset, then set following flag: |
| 63 | + auto_color_temp_change: True |
| 64 | + # Suppress multiple clicks for x seconds: |
| 65 | + debounce: 1 |
| 66 | + # Define HA light entity to control. Still needed, even if z2m entity is defined. |
| 67 | + light_entity: light.light_1 |
| 68 | + # It is possible to define z2m name topic to control light, |
| 69 | + # then command will be send directly to z2m via mqtt: |
| 70 | + mqtt_entity: light_1 |
| 71 | + # Define input switches as z2m names with associated 'action' attribute value. |
| 72 | + # If given switch don't support double/hold action, then some functionality will be reduced. |
| 73 | + switches: |
| 74 | + - name: switch_1 |
| 75 | + single: "left_single" |
| 76 | + double: "left_double" |
| 77 | + hold: "left_hold" |
| 78 | + # Define additional time bounds for cold scene. |
| 79 | + # If not defined, cold/warm scene will be selected based on sun position only. |
| 80 | + cold_scene_time: |
| 81 | + start: "07:00:00" |
| 82 | + end: "19:00:00" |
| 83 | + # Define z2m motion sensors to define auto on function and timeout function |
| 84 | + motion_sensors: |
| 85 | + - name: occupancy_1 |
| 86 | + turn_on: True # defult True, defines if given motion sensor can trigger light on action |
| 87 | + # if set to false, it will be used only to check, if timeout can be started to count |
| 88 | + # Timeout for motion sensors, that is after which time light should be turned off after not detecting a move. |
| 89 | + motion_timeout: 300 # seconds |
| 90 | + # Contacts, that can trigger light on acion when contact=false. |
| 91 | + # To be used with door sensor, so when door goes open, light will turn on. |
| 92 | + contacts: |
| 93 | + - name: contact_1 |
0 commit comments