Deep Dive: Polling & JSON
Static buttons are boring. Use Polling to make your interface come alive by fetching data from your devices and updating your buttons in real-time.
How it works
When you enable dynamic titles on an action, Control It sends the request repeatedly at a set interval (e.g., every 2 seconds). It then parses the response to extract a value.
Basic Parsing Modes
- Status Code: Use the HTTP status code (e.g., 200 = Green, 500 = Red).
- Full Response: Display the entire body text on the button.
- JSON Key: Extract a specific value from a JSON response.
- JSON Path: Use complex queries to find data deep within the response.
Mastering JSON Paths
Most modern APIs (Hue, WLED, Home Assistant) return JSON. Control It supports standard dot-notation and array indexing.
Simple Key
JSON: {"brightness": 128}
Path: jsonKey=brightness
Result: 128
Nested Object
JSON: {"state": {"on": true}}
Path: jsonPath=state.on
Result: true
Arrays
JSON: {"lights": ["Red", "Blue"]}
Path: jsonPath=lights[0]
Result: Red
Dynamic Styling
You can change the button's background color based on the parsed value.
Logic Rules
- Numeric:
> 50,< 10,== 100 - Text:
== "Running",contains "Error" - Boolean:
true/false