Monthly Archives: April 2018

Home Assistant RGB Pixel Pathway Lighting (2018)

This is a slight departure from my normal RGB pixel display videos. We look at using strip lights as pathway lights and controlling them through Home Assistant. I go through setting up Home Assistant and programming the NodeMCU modules using Ben’s code on GitHub.

SD Card Formatter: https://www.sdcard.org/
Etcher Image Writer: https://etcher.io
Home Assistant: https://www.home-assistant.io/
CloudMQTT: https://www.cloudmqtt.com/
Arduino IDE: https://www.arduino.cc
Multi-sensor GitHub Page: https://bit.ly/2GUnSmQ
Pixel controller GitHub Page: https://bit.ly/2IKBLR7

Parts Lists:

Multi-Sensor

Pixel Controller

My YAML configuration for this:

# Binary Sensors
binary_sensor:
  - platform: threshold
    name: isdark
    entity_id: sensor.light_level
    lower: 100
    hidden: true

# Regular Sensors
sensor:
  - platform: template
    sensors:
      rgbtemp:
        friendly_name: RGB Temp
        value_template: >-
          {% if states('sensor.temperature')|float > 79.9 %}
            Hot
          {% elif states('sensor.temperature')|float < 70 %}
            Cold
          {% else %}
            Just Right
          {% endif %}

Automations

- alias: Stair Pathway Lighting On       
  trigger:                               
    - platform: state                    
      entity_id: binary_sensor.isdark    
      to: 'on'                           
    - platform: state                    
      entity_id: sensor.rgbtemp          
  condition:                             
    - condition: state                   
      entity_id: binary_sensor.isdark    
      state: 'on'                        
  action:                                
    - service: mqtt.publish              
      data_template:                     
        topic: "mqtt/topic"         
        payload: >-                      
          {% if is_state('sensor.rgbtemp', 'Hot') %}
            {"state":"ON","color":{"r":255,"g":100,"b":100},"brightness":6,"effect":"solid"}
          {% elif is_state('sensor.rgbtemp', 'Cold') %}                                     
            {"state":"ON","color":{"r":100,"g":100,"b":255},"brightness":6,"effect":"solid"}
          {% else %}                                                                        
            {"state":"ON","color":{"r":100,"g":200,"b":100},"brightness":6,"effect":"solid"}
          {% endif %}                                                                       
                                                                                            
- alias: Stair Pathway Lighting Off                                                         
  trigger:                                                                                  
    - platform: state                                                                       
      entity_id: binary_sensor.isdark                                                       
      to: 'off'                                                                             
  condition:                                                                                
    - condition: state                                                                      
      entity_id: light.stair_strip                                                          
      state: 'on'                                                                           
  action:                                                                                   
    - service: mqtt.publish                                                                 
      data_template:                                                                        
        topic: "mqtt/topic"                                               
        payload: '{"state":"OFF"}'