My application uses MQTT to subscribe to events topic. However, to change the device config, I need to use HTTP POST request here:
the end-to-end example provided (https://cloud.google.com/iot/docs/samples/end-to-end-sample) also use HTTP post request for this purpose. But for me, having MQTT for subscribing and HTTP for changing config seems inefficient.
Is there anyway to change device config using MQTT?
As described in the docs, you can subscribe to the MQTT topic, /devices/{device-id}/config
to receive configuration updates.
When you first connect to MQTT, the last published configuration will be sent to the device. Subsequent configuration changes will be published to that topic.
If you want to make a configuration change on another device (Device B) using a message from your device (Device A), you will need to make an API call to the device manager to update Device B. To make this API call, you can trigger it from Device A by using a Google Cloud Function on your Cloud back-end that is triggered from Pub/Sub or DataFlow.
Update There is now a community tutorial explaining how to do this.