## Suggestion: Use the AWTRIX NG `mqtt_prefix` entity instead of `device_topic` I found an issue with the MQTT topic lookup in this blueprint. The current version searches the selected AWTRIX device for an entity containing `device_topic`: ```jinja {{ states((device_entities(device_id) | select('search', 'device_topic') | list)[0]) }} ``` Current AWTRIX NG Home Assistant discovery provides an entity named `mqtt_prefix` instead, for example: ```text sensor.awtrix_kitchen_mqtt_prefix ``` If no legacy `device_topic` entity exists, the resulting list is empty and the automation fails every minute with: ```text UndefinedError: list object has no element 0 ``` The official AWTRIX NG documentation also recommends resolving the device prefix through the `mqtt_prefix` entity: https://blueforcer.github.io/awtrix-ng/guides/home-assistant/#from-a-picked-device-to-its-topic ### Suggested change Replace the existing `devices_topics` variable with this guarded lookup: ```yaml devices_topics: >- {%- set ns = namespace(devices=[]) %} {%- for device_id in device_ids %} {%- set prefix_entities = device_entities(device_id) | select('search', 'mqtt_prefix') | list %} {%- if prefix_entities %} {%- set prefix = states(prefix_entities[0]) | trim %} {%- if prefix not in ['', 'unknown', 'unavailable', 'none'] %} {%- set ns.devices = ns.devices + [prefix ~ '/cmd/apps/pushed/solar_power'] %} {%- endif %} {%- endif %} {%- endfor %} {{ ns.devices }} ``` This preserves support for selecting multiple AWTRIX devices and prevents invalid MQTT publications when a device or its prefix sensor is temporarily unavailable. I tested this change with AWTRIX NG firmware 1.1.0. After reloading the Home Assistant automations, the automation completed successfully and published the expected payload to: ```text awtrix_d12f50/cmd/apps/pushed/solar_power ``` The previous `list object has no element 0` error no longer occurs.
Solar Energy Production (NG)
Use with Home Assistant Blueprint
This Home Assistant Automation blueprint adds the current energy production information to your Awtrix Light - Fixed for AWTRIX NG
- Topic
- Smarthome
- Includes
- Flow · 3 icons
Runs on
- Might run on 32×8 (TC001 & DIY)
- Might run on 52×16 (TC002)
- Does not run on 32×8 with AWTRIX 3 (TC001 & DIY) Made for AWTRIX NG.
? The author has not said which devices it runs on.
Is this your flow?
If you created this flow, open your saved edit link to add it to your account. You can then manage it whenever you sign in. Adding it to your account replaces the edit link.
Flow description
This Home Assistant Automation blueprint adds the current solar energy production information to your Awtrix Light. Updated for AWTRIX NG
The data can be taken from any power sensor that provides this information (e.g. Shelly). You can configure it to not show the information during night or when there is 0 power produced.
Don't forget to install/upload the 3 icons attached to your Awtrix Light to get the full experience.
Updated version of https://flows.blueforcer.de/flow/qRWNOlYn5X4w which itself is an updated version of https://flows.blueforcer.de/flow/YjJZo6m7AyrL
Sign in to view and copy the code of this flow.
These icons are attached to the flow. Send them to your AWTRIX separately; they are not included in the script installation.
8×8 px
8×8 px
8×8 px
Sign in to download these icons or send them to your AWTRIX.
More flows for Home Assistant Blueprint or Smarthome
Something wrong with this flow? Report it.
Have an idea?
Sign in to ask questions and join the conversation.