|
ESP32 MQTT IoT Communication
|
Namespaces | |
| namespace | mqtt_sub |
| Subscribes to mqtt. | |
Functions | |
| tuple[device_writer.DeviceWriter, list[device_writer.SensorWriter]] | mqtt_sub.json_parse_device (dict json_dict) |
| Parses a JSON Dict into a tuple of device and the sensors connected. | |
| device_writer.ReadingsWriter | mqtt_sub.json_parse_reading (dict json_dict) |
| @briefParses a reading JSON object. | |
| list | mqtt_sub.parse_json (dict json_dict) |
| Parses a JSON Dctionary into a list of Objects. | |
| None | mqtt_sub.extract_from_json (dict json_dict, int indent=0) |
| Extracts the data from a JSON Object. | |
| mqtt_client | mqtt_sub.connect_mqtt () |
| Connects a Client to the MQTT broker. | |
| mqtt_sub.subscribe (mqtt_client client, sqlite3.Connection con) | |
| Subscribes to a topic on the MQTT broker. | |
| None | mqtt_sub.main () |
| Connects a client to the broker and subscribes to a given topic. | |
Variables | |
| str | mqtt_sub.BROKER = 'rpi.local' |
| MQTT Broker Ip address. | |
| int | mqtt_sub.PORT = 1883 |
| Port that the broker is running on. | |
| list | mqtt_sub.MQTT_TOPIC = [("esp32/id", 2), ("esp32/walk", 2)] |
| (MQTT topic, QoS level) tuple | |
| str | mqtt_sub.DB_PATH = "db/iot.db" |
| Path to the. | |
| str | mqtt_sub.client_id = f'subscribe-{random.randint(0, 100)}' |
| Generate a Client ID with the subscribe prefix. | |
| dict | mqtt_sub.devices = {} |
| (dev_address, device.Device) MAC address to object dictionary | |
| dict | mqtt_sub.sensors = {} |
| (sensor_address, device.Sensor) Sensor Address to object dictionary | |