Reading values of variables - Error undefined

Hi,

I am trying to read the value of an input_text from homeassistant. The value my function node is returning is "undefined".

var temp1 = global.get("homeassistant.homeAssistant.states['input_text.temp_1'].state");

var newMsg = { payload: temp1};

return newMsg;

I have tried another method:

var states = global.get('homeassistant.homeAssistant.states');

var temp1 = states["input_text.temp_1"].state;

var newMsg = {payload: temp1};

return newMsg;

However this just gives me this error:
image

Hi

What is in your global context?
if nothing, but you expect there to be, then you may need to seek support from the HA Community.

I have some context there and it reports the state but it is still undefined in the debug menu. Although as you can see in the context menu there is a value.


Now that I typed that message I saw my error. In the function I wrote homeassistant.homeAssistant, but as you can see in the context menu it's homeassistant.hA.

Thanks

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.