Display Node-Red value in HA front screen

Hi all.

I measure several temps in HA and use them in node-red for various functions and generate an average temp value. I store this an a global variable.

I would like to display this in HAin a badge for the states menu or a guage in the Lovelace.

I have been playing with using an Input number but have been having an issue trying to set that value using a call service node. I have something wrong with it if it should work as I cant get it right.

So if the above method is the only way to do it could someone give me an example or if there is a better way I would like to see that please.

I was also thinking mqtt but would love to see other options

Thanks heaps

The options you mentioned are the ones I generally use. If number doesn’t work for you try input_text. You can convert it to a float or int in jinja using the template sensor.

I use an MQTT sensor in HA, and just publish the value on the topic on node-red.

I’m using the HA API to create a new entity. In Node-RED, I use a call service node using HTTP and do a POST. No need to set this up ahead of time; the POST will create the entity. In my case, I’m setting the value of my electric meter so that I can display it in Lovelace.

Hope this helps.

[
    {
        "id": "384e8af8.335286",
        "type": "ha-api",
        "z": "7765c2a1.8ef4ac",
        "name": "Update Electric Demand",
        "server": "d83da4b3.5bea38",
        "protocol": "http",
        "method": "post",
        "path": "/states/sensor.electric_demand",
        "data": "{\"state\":\"{{payload}}\",\"attributes\":{\"icon\":\"mdi:flash\",\"unit_of_measurement\":\"kWh\",\"friendly_name\":\"Electric Demand\"}}",
        "location": "payload",
        "locationType": "msg",
        "responseType": "json",
        "x": 610,
        "y": 260,
        "wires": [
            []
        ]
    },
    {
        "id": "d83da4b3.5bea38",
        "type": "server",
        "z": "",
        "name": "Home Assistant"
    }
]

Thanks everyone. I will have a tinker when I get home from work

I ended up installing a mqtt broker on my linux server to get my camera info into HA so used mqtt and a node to inject the info I needed. It seems to work really well. Thanks for the help