Skip to content

Commit d950945

Browse files
author
Matěj Sychra
committed
publishing update
1 parent abd2ef8 commit d950945

File tree

300 files changed

+36999
-335
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

300 files changed

+36999
-335
lines changed

.codacy.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
engines:
2+
rubocop:
3+
enabled: false
4+
duplication:
5+
enabled: true
6+
metrics:
7+
enabled: true
8+
coverage:
9+
enabled: false
10+
exclude_paths:
11+
- lib/ArduinoJson/**
12+
- lib/PubSubClient/**
13+
- lib/WiFiManager/**

.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
.pioenvs/
2+
3+
# developer secret
4+
thinx-firmware-esp8266/Settings.h
5+
./.pioenvs/
6+
.piolibdeps
7+
.clang_complete
8+
.gcc-flags.json

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@ An Arduino/ESP8266 library to wrap client for OTA updates and RTM (Remote Things
66

77
# What's New
88

9+
* Added Relay example with twin WiFi access variants.
10+
* Fixes and improved support for timezones. You can set timezone per device on the [RTM Console](https://rtm.thinx.cloud) and current DST will be applied on checkin, if applicable. It will be also used for the SNTP later.
11+
* HTTPS can be optionally disabled for faster checkins with `THiNX:forceHTTP = true` (speeds up checkin from 120 seconds to 2 seconds)
12+
* SHA-256 and MD5 firmware validation; currently the MD5 only is supported by ESPhttpUpdate (we're working with Arduino Core team on better implementation)
913
* Added setCheckinInterval(long) and setRebootInterval(long) to allow heartbeat and timed restarts (defaults to 24h)
10-
* Added example that combines THiNX with any other UART device (SigFox) for outage reporting with battery backup
11-
* Added possibility to set own status string on check-in
1214

1315
# Usage
1416

@@ -79,8 +81,6 @@ void loop()
7981

8082
6. Configuration Push can be used to inject custom Environment Variables over the network, without need to have them stored anywhere in the code on the device (e.g. WiFi credentials)
8183

82-
7. You can set `thx.thinx_mqtt_url` after initialization in setup() to DNS/IP address of your own broker
83-
8484

8585
### Finalize callback
8686

docs/esp-firmware.pdf

504 KB
Binary file not shown.

examples/basic-all/basic-all.ino renamed to examples/all/all.ino

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
2-
* THiNX Basic Example with all features
3-
*
2+
* THiNX Example with all features
3+
*
44
* - Set your own WiFi credentials for development purposes.
55
* - When THiNX finalizes checkin, update device status over MQTT.
66
* - Use the `Push Configuration` function in website's action menu to trigger pushConfigCallback() [limit 512 bytes so far]
@@ -21,12 +21,12 @@ THiNX thx;
2121

2222
//
2323
// Example of using injected Environment variables to change WiFi login credentials.
24-
//
24+
//
2525

2626
void pushConfigCallback (String config) {
2727

2828
// Set MQTT status (unretained)
29-
thx.publishStatusUnretained("{ \"status\" : \"push configuration received\"}");
29+
thx.publishStatusUnretained("{ \"status\" : \"push configuration received\"}");
3030

3131
// Convert incoming JSON string to Object
3232
DynamicJsonBuffer jsonBuffer(512);
@@ -45,6 +45,7 @@ void pushConfigCallback (String config) {
4545
if ((strlen(ssid) > 2) && (strlen(pass) > 0)) {
4646
WiFi.disconnect();
4747
WiFi.begin(ssid, pass);
48+
ssid = ""; pass = "";
4849
long timeout = millis() + 20000;
4950
Serial.println("Attempting WiFi migration...");
5051
while (WiFi.status() != WL_CONNECTED) {
@@ -74,42 +75,46 @@ void setup() {
7475
//
7576
// Static pre-configuration
7677
//
77-
78+
7879
THiNX::accessPointName = "THiNX-AP";
7980
THiNX::accessPointPassword = "PASSWORD";
8081

8182
//
8283
// Initialization
83-
//
84-
84+
//
85+
86+
//THiNX::accessPointName = "THiNX-AP";
87+
//THiNX::accessPointPassword = "<enter-ap-mode-password>";
88+
THiNX::forceHTTP = true; disable HTTPS to speed-up checkin in development
89+
8590
thx = THiNX(apikey, owner_id);
8691

8792
//
8893
// App and version identification
89-
//
90-
94+
//
95+
9196
// Override versioning with your own app before checkin
9297
thx.thinx_firmware_version = "ESP8266-THiNX-App-1.0.0";
9398
thx.thinx_firmware_version_short = "1.0.0";
9499

95100
//
96101
// Callbacks
97-
//
102+
//
98103

99104
// Called after library gets connected and registered.
100105
thx.setFinalizeCallback([]{
101-
Serial.println("*INO: Finalize callback called.");
102-
thx.publishStatus("STATUS:RETAINED"); // set MQTT status (unretained)
106+
Serial.println("*INO: Finalize callback called.");
107+
thx.publishStatusUnretained("{ \"status\" : \"Hello, world!\" }"); // set MQTT status
103108
});
104109

105110
// Called when new configuration is pushed OTA
106111
thx.setPushConfigCallback(pushConfigCallback);
107112

108113
// Callbacks can be defined inline
109114
thx.setMQTTCallback([](String message) {
110-
Serial.println(message);
115+
Serial.println(message);
111116
});
112-
117+
113118
}
114119

115120
/* Loop must call the thx.loop() in order to pickup MQTT messages and advance the state machine. */

0 commit comments

Comments
 (0)