Using entity_id from previous node in "Get template" node

I’m trying to use the entity_id of the previous node in the “Get template” node… sadly it seems I cannot figure it out myself;

I started with a poll-state node followed by a get-template node and want to do something like this:

{{state_attr("{{ENTITY_ID_FROM_PREVIOUS}}",'brightness')}}

obvious this is not gonna work

Anyone can send me in the right direction?

You can use current state node that receives as input msg.entity_id and to extract any attribute from the payload it provides

My problem is; how to get a payload and render it into the HA ‘get template’ node

I have a similar problem.

Its actually simple… like everything when you know :wink:

[{"id":"5a33b7b5.76fc8","type":"template","z":"5be0e0fd.37e1f","name":"Generate HA template","field":"template","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{{=<% %>=}}\n{{state_attr(\"<% topic %>\",'brightness')|int}}","output":"str","x":1120,"y":160,"wires":[["3d1ddd94.82c6f2"]]},{"id":"3d1ddd94.82c6f2","type":"api-render-template","z":"5be0e0fd.37e1f","name":"Get last brightness","server":"70d02634.d2ffd","template":"","resultsLocation":"payload","resultsLocationType":"msg","templateLocation":"template","templateLocationType":"msg","x":1130,"y":220,"wires":[["4ce89664.c5a388"]]},{"id":"70d02634.d2ffd","type":"server","z":"","name":"Home Assistant","legacy":false,"hassio":false,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true}]
1 Like

Sounds good I’ll try tonight. :ok_hand:

Cool this was what I was looking for since some days :slight_smile: