# What is the right or best way?

**URL:** <https://discourse.nodered.org/t/what-is-the-right-or-best-way/69052>\
**Category:** Dashboard\
**Created:** [15 October 2022 00:23 UTC](https://discourse.nodered.org/t/what-is-the-right-or-best-way/69052 "2022-10-15T00:23:48Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![questrov](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/questrov/32/67312_2.png) [@questrov](https://discourse.nodered.org/u/questrov)\
**Post date:** [15 October 2022 00:23 UTC](https://discourse.nodered.org/t/what-is-the-right-or-best-way/69052/1 "2022-10-15T00:23:48Z")

</div>

I've done this several ways (different every time) and basically poke till it works but think not 'the right way'. How should it be done?

In this case we have a sensor spitting out the string `{"speed":0,"direction":301}`

Run it thru a json node and we get  
object  
speed: 8.1  
direction: 180

From there I can split or sort to get a gauge but it feels like that's not the correct solution...

---

<div class="post-metadata">

**Author:** ![questrov](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/questrov/32/67312_2.png) [@questrov](https://discourse.nodered.org/u/questrov)\
**Post date:** [15 October 2022 03:19 UTC](https://discourse.nodered.org/t/what-is-the-right-or-best-way/69052/2 "2022-10-15T03:19:19Z")

</div>

Did the homework, came up with this. Many thanks to previous posts!

Simple (once you figure it out) set the mqtt node output to a parsed JSON object then `{{msg.payload.speed}}` for the value format in gauge.

```auto
[{"id":"bc56177d.74aa18","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"130a5646.78895a","type":"mqtt in","z":"bc56177d.74aa18","name":"","topic":"anemometer/five_second_avg","qos":"2","datatype":"json","broker":"59511bc6.baa294","nl":false,"rap":true,"rh":0,"x":410,"y":540,"wires":[["56bc69f9.f74c58","99ee3a89.6ea428","536d3358.6f2a7c"]]},{"id":"56bc69f9.f74c58","type":"debug","z":"bc56177d.74aa18","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":710,"y":500,"wires":[]},{"id":"99ee3a89.6ea428","type":"ui_gauge","z":"bc56177d.74aa18","name":"Speed","group":"27899de0.e78e22","order":2,"width":0,"height":0,"gtype":"gage","title":"Windspeed","label":"MPH","format":"{{msg.payload.speed}}","min":0,"max":"100","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":690,"y":540,"wires":[]},{"id":"536d3358.6f2a7c","type":"ui_gauge","z":"bc56177d.74aa18","name":"Speed","group":"27899de0.e78e22","order":2,"width":0,"height":0,"gtype":"compass","title":"Windspeed","label":"Degrees","format":"{{msg.payload.direction}}","min":0,"max":"360","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":690,"y":580,"wires":[]},{"id":"59511bc6.baa294","type":"mqtt-broker","name":"","broker":"localhost","port":"1883","clientid":"","usetls":false,"protocolVersion":"3","keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","birthMsg":{},"closeTopic":"","closeQos":"0","closePayload":"","closeMsg":{},"willTopic":"","willQos":"0","willPayload":"","willMsg":{},"sessionExpiry":""},{"id":"27899de0.e78e22","type":"ui_group","name":"Weather","tab":"7d7bbe46.42567","order":3,"disp":true,"width":"6","collapse":false},{"id":"7d7bbe46.42567","type":"ui_tab","name":"Data","icon":"dashboard","disabled":false,"hidden":false}]

```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [29 October 2022 03:20 UTC](https://discourse.nodered.org/t/what-is-the-right-or-best-way/69052/3 "2022-10-29T03:20:06Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
