I have a feeling this is already in place but i can’t seem to find it.
I am wanting to have a variable similar to a global variable, but for each individual device. I am wanting to be able to update it using one of the input controls (slider, toggle, etc.) and save the value for use in a workflow. Am I overlooking something or does this not exist?
Thanks!
I’d recommend using Device Tags for that purpose. They are key-value pairs, just like application globals. They are automatically added to the payload if the device triggered the workflow using a Device State Trigger. You can update them using input controls by triggering a workflow and then using the Update Device Node to change the tags.
If you ever need to get a device’s tags in a workflow, you can use the Get Device Node, which does include the device’s tags.
I guess I am using a webhook for the trigger… Should this matter?
Doesn’t matter how it’s being invoked. You’ll just need to use the Get Device Node if you ever need the device-specific configuration.
I got most of this working but found one small issue with tying the tag values to the input controls. I was expecting to be able to specify the tag in the attribute dropdown so that the value would be reflected in the slider. The tag does show up in the Device Id’s/Tabs dropdown but I obviously dont want to filter on that. Is it possible to reflect the device’s tag values within the input controls?
It is not currently possibly to dynamically populate input controls with device tag values. It’s not a bad idea, but not something we’ve considered yet. I’ll make a ticket for the product team to investigate.
Oh ok. Is there anything I can control with the input features? I have a few config values that I would like to expose.
I think you’re definitely in the right direction. You’ve got input controls for:
- Alerts On/Off
- Rotation Tolerance
- Acceleration Tolerance
- Magnetometer Tolerance
All you need is a “Save Configuration” button, which will trigger a workflow with whatever values the user specified.
When you click the button, the specified workflow will be triggered with that payload. You can then use a Update Device Node to change your device’s tag values.