" isnt working. It says invalid json. So I have used ‘’. But it says Fehler beim Aufrufen des Service persistent_notification/create. invalid template (TemplateSyntaxError: expected name or number) for dictionary value @ data[‘message’]
call service test
you’re supposed to get that error if you test the automation manually in dev-template or dev-service, since the trigger isnt set in the trigger section of the automation.
that only happens in real life.
Thats why I suggested you take out the trigger templates everywhere in the action part, so we can test if the rest is ok… unless you do that, we can’t help you.
only thing we might check is wether the triggering entity is correct, so maybe show us the sensor in dev-state with a screenshot to see the state and attributes.
The plant sensor publishes every second(for testing) the value after 20 publishes it will go to deep sleep for 40 Minutes. The mqtt sensor is working fine. But I want a good automation: I want one automation for ca. 20 sensors
anything you like really, since it is merely for testing purposes…
replace each {{ trigger.to_state.attributes.friendly_name }} with Higrow sensor
if you do so, the trigger is no longer needed in the action bit, and we can see if the rest is ok
as said, go to dev-state, and show us the sensor
btw, you can also use this template for the sensor itself, you dont need the 3.0, which makes life easier…
With replacing that its working but I have to comment out tag, because I have got this error:
Invalid data for call_service at pos 1: extra keys not allowed @ data[‘tag’]
json: https://hastebin.com/cijulunedi.pl
yes, wondered about that ‘tag’, never had that before…
what were you expecting that to do?
also, what does the conditional template test for. What is ‘nan’, and have you ever seen that happen? iow, could it be this is an incorrect template?
lastly about the triggers:
you might have better luck with {{ trigger.to_state.attributes.name }}, since I dont recall you posting a customization with friendly_name, and it cant be set in the template_sensor itself.
Hey guys! Anyone can help me with this, in latest versions of HA, were made breaking changes in templating, and I get not correctly a this thing: data_template with data, how I can fix it?
action:
service: notify.telegram
data_template:
message: "\U0001F4DE Intercom call {% if is_state('switch.intercom_automatically_open', 'on') or is_state('switch.intercom_automatically_open_once', 'on') %}(auto opens){% endif %}"
data:
inline_keyboard:
- "{{ '0' if is_state('switch.intercom_automatically_open', 'on') or is_state('switch.intercom_automatically_open_once', 'on') else 'Open:/intercom_open, Cancel:/intercom_reject' }}"
Everything worked like a charm, but in the latest versions of HA I ran into a problem:
[13985834342246225824] extra keys not allowed @ data['data_template']
Solved by:
- "{{ '-' if is_state('switch.intercom_automatically_open', 'on') or is_state('switch.intercom_automatically_open_once', 'on') else 'Open:/intercom_open, Cancel:/intercom_reject' }}"