How to copy values of temp/humidity back to HE

I’m trying to find a way to copy the value of a temperature sensor connected to CC, back to a virtual temperature sensor on HE. I can then display this on my HE dashboard.
The value from the device is a ‘number’.
In the HE device it requires an input in the “Arguments” field.
I’ve had a play with various things but cannot for the life of me figure out how to do it.
Any thoughts folks? :thinking:
Here’s a screenshot.
image

Just for information, for my HUE strips, in the field shown I can put in the following to set the colour so I assume something could be input to set the temperature value.
image

try
{"value" : 1}
or
{"temperature":1}
replacing 1 with your value

Thanks for the reply.
The problem I’m having is getting the actual dynamic temp reading.
I’ve tried to use a global but I’m not sure of the syntax to use to get the global variable/temp sensor reading as a value into the argument field.
TBH I’m not sure it is even doable but thought I would ask.

You created the virtual sensor via “add device” on the Devices page, right?

Yes. I have a virtual temp sensor defined on HE. I then want to copy the temperature of a temp sensor connected to CC, to it. I will then put this on one of my HE dashboards.

Delete the device you’ve created that way.

There are a LOT of things about the following operations that just don’t make sense, appear as you’d expect, behave as you’d expect. Just follow my example for now and, hopefully, you’ll be able to add more devices on your own later.

If you don’t already have it, install the MQTT app on your HE. When you open that app you’ll see

After you’ve done the Broker setup you want to create a Virtual Temperature sensor within the MQTT app by first clicking on Virtual Devices and then the button(?) that appears below it.

image

Select Virtual Temperature Sensor for the Device Type and then put your desired device name on the bottom line where it says Click to set (I used “mySensor”). When you click anywhere away from that line the dialog will change to show a Create… button.

image

When you click on that button the dialog will go back to looking blank. Now click on the MQTT enabled… button and you’ll see your new device in the list.

image

Click the checkbox and then the Update button and then the Edit this Virtual… button and select your device then click the Update button.

image

The dialog will now allow you to enter the MQTT topic you wish to write to.

image

You can literally use any topic you want but I highly encourage you to create a new top-level MQTT topic (I use HEvirtual) and put this, and future, devices created within the MQTT app under it. Here is my top-level topics as viewed in MQTT Explorer.

image

NOTE: That line already has a space character on it and you want to remove it lest your new topic get created as though it’s a new broker rather than a new topic!

So in my case I’d put “HEvirtual/mySensor” on the line

image

Now click the Next button and you’ll wind up back on the main dialog where you now click Done.

When you again see the Apps page you’re done adding the device. You won’t see the topic in MQTT Explorer yet because it’s not been written to but the new device is listening for it.

If you go to HE’s Devices page you’ll see your new device and clicking on it shows the usual device page

Notice the Device Network id tells you that it’s an MQTT virtual device.

You can now write to the topic HEvirtual/mySensor with any tool that writes to your broker, such as an MQTT Out node in node-red or in MQTT Explorer like this

image

And the value will show up in your new virtual device which you can add to your dashboard.

Notice that I’ve selected “raw” in MQTT Explorer’s Publish section. After entering whatever value you wish just click the PUBLISH button and you’ll see it show up on your HE device page as well as a new topic in MQTT Explorer.

1 Like

Hi @LosinIt
Thanks so much for these concise instructions.
The only thing is… … …which user app are you referring to.
There isn’t a built in one and when I did a search a few different ones came up.
It would be good to install the one you are referring to.
Thanks again.

You need both the app and the client driver from here

1 Like

I’ve installed the driver and app ok.
Can define a device OK but when I try and install the app it just sits there and doesn’t install.
Maybe I’ll try one of the other apps.

EDIT: Just tried to install another app and this froze as well. Something funny is afoot me feels.
Reboot time…
EDIT2: We’re off and running…

Hhhmmm.
I’m not seeing anything like your screenshots.
I’ll keep playing.

