I’m having lots of issues passing data from Node-Red to Home Assistant. I’ve tried various Nodes and have not been able to get some of them working at all, and others have major issues. I was creating a text field in NR and pulling it into HA via the companion app, and finding the experience very buggy (there is even a warning about it being in beta). Plus I can only pass in a short text string and not an object (passing in bad data causes corruption that even a restart can’t fix).
So after packing the object into a text string for HA, I use about 55 template sensors hard coded in my configuration.yaml file in a hacky attempt to build a sort of “object” in HA.
In order to make this less hacky, I tried:
- Creating a loop in Jinja2 to iterate through everything, but I can’t find a way to create the virtual template sensors dynamically in the loop. Can’t put Jinja2 in the configuration.yaml unless I hardcode each one and use a “state” key.
- Researching online, people say a better way to pass the data into HA is with MQTT, but I can’t find much on how to do the handling on the HA side to accomplish what I want.
- I know HA supports “scripts”, but not sure how advanced they can get in terms of looping, Python, Jinya2, and creating and handling sensors.
Any other ideas or options?
I’m trying to create an advanced thermostat “app”, that handles multiple rooms and room states.