Enjoying the Losant platform. I have a dashboard https://app.losant.com/#/dashboards/58a1d23e50530f0001031a34
As you might see, I am logging volts, milliamps, and temp. I am graphing temp. I would like to graph temp vs watts. How might I multiply the volts x amps and add to the graph? I can do this swiftly in google spreadsheets, but scratching my head with Losant!
Thanks!
Winston
You’ll want to use a workflow to calculate watts and store that value on another attribute on your device. Steps are …
- Create a new attribute on your device(s) called “watts”. The attribute type should be “number”.
- Create a new workflow in the same application as the devices.
- Add a Device Trigger node, which will fire the workflow every time the specified device(s) reports state.
- Connect the trigger to a Conditional node and set the condition to be
{{ data.watts }} === undefined
. (More on why we’re doing this below.)
- Connect the positive output of the Conditional node to a Math node. In here, you can pull milliamps and voltage off your payload and do the calculation to convert that to watts. Then, store the result on your payload at
data.watts
.
- Connect the Math node to a Device State node. Use the ID of the device that reported state (available on the payload) and report the wattage that you calculated in the previous step under your new “watts” attribute on the device.
The reason for the conditional node is that, when we report the device state in our final node, this will cause the workflow to trigger again. We are checking to see if watts
is not on the payload so we can tell the difference between an actual device state report and our calculated report. Without this check, the workflow will throw an “infinite loop” error.
1 Like
Thanks for workin thru that one Dylan.