mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-23 18:56:38 +00:00
v5.12.0n - Change ADS1115 and Counter JSON
5.12.0n * Change ESP8266 Analog JSON message from {"Analog0:123"} to {"ANALOG":{"A0:123"}} to accomodate rules (#2560) * Change Counter JSON message from {"Counter1":0,"Counter3":0} to {"COUNTER":{"C1":0,"C3":0}} to accomodate rules * Change ADS1115 JSON message from {"ADS1115":{"Analog0":123,"Analog1":123}} to {"ADS1115":{"A0":123,"A1":123}}
This commit is contained in:
parent
e1011d3cdd
commit
c835235141
@ -13,7 +13,7 @@ If you like **Sonoff-Tasmota**, give it a star, or fork it and contribute!
|
||||
### Development:
|
||||
[](https://travis-ci.org/arendst/Sonoff-Tasmota)
|
||||
|
||||
Current version is **5.12.0m** - See [sonoff/_releasenotes.ino](https://github.com/arendst/Sonoff-Tasmota/blob/development/sonoff/_releasenotes.ino) for change information.
|
||||
Current version is **5.12.0n** - See [sonoff/_releasenotes.ino](https://github.com/arendst/Sonoff-Tasmota/blob/development/sonoff/_releasenotes.ino) for change information.
|
||||
|
||||
### Quick install
|
||||
Download one of the released binaries from https://github.com/arendst/Sonoff-Tasmota/releases and flash it to your hardware as documented in the wiki.
|
||||
@ -133,7 +133,7 @@ Different firmware images are released based on Features and Sensors selection g
|
||||
|--------------------------------|--------|---------|---------|------|------------|
|
||||
| ESP/Arduino lib v2.3.0 | 526k | 488k | 427k | 535k | 549k |
|
||||
| ESP/Arduino lib v2.4.0 | 531k | 496k | 435k | 540k | 552k |
|
||||
| ESP/Arduino lib v2.4.1 | 533k | 498k | 436k | 542k | 554k |
|
||||
| ESP/Arduino lib v2.4.1 | 534k | 499k | 437k | 543k | 555k |
|
||||
|
||||
### Contribute
|
||||
You can contribute to Sonoff-Tasmota by
|
||||
|
@ -1,4 +1,9 @@
|
||||
/* 5.12.0m
|
||||
/* 5.12.0n
|
||||
* Change ESP8266 Analog JSON message from {"Analog0:123"} to {"ANALOG":{"A0:123"}} to accomodate rules (#2560)
|
||||
* Change Counter JSON message from {"Counter1":0,"Counter3":0} to {"COUNTER":{"C1":0,"C3":0}} to accomodate rules
|
||||
* Change ADS1115 JSON message from {"ADS1115":{"Analog0":123,"Analog1":123}} to {"ADS1115":{"A0":123,"A1":123}}
|
||||
*
|
||||
* 5.12.0m
|
||||
* Reinit timers to accomodate random window (#2447)
|
||||
* Remove sonoff-xxl
|
||||
* Disable sleep when using Esp/Arduino core 2.4.1 (#2559)
|
||||
|
@ -25,7 +25,7 @@
|
||||
- Select IDE Tools - Flash Size: "1M (no SPIFFS)"
|
||||
====================================================*/
|
||||
|
||||
#define VERSION 0x050C000D // 5.12.0m
|
||||
#define VERSION 0x050C000E // 5.12.0n
|
||||
|
||||
// Location specific includes
|
||||
#include <core_version.h> // Arduino_Esp8266 version information (ARDUINO_ESP8266_RELEASE and ARDUINO_ESP8266_RELEASE_2_3_0)
|
||||
|
@ -1396,7 +1396,7 @@ void AdcShow(boolean json)
|
||||
analog >>= 5;
|
||||
|
||||
if (json) {
|
||||
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"" D_JSON_ANALOG_INPUT "0\":%d"), mqtt_data, analog);
|
||||
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"ANALOG\":{\"A0\":%d}"), mqtt_data, analog);
|
||||
#ifdef USE_WEBSERVER
|
||||
} else {
|
||||
snprintf_P(mqtt_data, sizeof(mqtt_data), HTTP_SNS_ANALOG, mqtt_data, "", 0, analog);
|
||||
|
@ -90,9 +90,11 @@ const char HTTP_SNS_COUNTER[] PROGMEM =
|
||||
|
||||
void CounterShow(boolean json)
|
||||
{
|
||||
char stemp[10];
|
||||
char counter[16];
|
||||
|
||||
byte dsxflg = 0;
|
||||
byte header = 0;
|
||||
for (byte i = 0; i < MAX_COUNTERS; i++) {
|
||||
if (pin[GPIO_CNTR1 +i] < 99) {
|
||||
if (bitRead(Settings.pulse_counter_type, i)) {
|
||||
@ -103,7 +105,13 @@ void CounterShow(boolean json)
|
||||
}
|
||||
|
||||
if (json) {
|
||||
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"" D_JSON_COUNTER "%d\":%s"), mqtt_data, i +1, counter);
|
||||
if (!header) {
|
||||
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"COUNTER\":{"), mqtt_data);
|
||||
stemp[0] = '\0';
|
||||
}
|
||||
header++;
|
||||
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s%s\"C%d\":%s"), mqtt_data, stemp, i +1, counter);
|
||||
strcpy(stemp, ",");
|
||||
#ifdef USE_DOMOTICZ
|
||||
if ((0 == tele_period) && (1 == dsxflg)) {
|
||||
DomoticzSensor(DZ_COUNT, RtcSettings.pulse_counter[i]);
|
||||
@ -117,6 +125,11 @@ void CounterShow(boolean json)
|
||||
}
|
||||
}
|
||||
}
|
||||
if (json) {
|
||||
if (header) {
|
||||
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s}"), mqtt_data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*********************************************************************************************\
|
||||
|
@ -190,7 +190,7 @@ void Ads1115Show(boolean json)
|
||||
stemp[0] = '\0';
|
||||
}
|
||||
dsxflg++;
|
||||
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s%s\"" D_JSON_ANALOG_INPUT "%d\":%d"), mqtt_data, stemp, i, adc_value);
|
||||
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s%s\"A%d\":%d"), mqtt_data, stemp, i, adc_value);
|
||||
strcpy(stemp, ",");
|
||||
#ifdef USE_WEBSERVER
|
||||
} else {
|
||||
|
@ -110,7 +110,7 @@ void Ads1115Show(boolean json)
|
||||
stemp[0] = '\0';
|
||||
}
|
||||
dsxflg++;
|
||||
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s%s\"" D_JSON_ANALOG_INPUT "%d\":%d"), mqtt_data, stemp, i, adc_value);
|
||||
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s%s\"A%d\":%d"), mqtt_data, stemp, i, adc_value);
|
||||
strcpy(stemp, ",");
|
||||
#ifdef USE_WEBSERVER
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user