Pre-installed application - receiving control commands from the ALSO IoT Platform via MQTT

MQTT messages from the ALSO IoT Platform can be used to change the running direction of the counter (see here) or set the counter value itself. In addition, every received command from the ALSO IoT Platform will trigger a transmission of the values to have instant updates when something is changed.

Controlling of the running direction

The running direction is defined by the flag flag4 - Counter_Direction. If the flag has the value 1, the counter will be increased each second by 1; if the flag has the value 0, the counter is stopped; if the flag has the value -1, the counter will be decreased each second by 1.

An MQTT message from the ALSO IoT Platform is used to set the value of the flag.

The MQTT broker of the ALSO IoT Platform is configured here.

Moreover, an event has been added that subscribes to a certain topic. The placeholder YOUR_DEVICE_ID between the two dashes in the topic must be replaced by the individual Device ID copied from the ALSO IoT Platform. If messages are sent for this topic, the flag flag4 - Counter_Direction will set to the value contained in the payload.

Menu Events → edit Cloud_RX_Counter_Direction_Change ()

en app control mqtt event 1

The following command from the ALSO IoT Platform creates a payload that looks like {"at":"2020-08-24T09:59:18.123544Z","value":0,"meta":null} and the flag will be set to the value between "value": and , (comma).

also send command

Setting the counter value

The counter setting is defined by the flag flag3 - Counter.

An MQTT message from the ALSO IoT Platform is used to set the value of the flag.

The MQTT broker of the ALSO IoT Platform is configured here.

Moreover, an event has been added that subscribes to a certain topic. The placeholder YOUR_DEVICE_ID between the two dashes in the topic must be replaced by the individual Device ID copied from the ALSO IoT Platform. If messages are sent for this topic, the flag flag3 - Counter will set to the value contained in the payload.

Menu Events → edit Cloud_RX_Counter_Value_Change ()

en app control mqtt event 2

The following command from the ALSO IoT Platform creates a payload that looks like {"at":"2020-08-24T09:59:18.123544Z","value":123,"meta":null} and the flag will be set to the value between "value": and , (comma).

also send command 2

Configuration of the message trigger

An MQTT message from the ALSO IoT Platform is used to trigger the message dispatch. The MQTT message is been defined here.

The MQTT broker of the ALSO IoT Platform is configured here.

An event has been added that subscribes to a certain topic. The placeholder YOUR_DEVICE_ID between the two dashes in the topic must be replaced by the individual Device ID copied from the ALSO IoT Platform. The wildcard + in the topic permits that the event is triggered by each command sent to this device (the device is identified by the Device ID). If messages are sent for this topic, the message mqttMsg1 - Push_Values will be sent.

en app control mqtt event 3