It could be nice to have a “tomorrow data not available” as a sensor, because when trying to decide the best period to start an appliance, function gets an error when looking for the best hour for tomorrow if it’s not available. there is surely more ways to handle this, but it would be so easy to control if there is no info for tomorrow if there is a sensor,
thanks!
*thats what i do:
In NodeRed I get values from home assistant this way:
const states = global.get('homeassistant').homeAssistant.states;
var hora = parseInt (states['sensor.pvpc'].attributes.next_best_at[0]) //best hour for today
var hora_minimo = parseInt (states['sensor.pvpc'].attributes.min_price_at) //its price
var hora_minimo_manana = states['sensor.pvpc'].attributes['next_best_at (next day)'][0] //best hour for tomorrow
if next_best_at (next day) doesnt exist, it leads to an error that i can catch and make nodered wait for when this is available. If i just could say “if data for tomorrow is false, just dont check it” it would be easy for me to decide if i want to check for an low price hour for today or tomorrow.
The question is function hangs here, i cant say “if this is undefined”, it just stops. (i could go through catching the error, if it’s difficult to improve this)
thanks!