Jut to get this straight in my own head, am I right in thinking HE, using an app, is listening to updates posted to MQTT? Then storing the results in virtual devices on HE?

Why not post a screenshot of what you are seeing?

Yes, exactly

1 Like

Would MQTT not offer more options for other integration though? Rather than a specific call to HE? Not to say it is not a valid solution…

Yes, it does.

Not only that, I just learned that none of the HE nodes work as I described so I deleted that post.

1 Like

Hi @LosinIt
Well I managed to get the correct app/driver installed. I can be a right dingbat at times. :slight_smile:
Any way. I configured the broker (which I assume is my CC ip address) but when I define a device and select it, when clicking the update button it errors out.
Error: Cannot invoke method publishMsg() on null object
The logs are showing -
java.lang.NullPointerException: Cannot invoke method publishMsg() on null object on line 1298 (method vMQTT)

EDIT: Scanning the logs it looks like it is not defining the mqtt broker. I must have something wrong there.

You need to configure a change node to set “msg.arguments” then send it to you HE virtual device node.

I used these all the time to average multiple devices into a virtual (the limit to 1 decimal is helpful for dashes as well if needed)

my KISS solution

Sequence
[{"id":"6d2ec1702d148947","type":"hubitat command","z":"fbdec6ec92001a87","deviceLabel":"VD - Multi","name":"","server":"e03140c5.bed32","deviceId":"657","command":"setTemperature","commandArgs":"","x":1300,"y":2800,"wires":[["51803d162128ba0a"]]},{"id":"365fe5e94a6dbe94","type":"change","z":"fbdec6ec92001a87","name":"limit decimal to 1 digit","rules":[{"t":"set","p":"payload","pt":"msg","to":"$round(payload, 1)","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":920,"y":2800,"wires":[["50d5b53d6b0dcde8"]]},{"id":"50d5b53d6b0dcde8","type":"change","z":"fbdec6ec92001a87","name":"","rules":[{"t":"set","p":"arguments","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1130,"y":2800,"wires":[["6d2ec1702d148947"]]},{"id":"3382288ed73d99ad","type":"inject","z":"fbdec6ec92001a87","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"32","payloadType":"num","x":710,"y":2800,"wires":[["365fe5e94a6dbe94"]]},{"id":"51803d162128ba0a","type":"debug","z":"fbdec6ec92001a87","name":"debug 6","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1440,"y":2800,"wires":[]},{"id":"e03140c5.bed32","type":"hubitat config","name":"Zwave Plus Hub","usetls":false,"host":"10.20.1.23","port":"80","appId":"43","nodeRedServer":"http://10.13.9.136:1880","webhookPath":"/hubitat/webhook___","autoRefresh":true,"useWebsocket":false,"colorEnabled":false,"color":"#000000"}]

Complete example with function node for averages and global NR variable

Sequence
[{"id":"57e74d57d98c96a2","type":"hubitat device","z":"fbdec6ec92001a87","deviceLabel":"","name":"Porch - Multi Sensor ","server":"b1088aaa.95e9e8","deviceId":"187","attribute":"illuminance","sendEvent":true,"x":940,"y":2960,"wires":[["62c13504b5cb9767"]]},{"id":"83d10fdc30260382","type":"change","z":"fbdec6ec92001a87","name":"set currentLux","rules":[{"t":"set","p":"currentLux","pt":"global","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1220,"y":3080,"wires":[["f550640f9405901b"]]},{"id":"f550640f9405901b","type":"change","z":"fbdec6ec92001a87","name":"global.currentLux","rules":[{"t":"set","p":"payload","pt":"msg","to":"currentLux","tot":"global"}],"action":"","property":"","from":"","to":"","reg":false,"x":1410,"y":3080,"wires":[["1d3228df638f5519"]]},{"id":"1d3228df638f5519","type":"debug","z":"fbdec6ec92001a87","name":"Global Lux","active":true,"tosidebar":false,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":1630,"y":3080,"wires":[]},{"id":"b989b91f6ce0949c","type":"hubitat device","z":"fbdec6ec92001a87","deviceLabel":"","name":"Hue Outdoor Multi","server":"c0da6dea.8576a","deviceId":"1195","attribute":"illuminance","sendEvent":true,"x":930,"y":3020,"wires":[["62c13504b5cb9767"]]},{"id":"fc9af16b02f8bf8c","type":"hubitat device","z":"fbdec6ec92001a87","deviceLabel":"","name":"Back walkway Multi","server":"b1088aaa.95e9e8","deviceId":"559","attribute":"illuminance","sendEvent":true,"x":930,"y":3080,"wires":[["62c13504b5cb9767"]]},{"id":"62c13504b5cb9767","type":"function","z":"fbdec6ec92001a87","name":"Average","func":"if (msg.payload.deviceId == \"187\") context.set('187',msg.payload.value);\nif (msg.payload.deviceId == \"1195\") context.set('1195',msg.payload.value);\nif (msg.payload.deviceId == \"559\") context.set('559',msg.payload.value);\nmsg.payload.average = ((context.get('187') + context.get('1195') + context.get('559')) / 3 );\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1200,"y":2980,"wires":[["4a149a609c566a5f"]]},{"id":"33dc7adc77b288fe","type":"change","z":"fbdec6ec92001a87","name":"limit decimal to 1 digit","rules":[{"t":"set","p":"payload","pt":"msg","to":"$round(payload, 1)","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":1240,"y":3020,"wires":[["bbc29f6eced8db51"]]},{"id":"bbc29f6eced8db51","type":"change","z":"fbdec6ec92001a87","name":"","rules":[{"t":"set","p":"arguments","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1450,"y":3020,"wires":[["6d2ec1702d148947"]]},{"id":"4a149a609c566a5f","type":"change","z":"fbdec6ec92001a87","name":"set payload","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.average","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1410,"y":2980,"wires":[["33dc7adc77b288fe"]]},{"id":"a5e52c88bbebabfb","type":"inject","z":"fbdec6ec92001a87","name":"Set Lux","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":true,"onceDelay":"10","topic":"","payload":"","payloadType":"date","x":720,"y":3020,"wires":[["fc9af16b02f8bf8c","b989b91f6ce0949c","57e74d57d98c96a2"]]},{"id":"6d2ec1702d148947","type":"hubitat command","z":"fbdec6ec92001a87","deviceLabel":"VD - Multi","name":"","server":"e03140c5.bed32","deviceId":"657","command":"setTemperature","commandArgs":"","x":1620,"y":3020,"wires":[["83d10fdc30260382"]]},{"id":"c0da6dea.8576a","type":"hubitat config","name":"ZigBee Hub","usetls":false,"host":"10.20.1.21","port":"80","appId":"2532","nodeRedServer":"http://10.13.9.29:1880","webhookPath":"/hubitat/webhook__","autoRefresh":true,"useWebsocket":false,"colorEnabled":false,"color":"#000000"},{"id":"e03140c5.bed32","type":"hubitat config","name":"Zwave Plus Hub","usetls":false,"host":"10.20.1.23","port":"80","appId":"43","nodeRedServer":"http://10.13.9.136:1880","webhookPath":"/hubitat/webhook___","autoRefresh":true,"useWebsocket":false,"colorEnabled":false,"color":"#000000"}]

Similar setup using HA nodes and moving average node (Now I see I need to add the decimal limit here too).

Sequence
[{"id":"3345b8603fd681f3","type":"hubitat device","z":"fbdec6ec92001a87","g":"ecd8fcca1f6052dc","deviceLabel":"Porch - Multi Sensor ","name":"","server":"e03140c5.bed32","deviceId":"187","attribute":"temperature","sendEvent":false,"x":560,"y":200,"wires":[["be545ef4e7733f4d"]]},{"id":"dcc96ecccbcba321","type":"inject","z":"fbdec6ec92001a87","g":"ecd8fcca1f6052dc","name":"Every 1 Min","props":[{"p":"payload"}],"repeat":"60","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":330,"y":140,"wires":[["4ea9de2b8cec1d5c","a5e9d93eb58d0dc1","3345b8603fd681f3"]]},{"id":"be545ef4e7733f4d","type":"change","z":"fbdec6ec92001a87","g":"ecd8fcca1f6052dc","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.value","tot":"msg"},{"t":"delete","p":"topic","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":760,"y":200,"wires":[["a7bdd0660ee0646b"]]},{"id":"4ea9de2b8cec1d5c","type":"api-current-state","z":"fbdec6ec92001a87","g":"ecd8fcca1f6052dc","name":"Front Door Temp","server":"1e8aa73b.d1f5b9","version":3,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"sensor.front_door_contact_temperature","state_type":"num","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":550,"y":80,"wires":[["a7bdd0660ee0646b"]]},{"id":"a5e9d93eb58d0dc1","type":"api-current-state","z":"fbdec6ec92001a87","g":"ecd8fcca1f6052dc","name":"Package Box Temp","server":"1e8aa73b.d1f5b9","version":3,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"sensor.package_box_motion_temperature","state_type":"num","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":550,"y":140,"wires":[["a7bdd0660ee0646b"]]},{"id":"a7bdd0660ee0646b","type":"moving-average","z":"fbdec6ec92001a87","g":"ecd8fcca1f6052dc","name":"","amount":"3","weight":"cumulative","x":830,"y":120,"wires":[["80f2749bb4b138bf"]]},{"id":"80f2749bb4b138bf","type":"api-call-service","z":"fbdec6ec92001a87","g":"ecd8fcca1f6052dc","name":"set","server":"1e8aa73b.d1f5b9","version":5,"debugenabled":false,"domain":"virtual","service":"set","areaId":[],"deviceId":[],"entityId":["sensor.virtual_outside_temps"],"data":"{\"value\":payload}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1030,"y":120,"wires":[["711f66ecd415e6dd"]]},{"id":"711f66ecd415e6dd","type":"api-current-state","z":"fbdec6ec92001a87","g":"ecd8fcca1f6052dc","name":"Outside Temps","server":"1e8aa73b.d1f5b9","version":3,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"sensor.virtual_outside_temps","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":1260,"y":120,"wires":[["341a9876662a6b54"]]},{"id":"341a9876662a6b54","type":"change","z":"fbdec6ec92001a87","g":"ecd8fcca1f6052dc","name":"set currentOutsideTemp","rules":[{"t":"set","p":"currentOutsideTemp","pt":"global","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1470,"y":120,"wires":[["d99d3e319d69e5bc"]]},{"id":"d99d3e319d69e5bc","type":"change","z":"fbdec6ec92001a87","g":"ecd8fcca1f6052dc","name":"global.currentOutsideTemp","rules":[{"t":"set","p":"payload","pt":"msg","to":"currentOutsideTemp","tot":"global"}],"action":"","property":"","from":"","to":"","reg":false,"x":1740,"y":120,"wires":[[]]},{"id":"e03140c5.bed32","type":"hubitat config","name":"Zwave Plus Hub","usetls":false,"host":"10.20.1.23","port":"80","appId":"43","nodeRedServer":"http://10.13.9.136:1880","webhookPath":"/hubitat/webhook___","autoRefresh":true,"useWebsocket":false,"colorEnabled":false,"color":"#000000"},{"id":"1e8aa73b.d1f5b9","type":"server","name":"Home Assistant","version":4,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":"30","areaSelector":"friendlyName","deviceSelector":"friendlyName","entitySelector":"friendlyName","statusSeparator":"at: ","statusYear":"hidden","statusMonth":"short","statusDay":"numeric","statusHourCycle":"h23","statusTimeFormat":"h:m"}]
1 Like

Thanks @TechMedX
This is exactly what I am after. Spot on.
:+1: