2020-12-13 15:20:24 +01:00
Infostripe
==========
.. seo ::
:description: Simple visualisation of Home Assistant states using a Neopixel stripe
2021-11-16 03:19:33 +01:00
:image: /cookbook/images/infostrip-detail.jpg
2020-12-13 15:20:24 +01:00
:keywords: Neopixel
Showing the current status of sensor states using a Neopixel (WS2812B) strip is a simple way to communicate states to the user.
Compared to a dashboard screen the infostrip can only communicate the information like a binary sensor.
2021-07-22 23:38:38 +02:00
- color (e.g., red = error/warning, orange = warning, green = ok, blue = active)
2020-12-13 15:20:24 +01:00
- intensity (off, scaled brightness)
2021-01-11 17:46:37 +01:00
- mode (continuous vs. flashing, flashing or strobe is not recommend)
2020-12-13 15:20:24 +01:00
- light position on stripe
.. figure :: images/infostrip-detail.jpg
:align: center
:width: 75.0%
Wemos D1 mini, Neopixel, CO2 sensor on a blackboard, pixel meanings are described by the chalk drawn icons.
ESPHome configuration
---------------------
.. code-block :: yaml
uart:
2024-05-07 07:40:12 +02:00
rx_pin: GPIOXX
tx_pin: GPIOXX
2022-02-10 23:10:43 +01:00
baud_rate: 9600
2020-12-13 15:20:24 +01:00
sensor:
- platform: mhz19
co2:
name: "MH-Z19 CO2 Value"
temperature:
name: "MH-Z19 Temperature"
update_interval: 30s
2022-02-10 23:10:43 +01:00
# Monitor the Wifi connection status
2020-12-13 15:20:24 +01:00
binary_sensor:
- platform: status
name: "Infostrip Status"
# Configure each pixel as a single light (attention memory consuming)
light:
- platform: fastled_clockless
2022-02-10 23:10:43 +01:00
chipset: WS2812B
2020-12-13 15:20:24 +01:00
id: light_fastled
2024-05-07 07:40:12 +02:00
pin: GPIOXX
2020-12-13 15:20:24 +01:00
num_leds: 4
rgb_order: GRB
2022-02-10 23:10:43 +01:00
name: "Infostrip"
2020-12-13 15:20:24 +01:00
effects:
- strobe:
- random:
- platform: partition
name: "PL0"
segments:
- id: light_fastled
from: 0
to: 0
effects:
- strobe:
- platform: partition
name: "PL1"
segments:
- id: light_fastled
from: 1
to: 1
effects:
- strobe:
- platform: partition
name: "PL2"
segments:
- id: light_fastled
from: 2
to: 2
effects:
- strobe:
- platform: partition
name: "PL3"
segments:
- id: light_fastled
from: 3
to: 3
effects:
- strobe:
2022-02-10 23:10:43 +01:00
2020-12-13 15:20:24 +01:00
.. warning ::
2022-02-10 23:10:43 +01:00
Consider the warning in :doc: `/components/light/partition` regarging the increased memory usage.
2020-12-13 15:20:24 +01:00
Home Assistant configuration
----------------------------
The automation to show the CO2 warning light (e.g. red if CO2 > 1000 ppm) is done in Home Assistant, but could also be implemented using ESPHome :ref: `Automations <automation>` .
.. code-block :: yaml
# Turn on a light with the related color
automation:
- id: '1601241280015'
alias: Light CO2 On
description: ''
trigger:
- platform: numeric_state
entity_id: sensor.mh_z19_co2_value
above: 1000
condition: []
action:
2024-08-01 12:38:39 +02:00
- action: light.turn_on
2020-12-13 15:20:24 +01:00
data:
color_name: red
entity_id: light.pl2
mode: single
- id: '1601241280016'
alias: Light CO2 Off
description: ''
trigger:
- platform: numeric_state
entity_id: sensor.mh_z19_co2_value
below: 800
condition: []
action:
2024-08-01 12:38:39 +02:00
- action: light.turn_off
2020-12-13 15:20:24 +01:00
entity_id: light.pl2
mode: single
- alias: "State Light Mapping"
trigger:
platform: time_pattern
# You can also match on interval. This will match every 5 minutes
minutes: "/5"
action:
2024-08-01 12:38:39 +02:00
- action: light.turn_on
2020-12-13 15:20:24 +01:00
data_template:
entity_id: light.pl1
brightness_pct: 30
color_name: >
{% set map = {'on': 'green', 'off': 'red'} %}
{% set state = states('binary_sensor.bad_status') %}
{{ map[state] if state in map else 'white' }}
.. figure :: images/infostrip-lights-ui.png
:align: center
:width: 50.0%
Each pixel is used as a light entity.
See Also
--------
- :doc: `/components/light/fastled`
- :doc: `/components/light/partition`
- :doc: `/components/sensor/mhz19`
- :ghedit: `Edit`