sensor node test setup - neilh10/openeew-firmware GitHub Wiki

Creating a sensor node "openEEW unit test setup" and "openEEW integration test setup"

An "integration test setup" is for testing with live cloud systems, and typically testing should be done before any PR is offered.

Typically while unit testing code, a developer needs an "unit test setup".

To do this, create a private test MQTT broker in some fashion : one example
https://www.digitalocean.com/community/tutorials/how-to-install-and-secure-the-mosquitto-mqtt-messaging-broker-on-ubuntu-18-04

I choose to create it as a local test MQTT on a spare Ubuntu machine I have - easy peasy!

now to test against this I determine its IP# and in the code locate the line and uncomment it with my test MQTT IP#
//#define MQTT_LOCALBROKER "192.168.1.101"
$ ifconfig #gives me the machine as 10.66.66.180

#define MQTT_LOCALBROKER "10.66.66.180"
I also modify the version information to be sure its a new build ....
#define OPENEEW_FIRMWARE_VERSION "1.4.1-nh01"
I build, download it and it works!!!

Connecting a terminal, and plugging in the openEEW to power it

OpenEEW Sensor Application
ESP32 WiFi interface ready
Stored networks : 1
ESP32 WiFi started
Completed scan for access points
WiFi Network scan done
7 network(s) found
1: Arthur2004Sid (-32)*
....
ESP32 WiFi interface ready
Reading stored networks from NVM
ESP32 WiFi started
ESP32 WiFi started
Found network Arthur2004Sid , xxxxxx
LED_LISTEN_WIFI - Blue
LED_LISTEN_WIFI - Blue
LED_LISTEN_WIFI - Blue
LED_LISTEN_WIFI - Blue
ESP32 WiFi connected to AP
ESP32 station got IP from connected AP
Obtained IP address: 10.66.66.110
WiFi was successfully connected
WiFi Connected
WiFi MAC: A8:03:2A:4D:CC:CC
ETH MAC: A8:03:2A:4D:CC:CF
A8032A4DCCCC
ETH Started

Waiting for time
LED_FIRMWARE_DFU - Yellow
.Time sync'd
Mon Apr 12 16:15:54 2021

Contacting the OpenEEW Device Activation Endpoint :
https://device-mgmt.openeew.com/activation?ver=1
Sending Device Activation : {"macaddress":"A8032A4DCCCC","firmware_device":"1.4.1-alpha01"}
HTTP Response code: 200
HTTP post response payload: {"org":"7p7xwk","firmware_latest":"1.4.1","firmware_ota_url":"https://download.openeew.com/firmware-1.4.1.bin"}
OpenEEW Device Activation directs MQTT data from this sensor to :7p7xwk
Invalid semver string
d:7p7xwk:OpenEEW:A8032A4DCCCC
MQTT_USER:use-token-auth MQTT_TOKEN:OpenEEW-sens0r MQTT_DEVICEID:d:7p7xwk:OpenEEW:A8032A4DCCCC
Attempting MQTT connection...LED_CONNECT_CLOUD - Cyan
MQTT Connected
Initializing sensor
Stopping...
Stopped
Range 2g
Low pass filter = 7
High pass filter = 0
Done initializing
Calibrating sensor
Calibrating device with 20 FIFO reads
Fifo read number 1
Retrieved 32 entries
Fifo read number 2