Home Assistant
Integration in Home Assistant
To control your display, it has to be integrated in Home Assistant. Then it provides several services, all prefixed with the configured devicename e.g. pixel_clock.
Services
All communication with Home Assistant uses the Home Assistant API. Services are provided by default, and you can also define custom services or lambdas in your YAML using the ID of the pixel_clock component (e.g., id(rgb8x32)).
Use in Home Assistant automations
Icon names as trigger ID
The easiest way to use Pixel Clock as a status display is to use the icon names as trigger ID. In my example, I have an icon named wind when the sensor.wind_speed has a new state, this automation sends the new data to the screen with the icon named wind and so on.
Icon names as trigger ID
alias: Pixel Clock - Icons
trigger:
- platform: numeric_state
entity_id: sensor.wind_speed
id: wind
- platform: state
entity_id: sensor.outside_temperature
id: temp
- platform: state
entity_id: sensor.cover_device
id: cover
action:
- service: esphome.pixel_clock_icon_screen
data:
icon_name: '{{trigger.id}}' (1)
text: >-
{{trigger.to_state.state}}{{trigger.to_state.attributes.unit_of_measurement}}
mode: queued
max: 10
- See the list of all possible icons
Specific icons per state
Sample automation to show the weather with local temperature
Weather with icon per condition
alias: Pixel Clock - Weather
trigger:
- platform: state
entity_id: weather.current
action:
- service: esphome.pixel_clock_del_screen
data:
icon_name: weather_* (1)
mode: 5 (2)
- service: esphome.pixel_clock_icon_screen
data:
icon_name: weather_{{ trigger.to_state.state }}
text: >-
{{ states("sensor.outside_temperature") }}°C
Sample automation for the trashcan type
Garbage display
alias: Pixel Clock - Garbage Display
trigger:
- platform: time
at:
- "06:30"
- "08:30"
- "10:30"
- "15:00"
- "17:00"
- "19:00"
condition:
- condition: numeric_state
entity_id: sensor.trash_trigger
below: "3"
action:
- service: esphome.pixel_clock_del_screen
data:
icon_name: trash_* (1)
mode: 5 (2)
- service: esphome.pixel_clock_icon_screen
data:
icon_name: >-
trash_{{ states("sensor.trash_details") | replace("Organic", "brown") | replace("Paper","blue") | replace("Residual waste", "grey") | replace("Yellow bin","yellow") }}
text: >-
{{ states("sensor.trash_details") }}
lifetime: 120
Tips
Delete screen
Use wildcard deletion (*) with del_screen in your Home Assistant automations to clean up and replace dynamic screens (like weather status) without duplicates in the queue.
Display sensor precision after Home Assistant 2023.3
See templating for possibilities to optimize the output e.g. {{ states('sensor.solarpower', rounded=True) }} kWh