Replies: 2 comments 2 replies
-
You can also do this with just the events: all and call-service using JSONata to format the string call-service node data field. |
Beta Was this translation helpful? Give feedback.
-
I kept on investigating a bit more. I saw you provide an API node as well and tried to make a "raw" post to the template rest api action.
I use a template node to define the Jinja2 template for Home Assistant. Primarily for readablilty reasons. It is not formatted in Node-RED. So this is proof of concept that variables can be passed along to Home Assistant. I would love to see this addded to your |
Beta Was this translation helpful? Give feedback.
-
I'm trying to use a
render template
to genere a text based on the template and variables I pass along to it. I'm not sure if it should be possible.I assume the input message is / can be passed along to the Home Assistant Websocket or rest api call as variables under the hood.
I see indications in the home assistant core api that variables can be passed along to template api.
https://github.com/home-assistant/core/blob/19c26b79afb08268286c5fdc93d0d00a8c6d52e2/homeassistant/components/api/__init__.py#L441-L457
I have put together a small basic example where a json object with a property named myname is injected into the
render template
. The returned message is not 'Name: Donald Dock' as I had hoped.My end goal is to apply code in Node-Red like the following from the Alarmo project where the trigger.event.data.sensors is used inside the Jinja2 code to generate the message:
Source: https://github.com/nielsfaber/alarmo/tree/main
Beta Was this translation helpful? Give feedback.
All reactions