If needed, local API can be activated on your access point. After setting up your site, adopting access point and gateway(s) and importing devices, you can start using your local API.
Setting up local API
The local API is based on MQTT. MQTT use a broker to communicate on topics. In order to set up Glamox Connect local API you need to set up your broker, and pass the configuration to Glamox Connect.
After you have set up your broker, go to Settings → Site → Local API to enter the broker details.
This will connect your access point to the provided broker and it will start to listen to defined topics.
Topics
There are basically three different topic categories:
Discovery topic (config)
Topic where Connect can be asked to describe devices that are available. When a request is being made on discovery/search
Connect will respond publishing all devices on topic discovery/<type>/<gateway-id>/<device-id>/config
State topics
As part of payload for discovered device (from discovery topic) is the state topic for the device. When listening to this topic you will receive all updates for this device. The payload on this topic is only the delta, meaning that values that are NOT in the payload have unchanged value.
Let’s say you have a light where the state update is brightness: 100
. The next update is then color_temp: 400
, the brightness is still 100.
Command topics
Device discovery and device types
Devices and entities
Todo: Describing the relation between entity and parent device. That one device can have multiple entities, like a luminaire (light) with one or more sensors.
Schema definition
Todo: Describing all fields for devices
Listening for device updates
Todo: Example payloads
Sending commands
Todo: Example payloads