If I enter this in the payload template, it works.
{{ 'L:/z-128-' + states('weather.forecast_home') + '.png' if not is_state('weather.forecast_home','unavailable') }}
Now I just have to get the if operation formatted correctly, but unfortunately I don’t know how to set the brackets and spaces :-/ How do I get these two things into the payload?
{%- if not is_state('weather.forecast_home','unavailable') %}
Sorry, but I can’t write the templates for you. All I can do is show you snippets from my *.yaml and leave you to work on the finer details. Some of what I post may not work, but should show the basic idea.
{%- if not is_state('weather.forecast_home','unavailable') %}
L:/z-32-{{ state_attr('weather.forecast_home','forecast')[3]['condition'] }}.png
{%- endif %}
For debugging, it helps to open a console and use “telnet [plate IP address]”
See this thread: Extracting values from weather.forecast_home and note post number 9 from pedolsky.
The [3] in my snippet refers to the fourth -condition in the list of weather.forecast_home forecast attributes (it is an array count starting from zero).
I wrote again with the initiator of this cool template for my esp32s3 display and he told me that in the case of
{{‘p2b’ + (repeat.index+5) |string +‘7’}}
a dynamic string is written.
This ultimately results in p2b67 , p2b77 , p2b87 … etc.
where repeat.index is the number of repetitions of the while loop. He added 5 so that it fits my ids. I then have to adapt that to my ids and as soon as I have that, I can probably make the topic dynamic.
I did some research on the net and found the following link:
However, I can’t figure out what my mqtt.publish module needs to look like.
I got one of these today, but reading this thread has me confused. Some posts different displays. Should the instructions in Post#2 be enough to get me started?
----------UPDATE----------
The display attributes are set in the configuration.yaml:
#---------- OpenHASP ----------#
template:
- binary_sensor:
- name: Display settings
unique_id: ba031c34-fe93-42cb-8c0c-ebd44cb8750f # https://www.uuidgenerator.net/
state: "{{ now() - state_attr(this.attributes.update_automation | default('automation.update_display_data'), 'last_triggered') > timedelta(seconds=this.attributes.update_time | default(120) |int ) }}" # change the default automation entity_id from step 3 before
delay_on:
seconds: 2
attributes:
update_automation: "automation.update_display_data"
update_time: "80" # sending the config via mqtt needs some time to complete. This stops the automation from re.run before sending config is finished
display_w: "480"
display_h: "480"
grid_cols: "12" # increase for more resolution of object
grid_rows: "12" # increase for more resolution of object
grid_gutter: "8" # This looked nice for me
grid_margin: "4" # This looked nice for me
bg_color: "#000000" #Black
primary_color: "#4193d5" #Moderate Blue
secondary_color: "#ee9f52" #Soft orange
accent_color: "#A175C4" #Slightly desaturated violet
success_color: "#6cbe58" #Moderate lime green
warning_color: "#d67430" #Strong orange
error_color: "#e25628" #Bright red
radius: "4"
Thanks for the tip.
I used the example in the openHASP Custom Component, substituting my entities. And since this is the only plate, I kept the name as “plate”.
But I think the non-responsiveness of the button is because MQTT is not connecting? Running MQTT Explorer, I don’t see any MQTT traffic to or from the plate.
*My MQTT broker predates my use of Home Assistant by more than a year. A number of my MQTT devices have the broker IP hard-coded and it is easier to just keep the broker where it is instead of using the integrated broker. Which would require a lot of re-flashing.