Espixelstick and Ho...
 
Notifications
Clear all

Espixelstick and Home Assistant

24 Posts
11 Users
0 Reactions
24.8 K Views
Posts: 17
Topic starter
(@thestealth)
Eminent Member
Joined: 10 years ago
[#48660]

Hi,

I've decided to try and get my espixestick working with MQTT and home assistant. I don;t know much about HA or using MQTT, so this is what I have tried.

I made an Ubuntu Server VM and installed HA following these instructions. Got it running no problems.

I then added the following to configuration.yaml :

mqtt:

light:
  - platform: mqtt
    name: "PixelStick01"
    state_topic: "matrix/esps/light/status"
    command_topic: "matrix/esps/light/switch"
    brightness_state_topic: "matrix/esps/brightness/status"
    brightness_command_topic: "matrix/esps/brightness/set"
    rgb_state_topic: "matrix/esps/rgb/status"
    rgb_command_topic: "matrix/esps/rgb/set"
    brightness_scale: 100
    optimistic: false

Restarted HA and now I have the light button.

I configured the espixelstick as follows:

Capture

However, when I try and turn on the light. nothing happens. The slider switch on the console goes on and then right back off. Any ideas? Something wrong with my config? I also don't seem to have a color picker.

Capture2

Thanks


23 Replies
Posts: 17
Topic starter
(@thestealth)
Eminent Member
Joined: 10 years ago

I think I just found my problem, there was an extra "/" in my topic. I corrected it as follows and now it works!

Capture3

Reply
Posts: 12
(@paxonator)
Active Member
Joined: 11 years ago

Glad you got it working. I'm just beginning using pixel nodes and I want everything to run through Home Assistant. Thanks for your work.


Reply
tecnageek
Posts: 220
(@tecnageek)
Reputable Member
Joined: 10 years ago

Hello, I have been working on this for some time and I could really use some help.
In hassio I have created a binary sensor that communicates with a light sensor that can go into "isdark" state if the lux goes below 100.
I then tried add an automation that when "isdark" activates it sends and on state to the EspixelStick and have lights come on. I can get my "isdark" state to on and I can manually turn on lights but can't get lights to trigger from "isdark".
Below is parts of my config.yaml

light:  
#espixelstick subnet 110
  - platform: mqtt
    name: "PixelStick01"
    state_topic: "matrix/esps/light/status"
    command_topic: "matrix/esps/light/switch"
    brightness_state_topic: "matrix/esps/brightness/status"
    brightness_command_topic: "matrix/esps/brightness/set"
    rgb_state_topic: "matrix/esps/rgb/status"
    rgb_command_topic: "matrix/esps/rgb/set"
    brightness: true
    flash: true
    rgb: true
    optimistic: false
    qos: 0
	
	sensor:
#Light sensor
  - platform: mqtt  
    state_topic: "bruh/sensornode1"  
    name: "SN1 LDR"
    ##This sensor is not calibrated to actual LUX. Rather, this a map of the input voltage ranging from 0 - 1023.
    unit_of_measurement: "LUX"  
    value_template: '{{ value_json.ldr }}'  
    
# Binary Sensors
binary_sensor:
  - platform: threshold
    name: isdark
    entity_id: sensor.sn1_ldr
    lower: 100
    hidden: true
	
#Groups
group:  
  sensor_node_1_card:  
    name: Sensor Node 1  
    entities:  
      - sensor.sn1_temperature  
      - sensor.sn1_humidity  
      - sensor.sn1_ldr  
      - light.sn1_led
	
automation:
- alias: EspixelStick110 On       
  trigger:                               
    - platform: state                    
      entity_id: binary_sensor.isdark    
      to: 'on'                           
  condition:                             
    - condition: state                   
      entity_id: binary_sensor.isdark    
      state: 'on'                        
  action:                                
    - service: mqtt.publish              
      data_template:                     
        topic: "matrix/esps"         
        payload: '{"state":"ON"}'
                                                                   
- alias: EspixelStick110 Off                                                         
  trigger:                                                                                  
    - platform: state                                                                       
      entity_id: binary_sensor.isdark                                                       
      to: 'off'                                                                             
  condition:                                                                                
    - condition: state                                                                      
      entity_id: binary_sensor.isdark
      state: 'on'                                                                           
  action:                                                                                   
    - service: mqtt.publish                                                                 
      data_template:                                                                        
        topic: "matrix/esps"                                               
        payload: '{"state":"OFF"}'                         
script: !include scripts.yaml

Any insight would be deeply appriciated


Reply
Posts: 12
(@paxonator)
Active Member
Joined: 11 years ago
tecnageek wrote:Hello, I have been working on this for some time and I could really use some help.
In hassio I have created a binary sensor that communicates with a light sensor that can go into "isdark" state if the lux goes below 100.
I then tried add an automation that when "isdark" activates it sends and on state to the EspixelStick and have lights come on. I can get my "isdark" state to on and I can manually turn on lights but can't get lights to trigger from "isdark".
Below is parts of my config.yaml

light:  
#espixelstick subnet 110
  - platform: mqtt
    name: "PixelStick01"
    state_topic: "matrix/esps/light/status"
    command_topic: "matrix/esps/light/switch"
    brightness_state_topic: "matrix/esps/brightness/status"
    brightness_command_topic: "matrix/esps/brightness/set"
    rgb_state_topic: "matrix/esps/rgb/status"
    rgb_command_topic: "matrix/esps/rgb/set"
    brightness: true
    flash: true
    rgb: true
    optimistic: false
    qos: 0
	
	sensor:
#Light sensor
  - platform: mqtt  
    state_topic: "bruh/sensornode1"  
    name: "SN1 LDR"
    ##This sensor is not calibrated to actual LUX. Rather, this a map of the input voltage ranging from 0 - 1023.
    unit_of_measurement: "LUX"  
    value_template: '{{ value_json.ldr }}'  
    
# Binary Sensors
binary_sensor:
  - platform: threshold
    name: isdark
    entity_id: sensor.sn1_ldr
    lower: 100
    hidden: true
	
#Groups
group:  
  sensor_node_1_card:  
    name: Sensor Node 1  
    entities:  
      - sensor.sn1_temperature  
      - sensor.sn1_humidity  
      - sensor.sn1_ldr  
      - light.sn1_led
	
automation:
- alias: EspixelStick110 On       
  trigger:                               
    - platform: state                    
      entity_id: binary_sensor.isdark    
      to: 'on'                           
  condition:                             
    - condition: state                   
      entity_id: binary_sensor.isdark    
      state: 'on'                        
  action:                                
    - service: mqtt.publish              
      data_template:                     
        topic: "matrix/esps"         
        payload: '{"state":"ON"}'
                                                                   
- alias: EspixelStick110 Off                                                         
  trigger:                                                                                  
    - platform: state                                                                       
      entity_id: binary_sensor.isdark                                                       
      to: 'off'                                                                             
  condition:                                                                                
    - condition: state                                                                      
      entity_id: binary_sensor.isdark
      state: 'on'                                                                           
  action:                                                                                   
    - service: mqtt.publish                                                                 
      data_template:                                                                        
        topic: "matrix/esps"                                               
        payload: '{"state":"OFF"}'                         
script: !include scripts.yaml

Any insight would be deeply appriciated

I would suggest posting this question here https://www.reddit.com/r/homeassistant/ or on the official home assistant forums. They should easily be able to tell you what is going on. I'm still to new with home assistant to be of much help.

I've found both to be great communities full of knowledge.

I don't want to draw people away from this forum. I really think everyone's light setups should be combined with home automation software so any member of the house can start/stop/change the show.


Reply
Posts: 8513
(@angus40)
Illustrious Member
Joined: 15 years ago
tecnageek wrote:Hello, I have been working on this for some time and I could really use some help.
In hassio I have created a binary sensor that communicates with a light sensor that can go into "isdark" state if the lux goes below 100.
I then tried add an automation that when "isdark" activates it sends and on state to the EspixelStick and have lights come on. I can get my "isdark" state to on and I can manually turn on lights but can't get lights to trigger from "isdark".
Below is parts of my config.yaml

light:  
#espixelstick subnet 110
  - platform: mqtt
    name: "PixelStick01"
    state_topic: "matrix/esps/light/status"
    command_topic: "matrix/esps/light/switch"
    brightness_state_topic: "matrix/esps/brightness/status"
    brightness_command_topic: "matrix/esps/brightness/set"
    rgb_state_topic: "matrix/esps/rgb/status"
    rgb_command_topic: "matrix/esps/rgb/set"
    brightness: true
    flash: true
    rgb: true
    optimistic: false
    qos: 0
	
	sensor: <<<<<<<<<
#Light sensor
  - platform: mqtt  
    state_topic: "bruh/sensornode1"  
    name: "SN1 LDR"
    ##This sensor is not calibrated to actual LUX. Rather, this a map of the input voltage ranging from 0 - 1023.
    unit_of_measurement: "LUX"  
    value_template: '{{ value_json.ldr }}'  
    
# Binary Sensors
binary_sensor:
  - platform: threshold
    name: isdark
    entity_id: sensor.sn1_ldr
    lower: 100
    hidden: true
	
#Groups
group:  
  sensor_node_1_card:  
    name: Sensor Node 1  
    entities:  
      - sensor.sn1_temperature  
      - sensor.sn1_humidity  
      - sensor.sn1_ldr  
      - light.sn1_led
	
automation:
- alias: EspixelStick110 On       
  trigger:                               
    - platform: state                    
      entity_id: binary_sensor.isdark    
      to: 'on'                           
  condition:                             
    - condition: state                   
      entity_id: binary_sensor.isdark    
      state: 'on'                        
  action:                                
    - service: mqtt.publish              
      data_template:                     
        topic: "matrix/esps"         
        payload: '{"state":"ON"}'
                                                                   
- alias: EspixelStick110 Off                                                         
  trigger:                                                                                  
    - platform: state                                                                       
      entity_id: binary_sensor.isdark                                                       
      to: 'off'                                                                             
  condition:                                                                                
    - condition: state                                                                      
      entity_id: binary_sensor.isdark
      state: 'on'                                                                           
  action:                                                                                   
    - service: mqtt.publish                                                                 
      data_template:                                                                        
        topic: "matrix/esps"                                               
        payload: '{"state":"OFF"}'                         
script: !include scripts.yaml

Any insight would be deeply appriciated

is your sensor: in the correct location ?

i know nothing about hassio , just curious as to why the indent


Reply
tecnageek
Posts: 220
(@tecnageek)
Reputable Member
Joined: 10 years ago

Yes, the indentation is correct. All sensors are working, just not able to get them to talk with the espixelstick.


Reply
tecnageek
Posts: 220
(@tecnageek)
Reputable Member
Joined: 10 years ago

So I was digging around and noticed the “The service dev tool” in Hassio and was able to come up with a working automation.
Now I need to be able to figure out how to send a color, and possibly send different colors based on different environmental variables.

- alias: EspixelStick110 On       
  trigger:                               
    - platform: state                    
      entity_id: binary_sensor.isdark    
      to: 'on'                           
  action:                                
    - service: homeassistant.turn_on                                                                
      entity_id: 
        light.pixelstick110                                                                        

                                                                   
- alias: EspixelStick110 Off                                                         
  trigger:                                                                                  
    - platform: state                                                                       
      entity_id: binary_sensor.isdark                                                       
      to: 'off'                                                                             
  action:                                                                                   
    - service: homeassistant.turn_off                                                                
      entity_id: 
        light.pixelstick110

Reply
ukewarrior
Posts: 4673
(@ukewarrior)
Illustrious Member
Joined: 18 years ago

Can you only have two options?
Why not tell Alexis: "turn lights green" instead of "saying turn lights on"

tecnageek wrote:So I was digging around and noticed the “The service dev tool” in Hassio and was able to come up with a working automation.
Now I need to be able to figure out how to send a color, and possibly send different colors based on different environmental variables.

- alias: EspixelStick110 On       
  trigger:                               
    - platform: state                    
      entity_id: binary_sensor.isdark    
      to: 'on'                           
  action:                                
    - service: homeassistant.turn_on                                                                
      entity_id: 
        light.pixelstick110                                                                        

                                                                   
- alias: EspixelStick110 Off                                                         
  trigger:                                                                                  
    - platform: state                                                                       
      entity_id: binary_sensor.isdark                                                       
      to: 'off'                                                                             
  action:                                                                                   
    - service: homeassistant.turn_off                                                                
      entity_id: 
        light.pixelstick110

Reply
JCook
Posts: 1003
(@jcook)
Noble Member
Joined: 13 years ago

This is an interesting post. I'm setting up home assistant for my house, never thought of connecting to pixel controllers.


Reply
Page 1 / 3
Share: