Skip to content

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 use the homeasistant-api. The services can be provided by default or also defined additionally in the YAML. To define the additional services, you need the ID of the ehmtx-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}}'
      text: >-
        {{trigger.to_state.state}}{{trigger.to_state.attributes.unit_of_measurement}}
mode: queued
max: 10

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_*
      mode: 5 (1)
  - service: esphome.pixel_clock_icon_screen
    data:
      icon_name: weather_{{ trigger.to_state.state }}
      text: >-
        {{ states("sensor.outside_temperature") }}°C
  1. See the list of all possible modes and their values

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.ulanzi_del_screen
    data:
      icon_name: trash_*
      mode: 5 (1)
  - service: esphome.ulanzi_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
  1. See the list of all possible modes and their values

Tips

Display sensor precision after Home Assistant 2023.3

See templating for possibilities to optimize the output e.g. {{ states(sensor.solarpower, rounded=True) }} kWh