mirror of https://github.com/arendst/Tasmota.git
Add support for AZ-Instrument 7798 CO2 meter/datalogger.
This commit is contained in:
parent
a23226793c
commit
604f341e9a
|
@ -182,6 +182,7 @@ The following binary downloads have been compiled with ESP8266/Arduino library c
|
|||
| USE_RC_SWITCH | - | - | - | x | x | x |
|
||||
| USE_RF_SENSOR | - | - | - | - | - | x | AlectoV2 only
|
||||
| USE_DISPLAY | - | - | - | - | - | - |
|
||||
| USE_AZ7798 | - | - | - | x | x | x |
|
||||
|
||||
## Changelog
|
||||
Version 6.4.0 20181217
|
||||
|
@ -244,3 +245,4 @@ Version 6.4.0 20181217
|
|||
* Add support for GPIO02 for newer Sonoff Basic (#4518)
|
||||
* Add Announce Switches to MQTT Discovery (#4531)
|
||||
* Add support for Manzoku Power Strip (#4590)
|
||||
* Add support for AZ-Instrument 7798 CO2 meter/datalogger
|
||||
|
|
|
@ -150,7 +150,7 @@ upload_speed = 115200
|
|||
upload_resetmethod = nodemcu
|
||||
|
||||
; *** Upload Serial reset method for Wemos and NodeMCU
|
||||
upload_port = COM5
|
||||
upload_port = /dev/ttyUSB1
|
||||
extra_scripts = pio/strip-floats.py
|
||||
|
||||
; *** Upload file to OTA server using SCP
|
||||
|
@ -540,3 +540,28 @@ upload_port = ${common.upload_port}
|
|||
upload_resetmethod = ${common.upload_resetmethod}
|
||||
upload_speed = ${common.upload_speed}
|
||||
extra_scripts = ${common.extra_scripts}
|
||||
|
||||
[env:wemos-d1-mini]
|
||||
platform = espressif8266
|
||||
framework = arduino
|
||||
board = esp01_1m
|
||||
board_build.flash_mode = dout
|
||||
build_flags = -Wl,-Tesp8266.flash.1m0.ld -DMQTT_MAX_PACKET_SIZE=1000
|
||||
lib_deps = PubSubClient, NeoPixelBus, IRremoteESP8266, ArduinoJSON
|
||||
extra_scripts = pio/strip-floats.py
|
||||
|
||||
; *** Serial Monitor options
|
||||
monitor_speed = 115200
|
||||
|
||||
; *** Upload Serial reset method for Wemos and NodeMCU
|
||||
upload_resetmethod = nodemcu
|
||||
upload_speed = 115200
|
||||
upload_port = /dev/ttyUSB1
|
||||
|
||||
; *** Upload file to OTA server using SCP
|
||||
;upload_port = user@host:/path
|
||||
;extra_scripts = pio/strip-floats.py, pio/sftp-uploader.py
|
||||
|
||||
; *** Upload file to OTA server using HTTP
|
||||
;upload_port = domus1:80/api/upload-arduino.php
|
||||
;extra_scripts = pio/strip-floats.py, pio/http-uploader.py
|
||||
|
|
|
@ -548,7 +548,7 @@ const char HTTP_SNS_SEAPRESSURE[] PROGMEM = "%s{s}%s " D_PRESSUREATSEALEVEL "{m}
|
|||
const char HTTP_SNS_ANALOG[] PROGMEM = "%s{s}%s " D_ANALOG_INPUT "%d{m}%d{e}"; // {s} = <tr><th>, {m} = </th><td>, {e} = </td></tr>
|
||||
const char HTTP_SNS_ILLUMINANCE[] PROGMEM = "%s{s}%s " D_ILLUMINANCE "{m}%d " D_UNIT_LUX "{e}"; // {s} = <tr><th>, {m} = </th><td>, {e} = </td></tr>
|
||||
|
||||
#if defined(USE_MHZ19) || defined(USE_SENSEAIR)
|
||||
#if defined(USE_MHZ19) || defined(USE_SENSEAIR) || defined(USE_AZ7798)
|
||||
const char HTTP_SNS_CO2[] PROGMEM = "%s{s}%s " D_CO2 "{m}%d " D_UNIT_PARTS_PER_MILLION "{e}"; // {s} = <tr><th>, {m} = </th><td>, {e} = </td></tr>
|
||||
#endif // USE_WEBSERVER
|
||||
|
||||
|
|
|
@ -538,6 +538,8 @@
|
|||
#define D_SENSOR_SSPI_CS "SSPI CS"
|
||||
#define D_SENSOR_SSPI_DC "SSPI DC"
|
||||
#define D_SENSOR_RF_SENSOR "RF Sensor"
|
||||
#define D_SENSOR_AZ_RX "AZ Rx"
|
||||
#define D_SENSOR_AZ_TX "AZ Tx"
|
||||
|
||||
// Units
|
||||
#define D_UNIT_AMPERE "A"
|
||||
|
|
|
@ -538,6 +538,8 @@
|
|||
#define D_SENSOR_SSPI_CS "SSPI CS"
|
||||
#define D_SENSOR_SSPI_DC "SSPI DC"
|
||||
#define D_SENSOR_RF_SENSOR "RF Sensor"
|
||||
#define D_SENSOR_AZ_RX "AZ Rx"
|
||||
#define D_SENSOR_AZ_TX "AZ Tx"
|
||||
|
||||
// Units
|
||||
#define D_UNIT_AMPERE "A"
|
||||
|
|
|
@ -538,6 +538,8 @@
|
|||
#define D_SENSOR_SSPI_CS "SSPI CS"
|
||||
#define D_SENSOR_SSPI_DC "SSPI DC"
|
||||
#define D_SENSOR_RF_SENSOR "RF Sensor"
|
||||
#define D_SENSOR_AZ_RX "AZ Rx"
|
||||
#define D_SENSOR_AZ_TX "AZ Tx"
|
||||
|
||||
// Units
|
||||
#define D_UNIT_AMPERE "A"
|
||||
|
|
|
@ -538,6 +538,8 @@
|
|||
#define D_SENSOR_SSPI_CS "SSPI CS"
|
||||
#define D_SENSOR_SSPI_DC "SSPI DC"
|
||||
#define D_SENSOR_RF_SENSOR "RF Sensor"
|
||||
#define D_SENSOR_AZ_RX "AZ Rx"
|
||||
#define D_SENSOR_AZ_TX "AZ Tx"
|
||||
|
||||
// Units
|
||||
#define D_UNIT_AMPERE "A"
|
||||
|
|
|
@ -538,6 +538,8 @@
|
|||
#define D_SENSOR_SSPI_CS "SSPI CS"
|
||||
#define D_SENSOR_SSPI_DC "SSPI DC"
|
||||
#define D_SENSOR_RF_SENSOR "RF Sensor"
|
||||
#define D_SENSOR_AZ_RX "AZ Rx"
|
||||
#define D_SENSOR_AZ_TX "AZ Tx"
|
||||
|
||||
// Units
|
||||
#define D_UNIT_AMPERE "A"
|
||||
|
|
|
@ -538,6 +538,8 @@
|
|||
#define D_SENSOR_SSPI_CS "SSPI CS"
|
||||
#define D_SENSOR_SSPI_DC "SSPI DC"
|
||||
#define D_SENSOR_RF_SENSOR "RF Sensor"
|
||||
#define D_SENSOR_AZ_RX "AZ Rx"
|
||||
#define D_SENSOR_AZ_TX "AZ Tx"
|
||||
|
||||
// Units
|
||||
#define D_UNIT_AMPERE "A"
|
||||
|
|
|
@ -538,6 +538,8 @@
|
|||
#define D_SENSOR_SSPI_CS "SSPI CS"
|
||||
#define D_SENSOR_SSPI_DC "SSPI DC"
|
||||
#define D_SENSOR_RF_SENSOR "RF Sensor"
|
||||
#define D_SENSOR_AZ_RX "AZ Rx"
|
||||
#define D_SENSOR_AZ_TX "AZ Tx"
|
||||
|
||||
// Units
|
||||
#define D_UNIT_AMPERE "A"
|
||||
|
|
|
@ -538,6 +538,8 @@
|
|||
#define D_SENSOR_SSPI_CS "SSPI CS"
|
||||
#define D_SENSOR_SSPI_DC "SSPI DC"
|
||||
#define D_SENSOR_RF_SENSOR "RF Sensor"
|
||||
#define D_SENSOR_AZ_RX "AZ Rx"
|
||||
#define D_SENSOR_AZ_TX "AZ Tx"
|
||||
|
||||
// Units
|
||||
#define D_UNIT_AMPERE "A"
|
||||
|
|
|
@ -538,6 +538,8 @@
|
|||
#define D_SENSOR_SSPI_CS "SSPI CS"
|
||||
#define D_SENSOR_SSPI_DC "SSPI DC"
|
||||
#define D_SENSOR_RF_SENSOR "RF Sensor"
|
||||
#define D_SENSOR_AZ_RX "AZ Rx"
|
||||
#define D_SENSOR_AZ_TX "AZ Tx"
|
||||
|
||||
// Units
|
||||
#define D_UNIT_AMPERE "A"
|
||||
|
|
|
@ -538,6 +538,8 @@
|
|||
#define D_SENSOR_SSPI_CS "SSPI CS"
|
||||
#define D_SENSOR_SSPI_DC "SSPI DC"
|
||||
#define D_SENSOR_RF_SENSOR "RF Sensor"
|
||||
#define D_SENSOR_AZ_RX "AZ Rx"
|
||||
#define D_SENSOR_AZ_TX "AZ Tx"
|
||||
|
||||
// Units
|
||||
#define D_UNIT_AMPERE "A"
|
||||
|
|
|
@ -538,6 +538,8 @@
|
|||
#define D_SENSOR_SSPI_CS "SSPI CS"
|
||||
#define D_SENSOR_SSPI_DC "SSPI DC"
|
||||
#define D_SENSOR_RF_SENSOR "RF Sensor"
|
||||
#define D_SENSOR_AZ_RX "AZ Rx"
|
||||
#define D_SENSOR_AZ_TX "AZ Tx"
|
||||
|
||||
// Units
|
||||
#define D_UNIT_AMPERE "A"
|
||||
|
|
|
@ -538,6 +538,8 @@
|
|||
#define D_SENSOR_SSPI_CS "SSPI CS"
|
||||
#define D_SENSOR_SSPI_DC "SSPI DC"
|
||||
#define D_SENSOR_RF_SENSOR "RF Sensor"
|
||||
#define D_SENSOR_AZ_RX "AZ Rx"
|
||||
#define D_SENSOR_AZ_TX "AZ Tx"
|
||||
|
||||
// Units
|
||||
#define D_UNIT_AMPERE "A"
|
||||
|
|
|
@ -538,6 +538,8 @@
|
|||
#define D_SENSOR_SSPI_CS "SSPI CS"
|
||||
#define D_SENSOR_SSPI_DC "SSPI DC"
|
||||
#define D_SENSOR_RF_SENSOR "RF Sensor"
|
||||
#define D_SENSOR_AZ_RX "AZ Rx"
|
||||
#define D_SENSOR_AZ_TX "AZ Tx"
|
||||
|
||||
// Units
|
||||
#define D_UNIT_AMPERE "A"
|
||||
|
|
|
@ -538,6 +538,8 @@
|
|||
#define D_SENSOR_SSPI_CS "SSPI CS"
|
||||
#define D_SENSOR_SSPI_DC "SSPI DC"
|
||||
#define D_SENSOR_RF_SENSOR "RF Sensor"
|
||||
#define D_SENSOR_AZ_RX "AZ Rx"
|
||||
#define D_SENSOR_AZ_TX "AZ Tx"
|
||||
|
||||
// Units
|
||||
#define D_UNIT_AMPERE "A"
|
||||
|
|
|
@ -538,6 +538,8 @@
|
|||
#define D_SENSOR_SSPI_CS "SSPI CS"
|
||||
#define D_SENSOR_SSPI_DC "SSPI DC"
|
||||
#define D_SENSOR_RF_SENSOR "RF Sensor"
|
||||
#define D_SENSOR_AZ_RX "AZ Rx"
|
||||
#define D_SENSOR_AZ_TX "AZ Tx"
|
||||
|
||||
// Units
|
||||
#define D_UNIT_AMPERE "А"
|
||||
|
|
|
@ -538,6 +538,8 @@
|
|||
#define D_SENSOR_SSPI_CS "SSPI CS"
|
||||
#define D_SENSOR_SSPI_DC "SSPI DC"
|
||||
#define D_SENSOR_RF_SENSOR "RF Senzor"
|
||||
#define D_SENSOR_AZ_RX "AZ Rx"
|
||||
#define D_SENSOR_AZ_TX "AZ Tx"
|
||||
|
||||
// Units
|
||||
#define D_UNIT_AMPERE "A"
|
||||
|
|
|
@ -538,6 +538,8 @@
|
|||
#define D_SENSOR_SSPI_CS "SSPI CS"
|
||||
#define D_SENSOR_SSPI_DC "SSPI DC"
|
||||
#define D_SENSOR_RF_SENSOR "RF Sensor"
|
||||
#define D_SENSOR_AZ_RX "AZ Rx"
|
||||
#define D_SENSOR_AZ_TX "AZ Tx"
|
||||
|
||||
// Units
|
||||
#define D_UNIT_AMPERE "A"
|
||||
|
|
|
@ -538,6 +538,8 @@
|
|||
#define D_SENSOR_SSPI_CS "SSPI CS"
|
||||
#define D_SENSOR_SSPI_DC "SSPI DC"
|
||||
#define D_SENSOR_RF_SENSOR "RF Sensor"
|
||||
#define D_SENSOR_AZ_RX "AZ Rx"
|
||||
#define D_SENSOR_AZ_TX "AZ Tx"
|
||||
|
||||
// Units
|
||||
#define D_UNIT_AMPERE "A"
|
||||
|
|
|
@ -538,6 +538,8 @@
|
|||
#define D_SENSOR_SSPI_CS "SSPI CS"
|
||||
#define D_SENSOR_SSPI_DC "SSPI DC"
|
||||
#define D_SENSOR_RF_SENSOR "RF Sensor"
|
||||
#define D_SENSOR_AZ_RX "AZ Rx"
|
||||
#define D_SENSOR_AZ_TX "AZ Tx"
|
||||
|
||||
// Units
|
||||
#define D_UNIT_AMPERE "А"
|
||||
|
|
|
@ -538,6 +538,8 @@
|
|||
#define D_SENSOR_SSPI_CS "SSPI CS"
|
||||
#define D_SENSOR_SSPI_DC "SSPI DC"
|
||||
#define D_SENSOR_RF_SENSOR "RF Sensor"
|
||||
#define D_SENSOR_AZ_RX "AZ Rx"
|
||||
#define D_SENSOR_AZ_TX "AZ Tx"
|
||||
|
||||
// Units
|
||||
#define D_UNIT_AMPERE "安"
|
||||
|
|
|
@ -538,6 +538,8 @@
|
|||
#define D_SENSOR_SSPI_CS "SSPI CS"
|
||||
#define D_SENSOR_SSPI_DC "SSPI DC"
|
||||
#define D_SENSOR_RF_SENSOR "RF Sensor"
|
||||
#define D_SENSOR_AZ_RX "AZ Rx"
|
||||
#define D_SENSOR_AZ_TX "AZ Tx"
|
||||
|
||||
// Units
|
||||
#define D_UNIT_AMPERE "安"
|
||||
|
|
|
@ -283,7 +283,7 @@
|
|||
// #define W1_PARASITE_POWER // If using USE_DS18x20 then optimize for parasite powered sensors
|
||||
|
||||
// -- I2C sensors ---------------------------------
|
||||
#define USE_I2C // I2C using library wire (+10k code, 0k2 mem, 124 iram)
|
||||
//#define USE_I2C // I2C using library wire (+10k code, 0k2 mem, 124 iram)
|
||||
|
||||
#ifdef USE_I2C
|
||||
#define USE_SHT // Enable SHT1X sensor (+1k4 code)
|
||||
|
@ -348,12 +348,12 @@
|
|||
#endif // USE_SPI
|
||||
|
||||
// -- Serial sensors ------------------------------
|
||||
#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_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 CO2_LOW 800 // Below this CO2 value show green light (needs PWM or WS2812 RG(B) led and enable with SetOption18 1)
|
||||
#define CO2_HIGH 1200 // Above this CO2 value show red light (needs PWM or WS2812 RG(B) led and enable with SetOption18 1)
|
||||
#define USE_PMS5003 // Add support for PMS5003 and PMS7003 particle concentration sensor (+1k3 code)
|
||||
#define USE_NOVA_SDS // Add support for SDS011 and SDS021 particle concentration sensor (+0k7 code)
|
||||
//#define USE_PMS5003 // Add support for PMS5003 and PMS7003 particle concentration sensor (+1k3 code)
|
||||
//#define USE_NOVA_SDS // Add support for SDS011 and SDS021 particle concentration sensor (+0k7 code)
|
||||
#define WORKING_PERIOD 5 // Working period of the SDS Sensor, Takes a reading every X Minutes
|
||||
#define USE_SERIAL_BRIDGE // Add support for software Serial Bridge (+0k8 code)
|
||||
//#define USE_SDM120 // Add support for Eastron SDM120-Modbus energy meter (+1k7 code)
|
||||
|
@ -363,35 +363,35 @@
|
|||
#define SDM630_SPEED 9600 // SDM630-Modbus RS485 serial speed (default: 9600 baud)
|
||||
//#define USE_MP3_PLAYER // Use of the DFPlayer Mini MP3 Player RB-DFR-562 commands: play, volume and stop
|
||||
#define MP3_VOLUME 10 // Set the startup volume on init, the range can be 0..30(max)
|
||||
#define USE_TUYA_DIMMER // Add support for Tuya Serial Dimmer
|
||||
//#define USE_TUYA_DIMMER // Add support for Tuya Serial Dimmer
|
||||
#define TUYA_DIMMER_ID 0 // Default dimmer Id
|
||||
#define USE_ARMTRONIX_DIMMERS // Add support for Armtronix Dimmers (+1k4 code)
|
||||
#define USE_PS_16_DZ // Add support for PS-16-DZ Dimmer
|
||||
|
||||
//#define USE_ARMTRONIX_DIMMERS // Add support for Armtronix Dimmers (+1k4 code)
|
||||
//#define USE_PS_16_DZ // Add support for PS-16-DZ Dimmer
|
||||
#define USE_AZ7798 // Add support for AZ-Instrument 7798 CO2 datalogger (+1k6 code)
|
||||
// Power monitoring sensors -----------------------
|
||||
#define USE_PZEM004T // Add support for PZEM004T Energy monitor (+2k code)
|
||||
#define USE_PZEM_AC // Add support for PZEM014,016 Energy monitor (+1k1 code)
|
||||
#define USE_PZEM_DC // Add support for PZEM003,017 Energy monitor (+1k1 code)
|
||||
#define USE_MCP39F501 // Add support for MCP39F501 Energy monitor as used in Shelly 2 (+3k1 code)
|
||||
//#define USE_PZEM004T // Add support for PZEM004T Energy monitor (+2k code)
|
||||
//#define USE_PZEM_AC // Add support for PZEM014,016 Energy monitor (+1k1 code)
|
||||
//#define USE_PZEM_DC // Add support for PZEM003,017 Energy monitor (+1k1 code)
|
||||
//#define USE_MCP39F501 // Add support for MCP39F501 Energy monitor as used in Shelly 2 (+3k1 code)
|
||||
|
||||
// -- Low level interface devices -----------------
|
||||
#define USE_IR_REMOTE // Send IR remote commands using library IRremoteESP8266 and ArduinoJson (+4k3 code, 0k3 mem, 48 iram)
|
||||
//#define USE_IR_REMOTE // Send IR remote commands using library IRremoteESP8266 and ArduinoJson (+4k3 code, 0k3 mem, 48 iram)
|
||||
// #define USE_IR_HVAC // Support for HVAC (Toshiba, Mitsubishi and LG) system using IR (+3k5 code)
|
||||
#define USE_IR_RECEIVE // Support for IR receiver (+7k2 code, 264 iram)
|
||||
// #define USE_IR_RECEIVE // Support for IR receiver (+7k2 code, 264 iram)
|
||||
#define IR_RCV_BUFFER_SIZE 100 // Max number of packets allowed in capture buffer (default 100 (*2 bytes ram))
|
||||
#define IR_RCV_TIMEOUT 15 // Number of milli-Seconds of no-more-data before we consider a message ended (default 15)
|
||||
#define IR_RCV_MIN_UNKNOWN_SIZE 6 // Set the smallest sized "UNKNOWN" message packets we actually care about (default 6)
|
||||
|
||||
#define USE_WS2812 // WS2812 Led string using library NeoPixelBus (+5k code, +1k mem, 232 iram) - Disable by //
|
||||
#define USE_WS2812_CTYPE NEO_GRB // WS2812 Color type (NEO_RGB, NEO_GRB, NEO_BRG, NEO_RBG, NEO_RGBW, NEO_GRBW)
|
||||
//#define USE_WS2812 // WS2812 Led string using library NeoPixelBus (+5k code, +1k mem, 232 iram) - Disable by //
|
||||
// #define USE_WS2812_CTYPE NEO_GRB // WS2812 Color type (NEO_RGB, NEO_GRB, NEO_BRG, NEO_RBG, NEO_RGBW, NEO_GRBW)
|
||||
// #define USE_WS2812_DMA // DMA supports only GPIO03 (= Serial RXD) (+1k mem). When USE_WS2812_DMA is enabled expect Exceptions on Pow
|
||||
|
||||
#define USE_ARILUX_RF // Add support for Arilux RF remote controller (+0k8 code, 252 iram (non 2.3.0))
|
||||
//#define USE_ARILUX_RF // Add support for Arilux RF remote controller (+0k8 code, 252 iram (non 2.3.0))
|
||||
|
||||
#define USE_SR04 // Add support for HC-SR04 ultrasonic devices (+1k code)
|
||||
//#define USE_SR04 // Add support for HC-SR04 ultrasonic devices (+1k code)
|
||||
|
||||
//#define USE_TM1638 // Add support for TM1638 switches copying Switch1 .. Switch8 (+1k code)
|
||||
#define USE_HX711 // Add support for HX711 load cell (+1k5 code)
|
||||
//#define USE_HX711 // Add support for HX711 load cell (+1k5 code)
|
||||
// #define USE_HX711_GUI // Add optional web GUI to HX711 as scale (+1k8 code)
|
||||
|
||||
#define USE_RF_FLASH // Add support for flashing the EFM8BB1 chip on the Sonoff RF Bridge. C2CK must be connected to GPIO4, C2D to GPIO5 on the PCB (+3k code)
|
||||
|
|
|
@ -135,6 +135,7 @@ void KNX_CB_Action(message_t const &msg, void *arg);
|
|||
#define USE_RF_SENSOR // Add support for RF sensor receiver (434MHz or 868MHz) (+0k8 code)
|
||||
// #define USE_THEO_V2 // Add support for decoding Theo V2 sensors as documented on https://sidweb.nl using 434MHz RF sensor receiver (+1k4 code)
|
||||
#define USE_ALECTO_V2 // Add support for decoding Alecto V2 sensors like ACH2010, WS3000 and DKW2012 using 868MHz RF sensor receiver (+1k7 code)
|
||||
#define USE_AZ7798 // Add support for AZ-Instrument 7798 CO2 datalogger
|
||||
#endif // USE_SENSORS
|
||||
|
||||
/*********************************************************************************************\
|
||||
|
@ -193,6 +194,7 @@ void KNX_CB_Action(message_t const &msg, void *arg);
|
|||
#undef USE_RF_SENSOR // Disable support for RF sensor receiver (434MHz or 868MHz) (+0k8 code)
|
||||
#undef DEBUG_THEO // Disable debug code
|
||||
#undef USE_DEBUG_DRIVER // Disable debug code
|
||||
#undef USE_AZ7798 // Disable support for AZ-Instrument 7798 CO2 datalogger
|
||||
#endif // USE_CLASSIC
|
||||
|
||||
/*********************************************************************************************\
|
||||
|
@ -313,6 +315,7 @@ void KNX_CB_Action(message_t const &msg, void *arg);
|
|||
#undef USE_RF_SENSOR // Disable support for RF sensor receiver (434MHz or 868MHz) (+0k8 code)
|
||||
#undef DEBUG_THEO // Disable debug code
|
||||
#undef USE_DEBUG_DRIVER // Disable debug code
|
||||
#undef USE_AZ7798 // Disable support for AZ-Instrument 7798 CO2 datalogger
|
||||
#endif // USE_BASIC
|
||||
|
||||
/*********************************************************************************************\
|
||||
|
@ -375,6 +378,7 @@ void KNX_CB_Action(message_t const &msg, void *arg);
|
|||
#undef USE_RF_SENSOR // Disable support for RF sensor receiver (434MHz or 868MHz) (+0k8 code)
|
||||
#undef DEBUG_THEO // Disable debug code
|
||||
#undef USE_DEBUG_DRIVER // Disable debug code
|
||||
#undef USE_AZ7798 // Disable support for AZ-Instrument 7798 CO2 datalogger
|
||||
#endif // BE_MINIMAL
|
||||
|
||||
/*********************************************************************************************\
|
||||
|
|
|
@ -141,6 +141,8 @@ enum UserSelectablePins {
|
|||
GPIO_SSPI_CS, // Software SPI Chip Select
|
||||
GPIO_SSPI_DC, // Software SPI Data or Command
|
||||
GPIO_RF_SENSOR, // Rf receiver with sensor decoding
|
||||
GPIO_AZ_TXD, // AZ-Instrument 7798 Serial interface
|
||||
GPIO_AZ_RXD, // AZ-Instrument 7798 Serial interface
|
||||
GPIO_SENSOR_END };
|
||||
|
||||
// Programmer selectable GPIO functionality offset by user selectable GPIOs
|
||||
|
@ -201,7 +203,8 @@ const char kSensorNames[] PROGMEM =
|
|||
D_SENSOR_TUYA_TX "|" D_SENSOR_TUYA_RX "|"
|
||||
D_SENSOR_MGC3130_XFER "|" D_SENSOR_MGC3130_RESET "|"
|
||||
D_SENSOR_SSPI_MISO "|" D_SENSOR_SSPI_MOSI "|" D_SENSOR_SSPI_SCLK "|" D_SENSOR_SSPI_CS "|" D_SENSOR_SSPI_DC "|"
|
||||
D_SENSOR_RF_SENSOR;
|
||||
D_SENSOR_RF_SENSOR "|"
|
||||
D_SENSOR_AZ_TX "|" D_SENSOR_AZ_RX;
|
||||
|
||||
/********************************************************************************************/
|
||||
|
||||
|
@ -454,6 +457,10 @@ const uint8_t kGpioNiceList[] PROGMEM = {
|
|||
GPIO_MGC3130_XFER,
|
||||
GPIO_MGC3130_RESET
|
||||
#endif
|
||||
#ifdef USE_AZ7798
|
||||
GPIO_AZ_TXD, // AZ-Instrument 7798 CO2 datalogger Serial interface
|
||||
GPIO_AZ_RXD // AZ-Instrument 7798 CO2 datalogger Serial interface
|
||||
#endif
|
||||
};
|
||||
|
||||
const uint8_t kModuleNiceList[MAXMODULE] PROGMEM = {
|
||||
|
|
|
@ -370,7 +370,9 @@ void GetFeatures(void)
|
|||
#ifdef USE_ALECTO_V2
|
||||
feature_sns2 |= 0x00020000;
|
||||
#endif
|
||||
// feature_sns2 |= 0x00040000;
|
||||
#ifdef USE_AZ7798
|
||||
feature_sns2 |= 0x00040000;
|
||||
#endif
|
||||
// feature_sns2 |= 0x00080000;
|
||||
// feature_sns2 |= 0x00100000;
|
||||
// feature_sns2 |= 0x00200000;
|
||||
|
|
|
@ -0,0 +1,306 @@
|
|||
/*
|
||||
xsns_38_az7798.ino - AZ_Instrument 7798 CO2/temperature/humidity meter support for Sonoff-Tasmota
|
||||
|
||||
Copyright (C) 2018 Theo Arends
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifdef USE_AZ7798
|
||||
|
||||
#define XSNS_38 38
|
||||
|
||||
/*********************************************************************************************\
|
||||
* CO2, temperature and humidity meter and data logger
|
||||
* Known by different names (brief survey 2018-12-16):
|
||||
* - AZ-Instrument 7798 (http://www.az-instrument.com.tw)
|
||||
* - co2meter.com AZ-0004
|
||||
* - Extech CO200
|
||||
* - BES CO7788 (https://www.aliexpress.com)
|
||||
* - AZ CO87 (https://www.aliexpress.com)
|
||||
* - no doubt there are more ...
|
||||
*
|
||||
* Hardware Serial will be selected if GPIO1 = [AZ Tx] and GPIO3 = [AZ Rx]
|
||||
*
|
||||
* Inside the meter, the serial comms wire with the red stripe goes to GPIO1.
|
||||
* The other one therefore to GPIO3.
|
||||
* WeMos D1 Mini is powered from the incoming 5V.
|
||||
*
|
||||
* This implementation was derived from xsns_15_mhz19.ino from
|
||||
* Sonoff-Tasmota-6.3.0 by Arthur de Beun.
|
||||
*
|
||||
* The serial comms protocol is not publicly documented, that I could find.
|
||||
* The info below was obtained by reverse-engineering.
|
||||
* Port settings: 9600 8N1
|
||||
* The suppied USB interface has a CP20x USB-serial bridge.
|
||||
* The 3-way, 2.5mm jack has tip=RxD, middle=TxD and base=0V
|
||||
* The TxD output swing is 3V3.
|
||||
*
|
||||
* There is never a space before the 0x0d, but the other spaces are there.
|
||||
*
|
||||
* serial number / ID
|
||||
* request: I 0x0d
|
||||
* response: i 12345678 7798V3.4 0x0d
|
||||
*
|
||||
* log info
|
||||
* request: M 0x0d
|
||||
* response: m 45 1 C 1af4 0cf4 0x0d
|
||||
*
|
||||
* 45 = number of records, but there are only 15 lines of 3 values each)
|
||||
* 1 = sample rate in seconds
|
||||
* C = celcius, F
|
||||
* 1af4 0cf4 = seconds since 2000-01-01 00:00:00
|
||||
*
|
||||
* start time 2014-04-30 19:35:16
|
||||
* end time 2014-04-30 19:35:30
|
||||
*
|
||||
* download log data
|
||||
* request: D 0x0d
|
||||
* response: m 45 1 C 1af4 0cf4 0x0d
|
||||
* d 174 955 698 0x0d
|
||||
* 174 = temp in [C * 10]
|
||||
* 955 = CO2 [ppm]
|
||||
* 698 = RH in [% * 10]
|
||||
* d 174 990 694 0x0d
|
||||
* ...
|
||||
* d 173 929 654 0x0d
|
||||
*
|
||||
* 15 lines in total, 1 second apart
|
||||
*
|
||||
* Sync datalogger time with PC
|
||||
* request: C 452295746 0x0d
|
||||
* response: > 0x0d
|
||||
*
|
||||
* 452295746 = seconds since 2000-01-01 00:00:00
|
||||
*
|
||||
* Identifier:
|
||||
* request: J -------- 1 0x0d
|
||||
*
|
||||
* the characters (dashes) in the above become the first part of the response to the I command (12345678 above)
|
||||
*
|
||||
* Set sample rate
|
||||
* request: S 10 0x0d
|
||||
* response: m 12 10 C 1af5 7be1 0x0d
|
||||
*
|
||||
* Other characters that seem to give a response:
|
||||
* A responds with >
|
||||
* so is similar to the response to C, so other characters may be required
|
||||
* A is the beep alarm perhaps?
|
||||
* parameters would be CO2 level and on/off, as per front panel P1.3 setting?
|
||||
*
|
||||
* L responds with >
|
||||
* L perhaps sets the limits for the good and normal levels (P1.1 and P1.2)?
|
||||
*
|
||||
* Q responds with >
|
||||
* Q is reset maybe (P4.1)?
|
||||
*
|
||||
* : responds with : T19.9C:C2167ppm:H57.4%
|
||||
* This one gives the current readings.
|
||||
**********************************************************************************************
|
||||
|
||||
/*********************************************************************************************/
|
||||
|
||||
#include <TasmotaSerial.h>
|
||||
|
||||
#ifndef CO2_LOW
|
||||
#define CO2_LOW 800 // Below this CO2 value show green light
|
||||
#endif
|
||||
#ifndef CO2_HIGH
|
||||
#define CO2_HIGH 1200 // Above this CO2 value show red light
|
||||
#endif
|
||||
|
||||
#define AZ_READ_TIMEOUT 400 // Must be way less than 1000 but enough to read 9 bytes at 9600 bps
|
||||
|
||||
TasmotaSerial *AzSerial;
|
||||
|
||||
const char ktype[] = "AZ7798";
|
||||
uint8_t az_type = 1;
|
||||
uint16_t az_co2 = 0;
|
||||
double az_temperature = 0;
|
||||
double az_humidity = 0;
|
||||
uint8_t az_received = 0;
|
||||
uint8_t az_state = 0;
|
||||
|
||||
/*********************************************************************************************/
|
||||
|
||||
void AzEverySecond()
|
||||
{
|
||||
az_state++;
|
||||
if (5 == az_state) { // every 5 seconds
|
||||
az_state = 0;
|
||||
|
||||
AzSerial->flush(); // sync reception
|
||||
AzSerial->write(":\r", 2);
|
||||
az_received = 0;
|
||||
|
||||
uint8_t az_response[32];
|
||||
unsigned long start = millis();
|
||||
uint8_t counter = 0;
|
||||
uint8_t i, j;
|
||||
uint8_t response_substr[16];
|
||||
|
||||
do {
|
||||
if (AzSerial->available() > 0) {
|
||||
az_response[counter] = AzSerial->read();
|
||||
if(az_response[counter] == 0x0d) { az_received = 1; }
|
||||
counter++;
|
||||
} else {
|
||||
delay(5);
|
||||
}
|
||||
} while(((millis() - start) < AZ_READ_TIMEOUT) && (counter < sizeof(az_response)) && !az_received);
|
||||
|
||||
AddLogSerial(LOG_LEVEL_DEBUG_MORE, az_response, counter);
|
||||
|
||||
if (!az_received) {
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_DEBUG "AZ7798 comms timeout"));
|
||||
return;
|
||||
}
|
||||
|
||||
i = 0;
|
||||
while((az_response[i] != 'T') && (i < counter)) {i++;} // find the start of response
|
||||
if(az_response[i] != 'T') {
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_DEBUG "AZ7798 failed to find start of response"));
|
||||
return;
|
||||
}
|
||||
i++; // advance to start of temperature value
|
||||
j = 0;
|
||||
// find the end of temperature
|
||||
while((az_response[i] != 'C') && (az_response[i] != 'F') && (i < counter)) {
|
||||
response_substr[j++] = az_response[i++];
|
||||
}
|
||||
if((az_response[i] != 'C') && (az_response[i] != 'F')){
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_DEBUG "AZ7798 failed to find end of temperature"));
|
||||
return;
|
||||
}
|
||||
response_substr[j] = 0; // add null terminator
|
||||
az_temperature = CharToDouble((char*)response_substr); // units (C or F) depends on meter setting
|
||||
if(az_response[i] == 'C') { // meter transmits in degC
|
||||
az_temperature = ConvertTemp((float)az_temperature); // convert to degF, depending on settings
|
||||
} else { // meter transmits in degF
|
||||
if(!Settings.flag.temperature_conversion) {
|
||||
az_temperature = (az_temperature - 32) / 1.8; // convert to degC
|
||||
}
|
||||
}
|
||||
i++; // advance to first delimiter
|
||||
if(az_response[i] != ':') {
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_DEBUG "AZ7798 error first delimiter"));
|
||||
return;
|
||||
}
|
||||
i++; // advance to start of CO2
|
||||
if(az_response[i] != 'C') {
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_DEBUG "AZ7798 error start of CO2"));
|
||||
return;
|
||||
}
|
||||
i++; // advance to start of CO2 value
|
||||
j = 0;
|
||||
// find the end of CO2
|
||||
while((az_response[i] != 'p') && (i < counter)) {
|
||||
response_substr[j++] = az_response[i++];
|
||||
}
|
||||
if(az_response[i] != 'p') {
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_DEBUG "AZ7798 failed to find end of CO2"));
|
||||
return;
|
||||
}
|
||||
response_substr[j] = 0; // add null terminator
|
||||
az_co2 = atoi((char*)response_substr);
|
||||
LightSetSignal(CO2_LOW, CO2_HIGH, az_co2);
|
||||
i += 3; // advance to second delimiter
|
||||
if(az_response[i] != ':') {
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_DEBUG "AZ7798 error second delimiter"));
|
||||
return;
|
||||
}
|
||||
i++; // advance to start of humidity
|
||||
if(az_response[i] != 'H') {
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_DEBUG "AZ7798 error start of humidity"));
|
||||
return;
|
||||
}
|
||||
i++; // advance to start of humidity value
|
||||
j = 0;
|
||||
// find the end of humidity
|
||||
while((az_response[i] != '%') && (i < counter)) {
|
||||
response_substr[j++] = az_response[i++];
|
||||
}
|
||||
if(az_response[i] != '%') {
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_DEBUG "AZ7798 failed to find end of humidity"));
|
||||
return;
|
||||
}
|
||||
response_substr[j] = 0; // add null terminator
|
||||
az_humidity = CharToDouble((char*)response_substr);
|
||||
}
|
||||
}
|
||||
|
||||
/*********************************************************************************************/
|
||||
|
||||
void AzInit()
|
||||
{
|
||||
az_type = 0;
|
||||
if ((pin[GPIO_AZ_RXD] < 99) && (pin[GPIO_AZ_TXD] < 99)) {
|
||||
AzSerial = new TasmotaSerial(pin[GPIO_AZ_RXD], pin[GPIO_AZ_TXD], 1);
|
||||
if (AzSerial->begin(9600)) {
|
||||
if (AzSerial->hardwareSerial()) { ClaimSerial(); }
|
||||
az_type = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void AzShow(boolean json)
|
||||
{
|
||||
char temperature[10], humidity[10];
|
||||
dtostrfd(az_temperature, Settings.flag2.temperature_resolution, temperature);
|
||||
dtostrfd(az_humidity, Settings.flag2.humidity_resolution, humidity);
|
||||
|
||||
if (json) {
|
||||
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"%s\":{\"" D_JSON_CO2 "\":%d,\"" D_JSON_TEMPERATURE "\":%s,\"" D_JSON_HUMIDITY "\":%s}"), mqtt_data, ktype, az_co2, temperature, humidity);
|
||||
#ifdef USE_DOMOTICZ
|
||||
if (0 == tele_period) DomoticzSensor(DZ_AIRQUALITY, az_co2);
|
||||
#endif // USE_DOMOTICZ
|
||||
#ifdef USE_WEBSERVER
|
||||
} else {
|
||||
snprintf_P(mqtt_data, sizeof(mqtt_data), HTTP_SNS_CO2, mqtt_data, ktype, az_co2);
|
||||
snprintf_P(mqtt_data, sizeof(mqtt_data), HTTP_SNS_TEMP, mqtt_data, ktype, temperature, TempUnit());
|
||||
snprintf_P(mqtt_data, sizeof(mqtt_data), HTTP_SNS_HUM, mqtt_data, ktype, humidity);
|
||||
#endif // USE_WEBSERVER
|
||||
}
|
||||
}
|
||||
|
||||
/*********************************************************************************************\
|
||||
* Interface
|
||||
\*********************************************************************************************/
|
||||
|
||||
boolean Xsns36(byte function)
|
||||
{
|
||||
boolean result = false;
|
||||
|
||||
if(az_type){
|
||||
switch (function) {
|
||||
case FUNC_INIT:
|
||||
AzInit();
|
||||
break;
|
||||
case FUNC_EVERY_SECOND:
|
||||
AzEverySecond();
|
||||
break;
|
||||
case FUNC_JSON_APPEND:
|
||||
AzShow(1);
|
||||
break;
|
||||
#ifdef USE_WEBSERVER
|
||||
case FUNC_WEB_APPEND:
|
||||
AzShow(0);
|
||||
break;
|
||||
#endif // USE_WEBSERVER
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
#endif // USE_AZ7798
|
|
@ -135,7 +135,7 @@ a_features = [[
|
|||
"USE_MCP230xx_OUTPUT","USE_MCP230xx_DISPLAYOUTPUT","USE_HLW8012","USE_CSE7766",
|
||||
"USE_MCP39F501","USE_PZEM_AC","USE_DS3231","USE_HX711",
|
||||
"USE_PZEM_DC","USE_TX20_WIND_SENSOR","USE_MGC3130","USE_RF_SENSOR",
|
||||
"USE_THEO_V2","USE_ALECTO_V2","","",
|
||||
"USE_THEO_V2","USE_ALECTO_V2","USE_AZ7798","",
|
||||
"","","","",
|
||||
"","","","",
|
||||
"","","",""]]
|
||||
|
|
Loading…
Reference in New Issue