mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-25 11:46:31 +00:00
Add support for AS3935 Lightning Sensor
Add support for AS3935 Lightning Sensor by device111 (#8130)
This commit is contained in:
parent
9aa0f27e6c
commit
45e9408b73
@ -75,12 +75,14 @@ The following binary downloads have been compiled with ESP8266/Arduino library c
|
|||||||
- Add command ``Sensor10 31..254`` to control BH1750 measurement time which defaults to 69 (#8016)
|
- Add command ``Sensor10 31..254`` to control BH1750 measurement time which defaults to 69 (#8016)
|
||||||
- Add command ``DevGroupName`` to specify up to four Device Group Names (#8087)
|
- Add command ``DevGroupName`` to specify up to four Device Group Names (#8087)
|
||||||
- Add command ``DevGroupSend`` to send an update to a Device Group (#8093)
|
- Add command ``DevGroupSend`` to send an update to a Device Group (#8093)
|
||||||
|
- Add command ``Ping`` (#7176)
|
||||||
- Add support for unreachable (unplugged) Zigbee devices in Philips Hue emulation and Alexa
|
- Add support for unreachable (unplugged) Zigbee devices in Philips Hue emulation and Alexa
|
||||||
- Add support for 64x48 SSD1306 OLED (#6740)
|
- Add support for 64x48 SSD1306 OLED (#6740)
|
||||||
- Add support for Seven Segment display using HT16K33 (#8116)
|
- Add support for Seven Segment display using HT16K33 (#8116)
|
||||||
- Add support for up to four MQTT GroupTopics (#8014)
|
- Add support for up to four MQTT GroupTopics (#8014)
|
||||||
- Add support for longer template names
|
- Add support for longer template names
|
||||||
- Add support for an iAQ sensor (#8107)
|
- Add support for an iAQ sensor (#8107)
|
||||||
|
- Add support for AS3935 Lightning Sensor by device111 (#8130)
|
||||||
- Add console command history (#7483, #8015)
|
- Add console command history (#7483, #8015)
|
||||||
- Add quick wifi reconnect using saved AP parameters when ``SetOption56 0`` (#3189)
|
- Add quick wifi reconnect using saved AP parameters when ``SetOption56 0`` (#3189)
|
||||||
- Add more accuracy to GPS NTP server (#8088)
|
- Add more accuracy to GPS NTP server (#8088)
|
||||||
|
@ -19,11 +19,12 @@
|
|||||||
- Add command ``SetOption41 <x>`` to force sending gratuitous ARP every <x> seconds
|
- Add command ``SetOption41 <x>`` to force sending gratuitous ARP every <x> seconds
|
||||||
- Add command ``DevGroupName`` to specify up to four Device Group Names (#8087)
|
- Add command ``DevGroupName`` to specify up to four Device Group Names (#8087)
|
||||||
- Add command ``DevGroupSend`` to send an update to a Device Group (#8093)
|
- Add command ``DevGroupSend`` to send an update to a Device Group (#8093)
|
||||||
|
- Add command ``Ping`` (#7176)
|
||||||
- Add quick wifi reconnect using saved AP parameters when ``SetOption56 0`` (#3189)
|
- Add quick wifi reconnect using saved AP parameters when ``SetOption56 0`` (#3189)
|
||||||
- Add more accuracy to GPS NTP server (#8088)
|
- Add more accuracy to GPS NTP server (#8088)
|
||||||
- Add support for an iAQ sensor (#8107)
|
- Add support for an iAQ sensor (#8107)
|
||||||
- Add support for Seven Segment display using HT16K33 (#8116)
|
- Add support for Seven Segment display using HT16K33 (#8116)
|
||||||
- Add command ``Ping`` (#7176)
|
- Add support for AS3935 Lightning Sensor by device111 (#8130)
|
||||||
|
|
||||||
### 8.2.0.2 20200328
|
### 8.2.0.2 20200328
|
||||||
|
|
||||||
|
@ -63,6 +63,7 @@
|
|||||||
#define D_JSON_ENERGY "Energy"
|
#define D_JSON_ENERGY "Energy"
|
||||||
#define D_JSON_ERASE "Erase"
|
#define D_JSON_ERASE "Erase"
|
||||||
#define D_JSON_ERROR "Error"
|
#define D_JSON_ERROR "Error"
|
||||||
|
#define D_JSON_EVENT "Event"
|
||||||
#define D_JSON_EVERY "Every"
|
#define D_JSON_EVERY "Every"
|
||||||
#define D_JSON_EXPORT_ACTIVE "ExportActive"
|
#define D_JSON_EXPORT_ACTIVE "ExportActive"
|
||||||
#define D_JSON_EXPORT_REACTIVE "ExportReactive"
|
#define D_JSON_EXPORT_REACTIVE "ExportReactive"
|
||||||
|
@ -503,7 +503,7 @@
|
|||||||
// #define WEMOS_MOTOR_V1_FREQ 1000 // Default frequency
|
// #define WEMOS_MOTOR_V1_FREQ 1000 // Default frequency
|
||||||
// #define USE_HDC1080 // [I2cDriver45] Enable HDC1080 temperature/humidity sensor (I2C address 0x40) (+1k5 code)
|
// #define USE_HDC1080 // [I2cDriver45] Enable HDC1080 temperature/humidity sensor (I2C address 0x40) (+1k5 code)
|
||||||
// #define USE_IAQ // [I2cDriver46] Enable iAQ-core air quality sensor (I2C address 0x5a) (+0k6 code)
|
// #define USE_IAQ // [I2cDriver46] Enable iAQ-core air quality sensor (I2C address 0x5a) (+0k6 code)
|
||||||
// #define USE_AS3935 // [I2cDriver48] Enable AS3935 Franklin Lightning Sensor (I2C address 0x03) (+5k4 code)
|
// #define USE_AS3935 // [I2cDriver48] Enable AS3935 Franklin Lightning Sensor (I2C address 0x03) (+5k4 code)
|
||||||
|
|
||||||
// #define USE_DISPLAY // Add I2C Display Support (+2k code)
|
// #define USE_DISPLAY // Add I2C Display Support (+2k code)
|
||||||
#define USE_DISPLAY_MODES1TO5 // Enable display mode 1 to 5 in addition to mode 0
|
#define USE_DISPLAY_MODES1TO5 // Enable display mode 1 to 5 in addition to mode 0
|
||||||
|
@ -551,7 +551,9 @@ void GetFeatures(void)
|
|||||||
#ifdef USE_AS3935
|
#ifdef USE_AS3935
|
||||||
feature6 |= 0x00000040; // xsns_67_as3935.ino
|
feature6 |= 0x00000040; // xsns_67_as3935.ino
|
||||||
#endif
|
#endif
|
||||||
// feature6 |= 0x00000080;
|
#ifdef USE_PING
|
||||||
|
feature6 |= 0x00000080; // xdrv_38_ping.ino
|
||||||
|
#endif
|
||||||
|
|
||||||
// feature6 |= 0x00000100;
|
// feature6 |= 0x00000100;
|
||||||
// feature6 |= 0x00000200;
|
// feature6 |= 0x00000200;
|
||||||
|
@ -123,6 +123,7 @@
|
|||||||
#define WEMOS_MOTOR_V1_FREQ 1000 // Default frequency
|
#define WEMOS_MOTOR_V1_FREQ 1000 // Default frequency
|
||||||
//#define USE_HDC1080 // Enable HDC1080 temperature/humidity sensor
|
//#define USE_HDC1080 // Enable HDC1080 temperature/humidity sensor
|
||||||
#define USE_IAQ // [I2cDriver46] Enable iAQ-core air quality sensor (I2C address 0x5a) (+0k6 code)
|
#define USE_IAQ // [I2cDriver46] Enable iAQ-core air quality sensor (I2C address 0x5a) (+0k6 code)
|
||||||
|
#define USE_AS3935 // [I2cDriver48] Enable AS3935 Franklin Lightning Sensor (I2C address 0x03) (+5k4 code)
|
||||||
|
|
||||||
#define USE_MHZ19 // Add support for MH-Z19 CO2 sensor (+2k code)
|
#define USE_MHZ19 // Add support for MH-Z19 CO2 sensor (+2k code)
|
||||||
#define USE_SENSEAIR // Add support for SenseAir K30, K70 and S8 CO2 sensor (+2k3 code)
|
#define USE_SENSEAIR // Add support for SenseAir K30, K70 and S8 CO2 sensor (+2k3 code)
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
XSNS_67_AS3935.ino - AS3935 Franklin Lightning Sensor support for Tasmota
|
xsns_67_as3935.ino - AS3935 Franklin Lightning Sensor support for Tasmota
|
||||||
|
|
||||||
Copyright (C) 2020 Martin Wagner
|
Copyright (C) 2020 Martin Wagner
|
||||||
|
|
||||||
@ -15,17 +15,14 @@
|
|||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#ifdef USE_I2C
|
#ifdef USE_I2C
|
||||||
#ifdef USE_AS3935
|
#ifdef USE_AS3935
|
||||||
/*********************************************************************************************\
|
/*********************************************************************************************\
|
||||||
* AS3935 Lightning Sensor
|
* AS3935 Lightning Sensor
|
||||||
*
|
*
|
||||||
* I2C Address: 0x03
|
* I2C Address: 0x03
|
||||||
*
|
|
||||||
\*********************************************************************************************/
|
\*********************************************************************************************/
|
||||||
|
|
||||||
#define XSNS_67 67
|
#define XSNS_67 67
|
||||||
@ -79,10 +76,7 @@
|
|||||||
#define D_AS3935_OUTDOORS "Outdoors"
|
#define D_AS3935_OUTDOORS "Outdoors"
|
||||||
#define D_AS3935_CAL_FAIL "calibration failed"
|
#define D_AS3935_CAL_FAIL "calibration failed"
|
||||||
#define D_AS3935_CAL_OK "calibration set to:"
|
#define D_AS3935_CAL_OK "calibration set to:"
|
||||||
// Json
|
|
||||||
#define D_JSON_EVENT "Event"
|
|
||||||
#define D_JSON_DISTANCE "Distance"
|
|
||||||
#define D_JSON_ENERGY "Energy"
|
|
||||||
// Global
|
// Global
|
||||||
const char HTTP_SNS_UNIT_KILOMETER[] PROGMEM = D_UNIT_KILOMETER;
|
const char HTTP_SNS_UNIT_KILOMETER[] PROGMEM = D_UNIT_KILOMETER;
|
||||||
// Http
|
// Http
|
||||||
@ -773,56 +767,60 @@ bool AS3935Cmd(void) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AH3935Show(bool json) {
|
void AH3935Show(bool json)
|
||||||
if (json) {
|
{
|
||||||
ResponseAppend_P(JSON_SNS_AS3935_EVENTS, D_SENSOR_AS3935, as3935_sensor.mqtt_irq, as3935_sensor.distance, as3935_sensor.intensity );
|
if (json) {
|
||||||
|
ResponseAppend_P(JSON_SNS_AS3935_EVENTS, D_SENSOR_AS3935, as3935_sensor.mqtt_irq, as3935_sensor.distance, as3935_sensor.intensity );
|
||||||
|
|
||||||
#ifdef USE_WEBSERVER
|
#ifdef USE_WEBSERVER
|
||||||
} else {
|
} else {
|
||||||
uint8_t gain = AS3935GetGainInt();
|
uint8_t gain = AS3935GetGainInt();
|
||||||
uint8_t disturber = AS3935GetDisturber();
|
uint8_t disturber = AS3935GetDisturber();
|
||||||
uint16_t vrms;
|
uint16_t vrms;
|
||||||
uint8_t stage;
|
uint8_t stage;
|
||||||
AS3935CalcVrmsLevel(vrms, stage);
|
AS3935CalcVrmsLevel(vrms, stage);
|
||||||
|
|
||||||
WSContentSend_PD(HTTP_SNS_AS3935_TABLE_1[as3935_sensor.http_irq], D_NAME_AS3935, as3935_sensor.http_distance);
|
WSContentSend_PD(HTTP_SNS_AS3935_TABLE_1[as3935_sensor.http_irq], D_NAME_AS3935, as3935_sensor.http_distance);
|
||||||
WSContentSend_PD(HTTP_SNS_AS3935_DISTANZ, as3935_sensor.http_distance);
|
WSContentSend_PD(HTTP_SNS_AS3935_DISTANZ, as3935_sensor.http_distance);
|
||||||
WSContentSend_PD(HTTP_SNS_AS3935_ENERGY, as3935_sensor.http_intensity);
|
WSContentSend_PD(HTTP_SNS_AS3935_ENERGY, as3935_sensor.http_intensity);
|
||||||
WSContentSend_PD(HTTP_SNS_AS3935_GAIN[gain], D_NAME_AS3935);
|
WSContentSend_PD(HTTP_SNS_AS3935_GAIN[gain], D_NAME_AS3935);
|
||||||
WSContentSend_PD(HTTP_SNS_AS3935_DISTURBER[disturber], D_NAME_AS3935);
|
WSContentSend_PD(HTTP_SNS_AS3935_DISTURBER[disturber], D_NAME_AS3935);
|
||||||
WSContentSend_PD(HTTP_SNS_AS3935_VRMS, vrms, stage);
|
WSContentSend_PD(HTTP_SNS_AS3935_VRMS, vrms, stage);
|
||||||
#endif // USE_WEBSERVER
|
#endif // USE_WEBSERVER
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*********************************************************************************************\
|
/*********************************************************************************************\
|
||||||
* Interface
|
* Interface
|
||||||
\*********************************************************************************************/
|
\*********************************************************************************************/
|
||||||
|
|
||||||
bool Xsns67(uint8_t function) {
|
bool Xsns67(uint8_t function)
|
||||||
|
{
|
||||||
if (!I2cEnabled(XI2C_48)) { return false; }
|
if (!I2cEnabled(XI2C_48)) { return false; }
|
||||||
|
|
||||||
bool result = false;
|
bool result = false;
|
||||||
|
|
||||||
if (FUNC_INIT == function) {
|
if (FUNC_INIT == function) {
|
||||||
AS3935Detect();
|
AS3935Detect();
|
||||||
} else if (as3935_active){
|
}
|
||||||
|
else if (as3935_active) {
|
||||||
switch (function) {
|
switch (function) {
|
||||||
case FUNC_EVERY_SECOND:
|
case FUNC_EVERY_SECOND:
|
||||||
AS3935EverySecond();
|
AS3935EverySecond();
|
||||||
break;
|
break;
|
||||||
case FUNC_COMMAND:
|
case FUNC_COMMAND:
|
||||||
result = AS3935Cmd();
|
result = AS3935Cmd();
|
||||||
break;
|
break;
|
||||||
case FUNC_JSON_APPEND:
|
case FUNC_JSON_APPEND:
|
||||||
AH3935Show(1);
|
AH3935Show(1);
|
||||||
break;
|
break;
|
||||||
#ifdef USE_WEBSERVER
|
#ifdef USE_WEBSERVER
|
||||||
case FUNC_WEB_SENSOR:
|
case FUNC_WEB_SENSOR:
|
||||||
AH3935Show(0);
|
AH3935Show(0);
|
||||||
break;
|
break;
|
||||||
#endif // USE_WEBSERVER
|
#endif // USE_WEBSERVER
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -201,7 +201,7 @@ a_features = [[
|
|||||||
"USE_AHT1x","USE_WEMOS_MOTOR_V1","USE_DEVICE_GROUPS","USE_PWM_DIMMER"
|
"USE_AHT1x","USE_WEMOS_MOTOR_V1","USE_DEVICE_GROUPS","USE_PWM_DIMMER"
|
||||||
],[
|
],[
|
||||||
"USE_KEELOQ","USE_HRXL","USE_SONOFF_D1","USE_HDC1080",
|
"USE_KEELOQ","USE_HRXL","USE_SONOFF_D1","USE_HDC1080",
|
||||||
"USE_IAQ","USE_DISPLAY_SEVENSEG","","",
|
"USE_IAQ","USE_DISPLAY_SEVENSEG","USE_AS3935","USE_PING",
|
||||||
"","","","",
|
"","","","",
|
||||||
"","","","",
|
"","","","",
|
||||||
"","","","",
|
"","","","",
|
||||||
@ -241,7 +241,7 @@ else:
|
|||||||
obj = json.load(fp)
|
obj = json.load(fp)
|
||||||
|
|
||||||
def StartDecode():
|
def StartDecode():
|
||||||
print ("\n*** decode-status.py v20200314 by Theo Arends and Jacek Ziolkowski ***")
|
print ("\n*** decode-status.py v20200411 by Theo Arends and Jacek Ziolkowski ***")
|
||||||
|
|
||||||
# print("Decoding\n{}".format(obj))
|
# print("Decoding\n{}".format(obj))
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user