Help for creating a home assitant sensor from node red

Hi,
I am successfully reading the value from a smart meter using the Modbus add-on but now I need to create a sensor for these values to use them in home assitant. But I am getting this error: HomeAssistantError: expected bool for dictionary value @ data[‘state’].

here are some screen shots:
this is the flow:


this is the function that reads the power from the meter

and these are the setting of the sensor:

You could use a dynamic sensor.

In your function, you are returning a message object that looks like

{
  payload: {
    potenzaAttiva: 3.33
  }
}

and you’re telling NR that the state of the sensor is in payload which itself is an object, not a number. Change the state location in the sensor node to payload.potenzaAttiva

1 Like