Hello!
I use latest HA
Home Assistant 2023.8.3 Supervisor 2023.08.1 Operating System 10.4 Frontend-version: 20230802.1 - latest
I make mqtt sensors to pic out values from my Weather Display software (on another computer)
It works good with temperatures value. But if i want values as time and date i got Unknown value.
Hello!
Thx for your answer.
Sorry, it will not work.
Here is the logg from HA:
Logger: homeassistant.helpers.template
Source: helpers/template.py:735
First occurred: 14:10:59 (7 occurrences)
Last logged: 14:12:51
Template variable error: list object has no element 1 when rendering '{{ value.split("\{")[1].split("\}")[0].strip() }}'
It’s useful only if the value you want to extract always has the same length. If the length can vary (for example, a date can vary in length) then you must use a different technique. I suggest something like this:
- name: "WD Next Full Moon"
state_topic: "nextfullmoon"
value_template: "{{ value.replace('WD{ ', '').replace('}', '') }}"
It simply replaces {WD and } with nothing. Therefore it will change this:
Please consider marking my post above with the Solution tag. It will automatically place a check-mark next to the topic’s title which signals to other users that this topic has been resolved. This helps users find answers to similar questions.