Repository navigation
|
How do you configure njsPC to listen to an MQTT topic for Air Temp and specify whether the temperature is in C or F? |
Answered by
rstrouse
Aug 1, 2022
Replies: 1 comment 2 replies
|
You can use an MQTT integration and add your own custom bindings. Below assumes that the incoming values are in C and converts them to whatever units you have set on njsPC. It is assuming you have a topic |
2 replies
Answer selected by
orrious
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can use an MQTT integration and add your own custom bindings. Below assumes that the incoming values are in C and converts them to whatever units you have set on njsPC. It is assuming you have a topic
myRoot/temps/airSensorwith a floating point value in degrees C. The topic format can be whatever you like and njsPC will translate it to json. So you could post{"temp":89, "units": "F"}if you like. Then you would replace value with value.temp and value.units respectively. The convert.temperature method will normalize the units for you.