Waziup / WaziGate

Waziup LoRa Edge gateway
21 stars 20 forks source link

Actuation prototype #51

Open cdupont opened 4 years ago

cdupont commented 4 years ago

This is for discussing the actuation implementation at the WaziGate level. As a first approach, the User will create the actuator himself on the Cloud. This will create the following data structure in the Cloud (e.g. for a boolean actuator):

{
  "actuator_value_type": "bool",
  "value": true,
  "actuator_kind": "Buzzer",
  "name": "My buzzer",
  "id": "Act1"
}

The gateway is subscribed on MQTT under the device topic, so it should receive the actuation updates:

/devices/XXX/actuators/YYY/value

Once triggering the Cloud actuator, an update should arrive on the Gateway MQTT subscription. The gateway will then broadcast a LoRa message with this form:

“\&UID/<device_id>/<actuator_id>/<actuator_value>”

For instance: \&UID/MyDevice/Act1/25.

From the WaziDev side, I think receiveAll function from the SX1272 library should work: https://github.com/CongducPham/LowCostLoRaGw/blob/master/Arduino/libraries/SX1272/src/SX1272.h#L892 Used for instance here: https://github.com/CongducPham/LowCostLoRaGw/blob/master/Arduino/Arduino_LoRa_Gateway_1_4/Arduino_LoRa_Gateway_1_4.ino#L954

cdupont commented 4 years ago

@mojtaba-esk @j-forster Any comments?

cdupont commented 4 years ago

In order to declare an actuator, the WaziDev needs to send LoRa frames with the IDs of the actuators it possesses. This will allow the gateway and the Cloud to "create" the actuator in the databases, and later to perform actuation. The LoRa frame for actuator declaration (upstream like sensors) could be something like: "#UID/MyDevice/Act1"