Hi,
I’m working on a system for car warmup where I enter a time (and a date) when I’d like to start the car into the UI, the system checks weather forecast for that time and selects how long the car should be warmed, and figures out the start and end time when to switch the relay for the plug on/off. As a future enhancement, there might be an estimate shown (based on spot electricity price) of how much the warmup will cost (so that I might choose another mode of transportation if possible, if cost is high).
Now, I have the data worked up into a neat little json package at node red, essentially containing most of the things I’d like to show in the UI (as read-only data):
- The start of the warmup (if weather data is available for that time)
- The end of the warmup
- The forecasted temperature, if available,
- The forecasted weather conditions (if it is snowing, reserve time for car cleanup…)
- The estimated cost for the warmup
But the only way I know how to pass these pieces of data is to create a helper for each. And even then, there is going to be some pain involved, as you can’t make a datetime-helper to be “null” (I get an error when I try to set the timestamp as zero, which doesn’t make much sense to me as that should be a valid timestamp).
What I want - or think I want (for lack of imagination of a better solution) - is to pass a JSON object from Node RED to HA/Loveleace, and use something like this to render the HTML with Jinja2 template: GitHub - PiotrMachowski/Home-Assistant-Lovelace-HTML-Jinja2-Template-card: This card displays provided Jinja2 template as an HTML content of a card. It uses exactly the same engine as Home Assistant in Developer tools.
Is that possible? Is breaking every single piece of data to a helper the only way?