Compare commits
2 Commits
7989a20817
...
5900a8384e
Author | SHA1 | Date | |
---|---|---|---|
5900a8384e | |||
b07b6fde6f |
@ -1,4 +1,4 @@
|
||||
/* ESP 8266 environmental sensor FW
|
||||
/* ESP8266 environmental sensor project
|
||||
*
|
||||
* This firmware provides features to use the NodeMCU ESP12 unit as an environmental sensor.
|
||||
* Currently supported is the DHT22 temperature and humidity sensor.
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* ESP 8266 environmental sensor FW
|
||||
/* ESP8266 environmental sensor project
|
||||
*
|
||||
* This header provides the necessary credentials for the esp_sensor_firmware.ino file.
|
||||
* This header file provides the necessary credentials for the esp_sensor_firmware.ino file.
|
||||
* Before compilation, add your credentials and remove the .example postfix from the filename.
|
||||
* ** WARNING ** DO NOT COMMIT YOUR mqtt_credentials.h FILE CONTAINING YOUR ACTUAL CREDENTIALS.
|
||||
*
|
||||
|
9
scripts/run_broker.sh
Executable file
9
scripts/run_broker.sh
Executable file
@ -0,0 +1,9 @@
|
||||
#!/bin/bash
|
||||
# ESP8266 environmental sensor project
|
||||
#
|
||||
# This script provides an example on how to call the mosquitto_sub MQTT broker to deal with sensor topic MQTT requests.
|
||||
#
|
||||
# (C) 2019 Macrocell - Environmental sensing solutions
|
||||
# proudly presented by Macrocell - FPGA Innovators
|
||||
|
||||
mosquitto_sub -h localhost -v -t sensor
|
31
scripts/simple_subscriber.py
Normal file
31
scripts/simple_subscriber.py
Normal file
@ -0,0 +1,31 @@
|
||||
#!/usr/bin/env python3
|
||||
'''
|
||||
/* ESP8266 environmental sensor project
|
||||
*
|
||||
* This script provides a very simplistic MQTT subscriber that subscribes to any topic of an MQTT broker running on localhost.
|
||||
* It can be used perfectly for debugging sensors with a local broker like mosquitto_sub.
|
||||
*
|
||||
* Developed on and tested with Python 3.5.
|
||||
*
|
||||
* (C) 2019 Macrocell - Environmental sensing solutions
|
||||
* proudly presented by Macrocell - FPGA Innovators
|
||||
*/ '''
|
||||
|
||||
import paho.mqtt.client as mqtt
|
||||
import datetime
|
||||
|
||||
def on_connect(client, userdata, flags, rc):
|
||||
print("Connected with result code " + str(rc))
|
||||
|
||||
client.subscribe("#")
|
||||
|
||||
def on_message(client, userdata, msg):
|
||||
print(str(datetime.datetime.now()) + " : " + msg.topic + " " + str(msg.payload))
|
||||
|
||||
client = mqtt.Client()
|
||||
client.on_connect = on_connect
|
||||
client.on_message = on_message
|
||||
|
||||
client.connect("localhost", 1883, 60)
|
||||
|
||||
client.loop_forever()
|
Loading…
Reference in New Issue
Block a user