Function node calculaite payload with entity

I have a function node that calculates my washing machine with cost and send a telegram message

msg.payload.time = Math.round(msg.payload.time / 60);
msg.payload.cost = (msg.payload.energy * 0.352931).toFixed(2);
return msg;

But I want to calculatie the 0.352931 value with a input_number.energy_static_price
where this value is stored.
should be something with this input_number.energy_static_price.state

How can I do this in the function node now I only got NaN as result

msg.payload.time = Math.round(msg.payload.time / 60);
msg.payload.cost = (msg.payload.energy * global.get('homeassistant.homeAssistant.states')['input_number.energy_static_price'].state).toFixed(2);
return msg;
1 Like

Thank you for the quick reply and help. Looking good this