Pass a BACnet value from Node red to Home assistant

Hello!

I have set up my first home assistant and I am having a blast. But I have some issues regarding passing some value from Node red to Home assistant.

I have a BACnet device I am reading values from in Node red, and I am successfully reading the correct values from my objects. But I am struggling sending them to HA.

I have set up a “sensor” to pass the values to HA. This is how it looks for me right now:

As you can see I want to pass the value marked in yellow to HA, the value is from the debug node.
When I try to pass the value I get an error saying the sensor excepted a boolean value, but my value is a real value (decimal). It seems it is sending the the entire object, not just the value. But I have no idea how to send just the value.

Can anybody help me? :slight_smile:

You can not give the full json like that to HA.

  • I recommend using a mqtt_publish then to send everything to mosquitto broker and configure it in the mqtt section of your configuration.yaml to decode all parts.
  • Or, just use the service input_number.set_value to set an input_number’s value to the yellow part of your payload.

MQTT is probably the most elegant solution as it allows to create a sensor with attributes that will display really nicely in HA.

Have a look at this post:

From the debug output the state would be msg.payload.values.0.value

Ok, I am trying MQTT. I have set up the mosquito broker, and I have set up the MQTT broker integration. I have also set up the MQTT output in Node red, and it says I have connection. But I cannot find this output as an entity in home assistant?

You mean I can use the sensor node I initially used, and configure it to msg.payload.values.0.value?

Also, what is the “service” input_number.set_value, I’m not sure what this is. Sorry, I’m really new to this.

Edit:

Ok, I should add the sensor in the configuration.yaml. I thought it discovered nodes automatically since I had ticked off for discover automatically.
Anyway, I am still struggling to discover the MQTT output node. Should “name” and “topic” be the same as the mqtt output node in node red? I am confused. Also I am getting error that I have set up my configuration.yaml incorrect.

I am not sure if I should add anything in the config file or not, the instructions are a bit unclear to me.

Okay. I figured I scrapped MQTT. I just used a sensor and edited the state in the sensor node to “msg.values.0.value”

Thanks for the help, that was really all I needed. The rest of the information from the BACnet object is irrelevant.