Merge pull request #5539 from burundiocibu/hre

Hre
This commit is contained in:
Theo Arends 2019-03-28 10:40:29 +01:00 committed by GitHub
commit e3241d4939
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
25 changed files with 502 additions and 2 deletions

View File

@ -69,6 +69,7 @@
#define D_JSON_FLASHCHIPID "FlashChipId"
#define D_JSON_FLASHMODE "FlashMode"
#define D_JSON_FLASHSIZE "FlashSize"
#define D_JSON_FLOWRATE "FlowRate"
#define D_JSON_FREEMEMORY "Free"
#define D_JSON_FREQUENCY "Frequency"
#define D_JSON_FROM "from"
@ -143,6 +144,7 @@
#define D_JSON_TIME "Time"
#define D_JSON_TODAY "Today"
#define D_JSON_TOTAL "Total"
#define D_JSON_TOTAL_USAGE "TotalUsage"
#define D_JSON_TOTAL_REACTIVE "TotalReactivePower"
#define D_JSON_TOTAL_START_TIME "TotalStartTime"
#define D_JSON_TVOC "TVOC"
@ -515,6 +517,8 @@ const char S_JSON_DRIVER_INDEX_SVALUE[] PROGMEM = "{\"" D_CMND_DRIVE
const char JSON_SNS_TEMP[] PROGMEM = ",\"%s\":{\"" D_JSON_TEMPERATURE "\":%s}";
const char JSON_SNS_TEMPHUM[] PROGMEM = ",\"%s\":{\"" D_JSON_TEMPERATURE "\":%s,\"" D_JSON_HUMIDITY "\":%s}";
const char JSON_SNS_GNGPM[] PROGMEM = ",\"%s\":{\"" D_JSON_TOTAL_USAGE "\":%s,\"" D_JSON_FLOWRATE "\":%s}";
const char S_LOG_I2C_FOUND_AT[] PROGMEM = D_LOG_I2C "%s " D_FOUND_AT " 0x%x";
const char S_LOG_HTTP[] PROGMEM = D_LOG_HTTP;
@ -569,6 +573,8 @@ const char HTTP_SNS_ANALOG[] PROGMEM = "{s}%s " D_ANALOG_INPUT "%d{m}%d{e}";
const char HTTP_SNS_ILLUMINANCE[] PROGMEM = "{s}%s " D_ILLUMINANCE "{m}%d " D_UNIT_LUX "{e}"; // {s} = <tr><th>, {m} = </th><td>, {e} = </td></tr>
const char HTTP_SNS_CO2[] PROGMEM = "{s}%s " D_CO2 "{m}%d " D_UNIT_PARTS_PER_MILLION "{e}"; // {s} = <tr><th>, {m} = </th><td>, {e} = </td></tr>
const char HTTP_SNS_CO2EAVG[] PROGMEM = "{s}%s " D_ECO2 "{m}%d " D_UNIT_PARTS_PER_MILLION "{e}"; // {s} = <tr><th>, {m} = </th><td>, {e} = </td></tr>
const char HTTP_SNS_GALLONS[] PROGMEM = "{s}%s " D_TOTAL_USAGE "{m}%s " D_UNIT_GALLONS " {e}"; // {s} = <tr><th>, {m} = </th><td>, {e} = </td></tr>
const char HTTP_SNS_GPM[] PROGMEM = "{s}%s " D_FLOW_RATE "{m}%s " D_UNIT_GALLONS_PER_MIN" {e}"; // {s} = <tr><th>, {m} = </th><td>, {e} = </td></tr>
const char S_MAIN_MENU[] PROGMEM = D_MAIN_MENU;
const char S_CONFIGURATION[] PROGMEM = D_CONFIGURATION;

View File

@ -93,6 +93,7 @@
#define D_FALLBACK_TOPIC "Помощен топик"
#define D_FALSE "Невярно"
#define D_FILE "Файл"
#define D_FLOW_RATE "Flow rate"
#define D_FREE_MEMORY "Свободна памет"
#define D_FREQUENCY "Честота"
#define D_GAS "Газ"
@ -156,6 +157,7 @@
#define D_TO "към"
#define D_TOGGLE "Превключване"
#define D_TOPIC "Топик"
#define D_TOTAL_USAGE "Total Usage"
#define D_TRANSMIT "Предаване"
#define D_TRUE "Вярно"
#define D_TVOC "TVOC"
@ -492,6 +494,10 @@
#define D_TX20_SOUTH "Ю"
#define D_TX20_WEST "З"
//xsns_43_hre.ino
#define D_LOG_HRE "HRE: "
// sonoff_template.h - keep them as short as possible to be able to fit them in GUI drop down box
#define D_SENSOR_NONE "Няма"
#define D_SENSOR_USER "Потребит."
@ -576,12 +582,16 @@
#define D_SENSOR_TXD "Serial Tx"
#define D_SENSOR_RXD "Serial Rx"
#define D_SENSOR_ROTARY "Rotary" // Suffix "1A"
#define D_SENSOR_HRE_CLOCK "HRE Clock"
#define D_SENSOR_HRE_DATA "HRE Data"
// Units
#define D_UNIT_AMPERE "A"
#define D_UNIT_CENTIMETER "cm"
#define D_UNIT_HERTZ "Hz"
#define D_UNIT_HOUR "h"
#define D_UNIT_GALLONS "gal"
#define D_UNIT_GALLONS_PER_MIN "g/m"
#define D_UNIT_KILOGRAM "kg"
#define D_UNIT_INCREMENTS "inc"
#define D_UNIT_KILOMETER_PER_HOUR "km/h"

View File

@ -93,6 +93,7 @@
#define D_FALLBACK_TOPIC "Záložní topic"
#define D_FALSE "Nepravda"
#define D_FILE "Soubor"
#define D_FLOW_RATE "Flow rate"
#define D_FREE_MEMORY "Volná paměť"
#define D_FREQUENCY "Kmitočet"
#define D_GAS "Plyn"
@ -156,6 +157,7 @@
#define D_TO "do"
#define D_TOGGLE "Přepni"
#define D_TOPIC "Topic"
#define D_TOTAL_USAGE "Total Usage"
#define D_TRANSMIT "Odešli"
#define D_TRUE "Pravda"
#define D_TVOC "TVOC"
@ -492,6 +494,9 @@
#define D_TX20_SOUTH "J"
#define D_TX20_WEST "Z"
//xsns_43_hre.ino
#define D_LOG_HRE "HRE: "
// sonoff_template.h - keep them as short as possible to be able to fit them in GUI drop down box
#define D_SENSOR_NONE "Není"
#define D_SENSOR_USER "User"
@ -576,12 +581,16 @@
#define D_SENSOR_TXD "Serial Tx"
#define D_SENSOR_RXD "Serial Rx"
#define D_SENSOR_ROTARY "Rotary" // Suffix "1A"
#define D_SENSOR_HRE_CLOCK "HRE Clock"
#define D_SENSOR_HRE_DATA "HRE Data"
// Units
#define D_UNIT_AMPERE "A"
#define D_UNIT_CENTIMETER "cm"
#define D_UNIT_HERTZ "Hz"
#define D_UNIT_HOUR "hod"
#define D_UNIT_GALLONS "gal"
#define D_UNIT_GALLONS_PER_MIN "g/m"
#define D_UNIT_KILOGRAM "kg"
#define D_UNIT_INCREMENTS "inc"
#define D_UNIT_KILOMETER_PER_HOUR "km/h" // or "km/h"

View File

@ -93,6 +93,7 @@
#define D_FALLBACK_TOPIC "Fallback-Topic"
#define D_FALSE "falsch"
#define D_FILE "Datei"
#define D_FLOW_RATE "Flow rate"
#define D_FREE_MEMORY "Freier Arbeitsspeicher"
#define D_FREQUENCY "Frequenz"
#define D_GAS "Gas"
@ -156,6 +157,7 @@
#define D_TO "zu"
#define D_TOGGLE "An/Aus"
#define D_TOPIC "topic"
#define D_TOTAL_USAGE "Total Usage"
#define D_TRANSMIT "Übertragen"
#define D_TRUE "wahr"
#define D_TVOC "TVOC"
@ -492,6 +494,9 @@
#define D_TX20_SOUTH "S"
#define D_TX20_WEST "W"
//xsns_43_hre.ino
#define D_LOG_HRE "HRE: "
// sonoff_template.h - keep them as short as possible to be able to fit them in GUI drop down box
#define D_SENSOR_NONE "None"
#define D_SENSOR_USER "User"
@ -576,12 +581,16 @@
#define D_SENSOR_TXD "Serial Tx"
#define D_SENSOR_RXD "Serial Rx"
#define D_SENSOR_ROTARY "Rotary" // Suffix "1A"
#define D_SENSOR_HRE_CLOCK "HRE Clock"
#define D_SENSOR_HRE_DATA "HRE Data"
// Units
#define D_UNIT_AMPERE "A"
#define D_UNIT_CENTIMETER "cm"
#define D_UNIT_HERTZ "Hz"
#define D_UNIT_HOUR "h"
#define D_UNIT_GALLONS "gal"
#define D_UNIT_GALLONS_PER_MIN "g/m"
#define D_UNIT_INCREMENTS "inc"
#define D_UNIT_KILOGRAM "kg"
#define D_UNIT_KILOMETER_PER_HOUR "km/h"

View File

@ -93,6 +93,7 @@
#define D_FALLBACK_TOPIC "Fallback Topic"
#define D_FALSE "Ψευδές"
#define D_FILE "Αρχείο"
#define D_FLOW_RATE "Flow rate"
#define D_FREE_MEMORY "Ελεύθερη μνήμη"
#define D_FREQUENCY "Συχνότητα"
#define D_GAS "Αέριο"
@ -156,6 +157,7 @@
#define D_TO "έως"
#define D_TOGGLE "Εναλλαγή"
#define D_TOPIC "Topic"
#define D_TOTAL_USAGE "Total Usage"
#define D_TRANSMIT "Μετάδοση"
#define D_TRUE "Αληθές"
#define D_TVOC "TVOC"
@ -492,6 +494,9 @@
#define D_TX20_SOUTH "Ν"
#define D_TX20_WEST "Δ"
//xsns_43_hre.ino
#define D_LOG_HRE "HRE: "
// sonoff_template.h - keep them as short as possible to be able to fit them in GUI drop down box
#define D_SENSOR_NONE "Κανένα"
#define D_SENSOR_USER "User"
@ -576,12 +581,16 @@
#define D_SENSOR_TXD "Serial Tx"
#define D_SENSOR_RXD "Serial Rx"
#define D_SENSOR_ROTARY "Rotary" // Suffix "1A"
#define D_SENSOR_HRE_CLOCK "HRE Clock"
#define D_SENSOR_HRE_DATA "HRE Data"
// Units
#define D_UNIT_AMPERE "A"
#define D_UNIT_CENTIMETER "cm"
#define D_UNIT_HERTZ "Hz"
#define D_UNIT_HOUR "Hr"
#define D_UNIT_GALLONS "gal"
#define D_UNIT_GALLONS_PER_MIN "g/m"
#define D_UNIT_INCREMENTS "inc"
#define D_UNIT_KILOGRAM "kg"
#define D_UNIT_KILOMETER_PER_HOUR "km/h" // or "km/h"

View File

@ -93,6 +93,7 @@
#define D_FALLBACK_TOPIC "Fallback Topic"
#define D_FALSE "False"
#define D_FILE "File"
#define D_FLOW_RATE "Flow rate"
#define D_FREE_MEMORY "Free Memory"
#define D_FREQUENCY "Frequency"
#define D_GAS "Gas"
@ -156,6 +157,7 @@
#define D_TO "to"
#define D_TOGGLE "Toggle"
#define D_TOPIC "Topic"
#define D_TOTAL_USAGE "Total Usage"
#define D_TRANSMIT "Transmit"
#define D_TRUE "True"
#define D_TVOC "TVOC"
@ -492,6 +494,9 @@
#define D_TX20_SOUTH "S"
#define D_TX20_WEST "W"
//xsns_43_hre.ino
#define D_LOG_HRE "HRE: "
// sonoff_template.h - keep them as short as possible to be able to fit them in GUI drop down box
#define D_SENSOR_NONE "None"
#define D_SENSOR_USER "User"
@ -576,12 +581,15 @@
#define D_SENSOR_TXD "Serial Tx"
#define D_SENSOR_RXD "Serial Rx"
#define D_SENSOR_ROTARY "Rotary" // Suffix "1A"
#define D_SENSOR_HRE_CLOCK "HRE Clock"
#define D_SENSOR_HRE_DATA "HRE Data"
// Units
#define D_UNIT_AMPERE "A"
#define D_UNIT_CENTIMETER "cm"
#define D_UNIT_HERTZ "Hz"
#define D_UNIT_HOUR "Hr"
#define D_UNIT_GALLONS "gal"
#define D_UNIT_GALLONS_PER_MIN "g/m"
#define D_UNIT_INCREMENTS "inc"
#define D_UNIT_KILOGRAM "kg"
#define D_UNIT_KILOMETER_PER_HOUR "km/h" // or "km/h"

View File

@ -93,6 +93,7 @@
#define D_FALLBACK_TOPIC "FallbackTopic"
#define D_FALSE "Falso"
#define D_FILE "Archivo"
#define D_FLOW_RATE "Flow rate"
#define D_FREE_MEMORY "Memoria Libre"
#define D_FREQUENCY "Frecuencia"
#define D_GAS "Gas"
@ -156,6 +157,7 @@
#define D_TO "a"
#define D_TOGGLE "Conmutar"
#define D_TOPIC "Topic"
#define D_TOTAL_USAGE "Total Usage"
#define D_TRANSMIT "Transmitir"
#define D_TRUE "Verdadero"
#define D_TVOC "TVOC"
@ -492,6 +494,9 @@
#define D_TX20_SOUTH "S"
#define D_TX20_WEST "O"
//xsns_43_hre.ino
#define D_LOG_HRE "HRE: "
// sonoff_template.h - keep them as short as possible to be able to fit them in GUI drop down box
#define D_SENSOR_NONE "Ninguno"
#define D_SENSOR_USER "User"
@ -576,12 +581,16 @@
#define D_SENSOR_TXD "Serial Tx"
#define D_SENSOR_RXD "Serial Rx"
#define D_SENSOR_ROTARY "Rotary" // Suffix "1A"
#define D_SENSOR_HRE_CLOCK "HRE Clock"
#define D_SENSOR_HRE_DATA "HRE Data"
// Units
#define D_UNIT_AMPERE "A"
#define D_UNIT_CENTIMETER "cm"
#define D_UNIT_HERTZ "Hz"
#define D_UNIT_HOUR "Hr"
#define D_UNIT_GALLONS "gal"
#define D_UNIT_GALLONS_PER_MIN "g/m"
#define D_UNIT_INCREMENTS "inc"
#define D_UNIT_KILOGRAM "kg"
#define D_UNIT_KILOMETER_PER_HOUR "km/h" // or "km/h"

View File

@ -93,6 +93,7 @@
#define D_FALLBACK_TOPIC "Topic de secours"
#define D_FALSE "Faux"
#define D_FILE "Fichier"
#define D_FLOW_RATE "Flow rate"
#define D_FREE_MEMORY "Mémoire libre"
#define D_FREQUENCY "Fréquence"
#define D_GAS "Gaz"
@ -156,6 +157,7 @@
#define D_TO "à"
#define D_TOGGLE "Inverser"
#define D_TOPIC "Topic" // Keep MQTT keyword
#define D_TOTAL_USAGE "Total Usage"
#define D_TRANSMIT "Transmettre"
#define D_TRUE "Vrai"
#define D_TVOC "TVOC"
@ -492,6 +494,9 @@
#define D_TX20_SOUTH "S"
#define D_TX20_WEST "O"
//xsns_43_hre.ino
#define D_LOG_HRE "HRE: "
// sonoff_template.h - keep them as short as possible to be able to fit them in GUI drop down box
#define D_SENSOR_NONE "Aucun"
#define D_SENSOR_USER "Utilisateur"
@ -576,12 +581,16 @@
#define D_SENSOR_TXD "Serial Tx"
#define D_SENSOR_RXD "Serial Rx"
#define D_SENSOR_ROTARY "Rotary" // Suffix "1A"
#define D_SENSOR_HRE_CLOCK "HRE Clock"
#define D_SENSOR_HRE_DATA "HRE Data"
// Units
#define D_UNIT_AMPERE "A"
#define D_UNIT_CENTIMETER "cm"
#define D_UNIT_HERTZ "Hz"
#define D_UNIT_HOUR "h"
#define D_UNIT_GALLONS "gal"
#define D_UNIT_GALLONS_PER_MIN "g/m"
#define D_UNIT_INCREMENTS "inc"
#define D_UNIT_KILOGRAM "kg"
#define D_UNIT_KILOMETER_PER_HOUR "km/h"

View File

@ -93,6 +93,7 @@
#define D_FALLBACK_TOPIC "נושא לחזרה"
#define D_FALSE "שגוי"
#define D_FILE "קובץ"
#define D_FLOW_RATE "Flow rate"
#define D_FREE_MEMORY "זכרון פנוי"
#define D_FREQUENCY "תדר"
#define D_GAS "גז"
@ -156,6 +157,7 @@
#define D_TO "ל"
#define D_TOGGLE "מתג"
#define D_TOPIC "נושא"
#define D_TOTAL_USAGE "Total Usage"
#define D_TRANSMIT "עבר"
#define D_TRUE "נכון"
#define D_TVOC "TVOC"
@ -492,6 +494,9 @@
#define D_TX20_SOUTH "S"
#define D_TX20_WEST "W"
//xsns_43_hre.ino
#define D_LOG_HRE "HRE: "
// sonoff_template.h - keep them as short as possible to be able to fit them in GUI drop down box
#define D_SENSOR_NONE "None"
#define D_SENSOR_USER "משתמש"
@ -576,12 +581,16 @@
#define D_SENSOR_TXD "Serial Tx"
#define D_SENSOR_RXD "Serial Rx"
#define D_SENSOR_ROTARY "Rotary" // Suffix "1A"
#define D_SENSOR_HRE_CLOCK "HRE Clock"
#define D_SENSOR_HRE_DATA "HRE Data"
// Units
#define D_UNIT_AMPERE "A"
#define D_UNIT_CENTIMETER "cm"
#define D_UNIT_HERTZ "Hz"
#define D_UNIT_HOUR "Hr"
#define D_UNIT_GALLONS "gal"
#define D_UNIT_GALLONS_PER_MIN "g/m"
#define D_UNIT_INCREMENTS "inc"
#define D_UNIT_KILOGRAM "kg"
#define D_UNIT_KILOMETER_PER_HOUR "km/h" // or "km/h"

View File

@ -93,6 +93,7 @@
#define D_FALLBACK_TOPIC "fallback topik"
#define D_FALSE "Hamis"
#define D_FILE "Fájl"
#define D_FLOW_RATE "Flow rate"
#define D_FREE_MEMORY "Szabad memória"
#define D_FREQUENCY "Frekvencia"
#define D_GAS "Gáz"
@ -156,6 +157,7 @@
#define D_TO "-nak"
#define D_TOGGLE "Megfordítás"
#define D_TOPIC "Topic"
#define D_TOTAL_USAGE "Total Usage"
#define D_TRANSMIT "Továbbít"
#define D_TRUE "Igaz"
#define D_TVOC "TVOC"
@ -492,6 +494,9 @@
#define D_TX20_SOUTH "D"
#define D_TX20_WEST "NY"
//xsns_43_hre.ino
#define D_LOG_HRE "HRE: "
// sonoff_template.h - keep them as short as possible to be able to fit them in GUI drop down box
#define D_SENSOR_NONE "Nincs"
#define D_SENSOR_USER "User"
@ -576,12 +581,16 @@
#define D_SENSOR_TXD "Serial Tx"
#define D_SENSOR_RXD "Serial Rx"
#define D_SENSOR_ROTARY "Rotary" // Suffix "1A"
#define D_SENSOR_HRE_CLOCK "HRE Clock"
#define D_SENSOR_HRE_DATA "HRE Data"
// Units
#define D_UNIT_AMPERE "A"
#define D_UNIT_CENTIMETER "cm"
#define D_UNIT_HERTZ "Hz"
#define D_UNIT_HOUR "h"
#define D_UNIT_GALLONS "gal"
#define D_UNIT_GALLONS_PER_MIN "g/m"
#define D_UNIT_INCREMENTS "inc"
#define D_UNIT_KILOGRAM "kg"
#define D_UNIT_KILOMETER_PER_HOUR "km/h" // or "km/h"

View File

@ -93,6 +93,7 @@
#define D_FALLBACK_TOPIC "Topic Riserva"
#define D_FALSE "Falso"
#define D_FILE "File"
#define D_FLOW_RATE "Flow rate"
#define D_FREE_MEMORY "Memoria Libera"
#define D_FREQUENCY "Frequenza"
#define D_GAS "Gas"
@ -156,6 +157,7 @@
#define D_TO "a"
#define D_TOGGLE "Toggle"
#define D_TOPIC "Topic"
#define D_TOTAL_USAGE "Total Usage"
#define D_TRANSMIT "Trasmesso"
#define D_TRUE "Vero"
#define D_TVOC "TVOC"
@ -492,6 +494,9 @@
#define D_TX20_SOUTH "S"
#define D_TX20_WEST "W"
//xsns_43_hre.ino
#define D_LOG_HRE "HRE: "
// sonoff_template.h - keep them as short as possible to be able to fit them in GUI drop down box
#define D_SENSOR_NONE "Nessuno"
#define D_SENSOR_USER "User"
@ -576,12 +581,16 @@
#define D_SENSOR_TXD "Serial Tx"
#define D_SENSOR_RXD "Serial Rx"
#define D_SENSOR_ROTARY "Rotary" // Suffix "1A"
#define D_SENSOR_HRE_CLOCK "HRE Clock"
#define D_SENSOR_HRE_DATA "HRE Data"
// Units
#define D_UNIT_AMPERE "A"
#define D_UNIT_CENTIMETER "cm"
#define D_UNIT_HERTZ "Hz"
#define D_UNIT_HOUR "Hr"
#define D_UNIT_GALLONS "gal"
#define D_UNIT_GALLONS_PER_MIN "g/m"
#define D_UNIT_INCREMENTS "inc"
#define D_UNIT_KILOGRAM "kg"
#define D_UNIT_KILOMETER_PER_HOUR "km/h" // or "km/h"

View File

@ -93,6 +93,7 @@
#define D_FALLBACK_TOPIC "Fallback Topic"
#define D_FALSE "거짓"
#define D_FILE "파일"
#define D_FLOW_RATE "Flow rate"
#define D_FREE_MEMORY "남은 메모리"
#define D_FREQUENCY "빈도"
#define D_GAS "가스"
@ -156,6 +157,7 @@
#define D_TO "to"
#define D_TOGGLE "전환"
#define D_TOPIC "Topic"
#define D_TOTAL_USAGE "Total Usage"
#define D_TRANSMIT "전송"
#define D_TRUE "참"
#define D_TVOC "TVOC"
@ -492,6 +494,9 @@
#define D_TX20_SOUTH "S"
#define D_TX20_WEST "W"
//xsns_43_hre.ino
#define D_LOG_HRE "HRE: "
// sonoff_template.h - keep them as short as possible to be able to fit them in GUI drop down box
#define D_SENSOR_NONE "없음"
#define D_SENSOR_USER "User"
@ -576,12 +581,16 @@
#define D_SENSOR_TXD "Serial Tx"
#define D_SENSOR_RXD "Serial Rx"
#define D_SENSOR_ROTARY "Rotary" // Suffix "1A"
#define D_SENSOR_HRE_CLOCK "HRE Clock"
#define D_SENSOR_HRE_DATA "HRE Data"
// Units
#define D_UNIT_AMPERE "A"
#define D_UNIT_CENTIMETER "cm"
#define D_UNIT_HERTZ "Hz"
#define D_UNIT_HOUR "시"
#define D_UNIT_GALLONS "gal"
#define D_UNIT_GALLONS_PER_MIN "g/m"
#define D_UNIT_INCREMENTS "inc"
#define D_UNIT_KILOGRAM "kg"
#define D_UNIT_KILOMETER_PER_HOUR "km/h" // or "km/h"

View File

@ -93,6 +93,7 @@
#define D_FALLBACK_TOPIC "Fallback Topic"
#define D_FALSE "Onwaar"
#define D_FILE "Bestand"
#define D_FLOW_RATE "Flow rate"
#define D_FREE_MEMORY "Vrij geheugen"
#define D_FREQUENCY "Frequentie"
#define D_GAS "Gas"
@ -156,6 +157,7 @@
#define D_TO "naar"
#define D_TOGGLE "Toggle" // Wissel, Tuimel
#define D_TOPIC "Topic" // Onderwerp
#define D_TOTAL_USAGE "Total Usage"
#define D_TRANSMIT "Verzend"
#define D_TRUE "Waar"
#define D_TVOC "TVOC"
@ -492,6 +494,9 @@
#define D_TX20_SOUTH "S"
#define D_TX20_WEST "W"
//xsns_43_hre.ino
#define D_LOG_HRE "HRE: "
// sonoff_template.h - keep them as short as possible to be able to fit them in GUI drop down box
#define D_SENSOR_NONE "Geen"
#define D_SENSOR_USER "Gebruiker"
@ -576,12 +581,16 @@
#define D_SENSOR_TXD "Serial Tx"
#define D_SENSOR_RXD "Serial Rx"
#define D_SENSOR_ROTARY "Rotary" // Suffix "1A"
#define D_SENSOR_HRE_CLOCK "HRE Clock"
#define D_SENSOR_HRE_DATA "HRE Data"
// Units
#define D_UNIT_AMPERE "A"
#define D_UNIT_CENTIMETER "cm"
#define D_UNIT_HERTZ "Hz"
#define D_UNIT_HOUR "h"
#define D_UNIT_GALLONS "gal"
#define D_UNIT_GALLONS_PER_MIN "g/m"
#define D_UNIT_INCREMENTS "inc"
#define D_UNIT_KILOGRAM "kg"
#define D_UNIT_KILOMETER_PER_HOUR "km/h" // or "km/h"

View File

@ -93,6 +93,7 @@
#define D_FALLBACK_TOPIC "Zastępczy temat"
#define D_FALSE "Fałsz"
#define D_FILE "Plik"
#define D_FLOW_RATE "Flow rate"
#define D_FREE_MEMORY "Wolna pamięć"
#define D_FREQUENCY "Frequency"
#define D_GAS "Gas"
@ -156,6 +157,7 @@
#define D_TO "do"
#define D_TOGGLE "Przełącz"
#define D_TOPIC "Temat"
#define D_TOTAL_USAGE "Total Usage"
#define D_TRANSMIT "Wyślij"
#define D_TRUE "Prawda"
#define D_TVOC "TVOC"
@ -492,6 +494,9 @@
#define D_TX20_SOUTH "S"
#define D_TX20_WEST "W"
//xsns_43_hre.ino
#define D_LOG_HRE "HRE: "
// sonoff_template.h - keep them as short as possible to be able to fit them in GUI drop down box
#define D_SENSOR_NONE "Brak"
#define D_SENSOR_USER "User"
@ -576,12 +581,16 @@
#define D_SENSOR_TXD "Serial Tx"
#define D_SENSOR_RXD "Serial Rx"
#define D_SENSOR_ROTARY "Rotary" // Suffix "1A"
#define D_SENSOR_HRE_CLOCK "HRE Clock"
#define D_SENSOR_HRE_DATA "HRE Data"
// Units
#define D_UNIT_AMPERE "A"
#define D_UNIT_CENTIMETER "cm"
#define D_UNIT_HERTZ "Hz"
#define D_UNIT_HOUR "Godz"
#define D_UNIT_GALLONS "gal"
#define D_UNIT_GALLONS_PER_MIN "g/m"
#define D_UNIT_INCREMENTS "inc"
#define D_UNIT_KILOGRAM "kg"
#define D_UNIT_KILOMETER_PER_HOUR "km/h" // or "km/h"

View File

@ -93,6 +93,7 @@
#define D_FALLBACK_TOPIC "Tópico para retornar"
#define D_FALSE "Falso"
#define D_FILE "Arquivo"
#define D_FLOW_RATE "Flow rate"
#define D_FREE_MEMORY "Memória livre"
#define D_FREQUENCY "Frequência"
#define D_GAS "Gás"
@ -156,6 +157,7 @@
#define D_TO "Para"
#define D_TOGGLE "Inverter"
#define D_TOPIC "Tópico"
#define D_TOTAL_USAGE "Total Usage"
#define D_TRANSMIT "Transmitir"
#define D_TRUE "Verdadeiro"
#define D_TVOC "TVOC"
@ -492,6 +494,9 @@
#define D_TX20_SOUTH "S"
#define D_TX20_WEST "W"
//xsns_43_hre.ino
#define D_LOG_HRE "HRE: "
// sonoff_template.h - keep them as short as possible to be able to fit them in GUI drop down box
#define D_SENSOR_NONE "Nenhum"
#define D_SENSOR_USER "User"
@ -576,12 +581,16 @@
#define D_SENSOR_TXD "Serial Tx"
#define D_SENSOR_RXD "Serial Rx"
#define D_SENSOR_ROTARY "Rotary" // Suffix "1A"
#define D_SENSOR_HRE_CLOCK "HRE Clock"
#define D_SENSOR_HRE_DATA "HRE Data"
// Units
#define D_UNIT_AMPERE "A"
#define D_UNIT_CENTIMETER "cm"
#define D_UNIT_HERTZ "Hz"
#define D_UNIT_HOUR "H"
#define D_UNIT_GALLONS "gal"
#define D_UNIT_GALLONS_PER_MIN "g/m"
#define D_UNIT_INCREMENTS "inc"
#define D_UNIT_KILOGRAM "kg"
#define D_UNIT_KILOMETER_PER_HOUR "km/h" // or "km/h"

View File

@ -93,6 +93,7 @@
#define D_FALLBACK_TOPIC "Tópico para retornar"
#define D_FALSE "Falso"
#define D_FILE "Ficheiro"
#define D_FLOW_RATE "Flow rate"
#define D_FREE_MEMORY "Memoria Livre"
#define D_FREQUENCY "Frequency"
#define D_GAS "Gás"
@ -156,6 +157,7 @@
#define D_TO "para"
#define D_TOGGLE "Pressionar"
#define D_TOPIC "Tópico"
#define D_TOTAL_USAGE "Total Usage"
#define D_TRANSMIT "Transmitir"
#define D_TRUE "Verdadeiro"
#define D_TVOC "TVOC"
@ -492,6 +494,9 @@
#define D_TX20_SOUTH "S"
#define D_TX20_WEST "W"
//xsns_43_hre.ino
#define D_LOG_HRE "HRE: "
// sonoff_template.h - keep them as short as possible to be able to fit them in GUI drop down box
#define D_SENSOR_NONE "Nenhum"
#define D_SENSOR_USER "User"
@ -576,12 +581,16 @@
#define D_SENSOR_TXD "Serial Tx"
#define D_SENSOR_RXD "Serial Rx"
#define D_SENSOR_ROTARY "Rotary" // Suffix "1A"
#define D_SENSOR_HRE_CLOCK "HRE Clock"
#define D_SENSOR_HRE_DATA "HRE Data"
// Units
#define D_UNIT_AMPERE "A"
#define D_UNIT_CENTIMETER "cm"
#define D_UNIT_HERTZ "Hz"
#define D_UNIT_HOUR "Hr"
#define D_UNIT_GALLONS "gal"
#define D_UNIT_GALLONS_PER_MIN "g/m"
#define D_UNIT_INCREMENTS "inc"
#define D_UNIT_KILOGRAM "kg"
#define D_UNIT_KILOMETER_PER_HOUR "km/h" // or "km/h"

View File

@ -93,6 +93,7 @@
#define D_FALLBACK_TOPIC "Топик обратной связи"
#define D_FALSE "Ложно"
#define D_FILE "Файл"
#define D_FLOW_RATE "Flow rate"
#define D_FREE_MEMORY "Свободная память"
#define D_FREQUENCY "Frequency"
#define D_GAS "Газ"
@ -156,6 +157,7 @@
#define D_TO "до"
#define D_TOGGLE "Переключить"
#define D_TOPIC "Топик"
#define D_TOTAL_USAGE "Total Usage"
#define D_TRANSMIT "Передать"
#define D_TRUE "Истина"
#define D_TVOC "TVOC"
@ -492,6 +494,9 @@
#define D_TX20_SOUTH "S"
#define D_TX20_WEST "W"
//xsns_43_hre.ino
#define D_LOG_HRE "HRE: "
// sonoff_template.h - keep them as short as possible to be able to fit them in GUI drop down box
#define D_SENSOR_NONE "-нет-"
#define D_SENSOR_USER "User"
@ -576,12 +581,16 @@
#define D_SENSOR_TXD "Serial Tx"
#define D_SENSOR_RXD "Serial Rx"
#define D_SENSOR_ROTARY "Rotary" // Suffix "1A"
#define D_SENSOR_HRE_CLOCK "HRE Clock"
#define D_SENSOR_HRE_DATA "HRE Data"
// Units
#define D_UNIT_AMPERE "А"
#define D_UNIT_CENTIMETER "cm"
#define D_UNIT_HERTZ "Hz"
#define D_UNIT_HOUR "Ч"
#define D_UNIT_GALLONS "gal"
#define D_UNIT_GALLONS_PER_MIN "g/m"
#define D_UNIT_INCREMENTS "inc"
#define D_UNIT_KILOGRAM "kg"
#define D_UNIT_KILOMETER_PER_HOUR "km/h" // or "km/h"

View File

@ -75,6 +75,7 @@
#define D_COUNTER "Počítadlo"
#define D_CURRENT "Prúd" // As in Voltage and Current
#define D_DATA "Dáta"
#define D_FLOW_RATE "Flow rate"
#define D_DARKLIGHT "Tmavý"
#define D_DEBUG "Debug"
#define D_DISABLED "Zablokované"
@ -156,6 +157,7 @@
#define D_TO "do"
#define D_TOGGLE "Prepni"
#define D_TOPIC "Topic"
#define D_TOTAL_USAGE "Total Usage"
#define D_TRANSMIT "Odošli"
#define D_TRUE "Pravda"
#define D_TVOC "TVOC"
@ -492,6 +494,9 @@
#define D_TX20_SOUTH "J"
#define D_TX20_WEST "Z"
//xsns_43_hre.ino
#define D_LOG_HRE "HRE: "
// sonoff_template.h - keep them as short as possible to be able to fit them in GUI drop down box
#define D_SENSOR_NONE "Žiaden"
#define D_SENSOR_USER "User"
@ -576,12 +581,16 @@
#define D_SENSOR_TXD "Serial Tx"
#define D_SENSOR_RXD "Serial Rx"
#define D_SENSOR_ROTARY "Rotary" // Suffix "1A"
#define D_SENSOR_HRE_CLOCK "HRE Clock"
#define D_SENSOR_HRE_DATA "HRE Data"
// Units
#define D_UNIT_AMPERE "A"
#define D_UNIT_CENTIMETER "cm"
#define D_UNIT_HERTZ "Hz"
#define D_UNIT_HOUR "hod"
#define D_UNIT_GALLONS "gal"
#define D_UNIT_GALLONS_PER_MIN "g/m"
#define D_UNIT_KILOGRAM "kg"
#define D_UNIT_INCREMENTS "inc"
#define D_UNIT_KILOMETER_PER_HOUR "km/h" // or "km/h"

View File

@ -93,6 +93,7 @@
#define D_FALLBACK_TOPIC "Reservämne"
#define D_FALSE "Falskt"
#define D_FILE "Fil"
#define D_FLOW_RATE "Flow rate"
#define D_FREE_MEMORY "Ledigt minne"
#define D_FREQUENCY "Frekvens"
#define D_GAS "Gas"
@ -156,6 +157,7 @@
#define D_TO "till"
#define D_TOGGLE "Växla"
#define D_TOPIC "Ämne"
#define D_TOTAL_USAGE "Total Usage"
#define D_TRANSMIT "Sänd"
#define D_TRUE "Sant"
#define D_TVOC "TVOC"
@ -492,6 +494,9 @@
#define D_TX20_SOUTH "S"
#define D_TX20_WEST "V"
//xsns_43_hre.ino
#define D_LOG_HRE "HRE: "
// sonoff_template.h - keep them as short as possible to be able to fit them in GUI drop down box
#define D_SENSOR_NONE "Ingen"
#define D_SENSOR_USER "User"
@ -576,12 +581,16 @@
#define D_SENSOR_TXD "Serial Tx"
#define D_SENSOR_RXD "Serial Rx"
#define D_SENSOR_ROTARY "Rotary" // Suffix "1A"
#define D_SENSOR_HRE_CLOCK "HRE Clock"
#define D_SENSOR_HRE_DATA "HRE Data"
// Units
#define D_UNIT_AMPERE "A"
#define D_UNIT_CENTIMETER "cm"
#define D_UNIT_HERTZ "Hz"
#define D_UNIT_HOUR "Tim"
#define D_UNIT_GALLONS "gal"
#define D_UNIT_GALLONS_PER_MIN "g/m"
#define D_UNIT_INCREMENTS "ink"
#define D_UNIT_KILOGRAM "kg"
#define D_UNIT_KILOMETER_PER_HOUR "km/h" // or "km/h"

View File

@ -93,6 +93,7 @@
#define D_FALLBACK_TOPIC "Geri İletim Topiği"
#define D_FALSE "False"
#define D_FILE "Dosya"
#define D_FLOW_RATE "Flow rate"
#define D_FREE_MEMORY "Boş Hafıza"
#define D_FREQUENCY "Frekans"
#define D_GAS "Gas"
@ -156,6 +157,7 @@
#define D_TO "den"
#define D_TOGGLE "Geçiş Tuşu"
#define D_TOPIC "Başlık"
#define D_TOTAL_USAGE "Total Usage"
#define D_TRANSMIT "İletim"
#define D_TRUE "True"
#define D_TVOC "TVOC"
@ -492,6 +494,9 @@
#define D_TX20_SOUTH "S"
#define D_TX20_WEST "W"
//xsns_43_hre.ino
#define D_LOG_HRE "HRE: "
// sonoff_template.h - keep them as short as possible to be able to fit them in GUI drop down box
#define D_SENSOR_NONE "None"
#define D_SENSOR_USER "User"
@ -576,11 +581,15 @@
#define D_SENSOR_TXD "Serial Tx"
#define D_SENSOR_RXD "Serial Rx"
#define D_SENSOR_ROTARY "Rotary" // Suffix "1A"
#define D_SENSOR_HRE_CLOCK "HRE Clock"
#define D_SENSOR_HRE_DATA "HRE Data"
// Units
#define D_UNIT_AMPERE "A"
#define D_UNIT_CENTIMETER "cm"
#define D_UNIT_HOUR "Hr"
#define D_UNIT_GALLONS "gal"
#define D_UNIT_GALLONS_PER_MIN "g/m"
#define D_UNIT_INCREMENTS "inc"
#define D_UNIT_KILOGRAM "kg"
#define D_UNIT_KILOMETER_PER_HOUR "km/h" // or "km/h"

View File

@ -93,6 +93,7 @@
#define D_FALLBACK_TOPIC "Топік зворотнього зв'язку"
#define D_FALSE "Помилково"
#define D_FILE "Файл"
#define D_FLOW_RATE "Flow rate"
#define D_FREE_MEMORY "Вільна память"
#define D_FREQUENCY "Частота"
#define D_GAS "Газ"
@ -156,6 +157,7 @@
#define D_TO "до"
#define D_TOGGLE "Перекл."
#define D_TOPIC "Топік"
#define D_TOTAL_USAGE "Total Usage"
#define D_TRANSMIT "Передати"
#define D_TRUE "Істина"
#define D_TVOC "TVOC"
@ -492,6 +494,9 @@
#define D_TX20_SOUTH "S"
#define D_TX20_WEST "W"
//xsns_43_hre.ino
#define D_LOG_HRE "HRE: "
// sonoff_template.h - keep them as short as possible to be able to fit them in GUI drop down box
#define D_SENSOR_NONE "-відсутньо-"
#define D_SENSOR_USER "User"
@ -576,12 +581,16 @@
#define D_SENSOR_TXD "Serial Tx"
#define D_SENSOR_RXD "Serial Rx"
#define D_SENSOR_ROTARY "Rotary" // Suffix "1A"
#define D_SENSOR_HRE_CLOCK "HRE Clock"
#define D_SENSOR_HRE_DATA "HRE Data"
// Units
#define D_UNIT_AMPERE "А"
#define D_UNIT_CENTIMETER "cм"
#define D_UNIT_HERTZ "Гц"
#define D_UNIT_HOUR "Г"
#define D_UNIT_GALLONS "gal"
#define D_UNIT_GALLONS_PER_MIN "g/m"
#define D_UNIT_INCREMENTS "inc"
#define D_UNIT_KILOGRAM "kg"
#define D_UNIT_KILOMETER_PER_HOUR "km/h" // or "km/h"

View File

@ -93,6 +93,7 @@
#define D_FALLBACK_TOPIC "回退主题"
#define D_FALSE "False"
#define D_FILE "文件:"
#define D_FLOW_RATE "Flow rate"
#define D_FREE_MEMORY "空闲内存"
#define D_FREQUENCY "频率"
#define D_GAS "气体"
@ -156,6 +157,7 @@
#define D_TO "to"
#define D_TOGGLE "切换"
#define D_TOPIC "主题"
#define D_TOTAL_USAGE "Total Usage"
#define D_TRANSMIT "发送"
#define D_TRUE "True"
#define D_TVOC "TVOC"
@ -492,6 +494,9 @@
#define D_TX20_SOUTH "南"
#define D_TX20_WEST "西"
//xsns_43_hre.ino
#define D_LOG_HRE "HRE: "
// sonoff_template.h - keep them as short as possible to be able to fit them in GUI drop down box
#define D_SENSOR_NONE "无"
#define D_SENSOR_USER "User"
@ -576,11 +581,15 @@
#define D_SENSOR_TXD "Serial Tx"
#define D_SENSOR_RXD "Serial Rx"
#define D_SENSOR_ROTARY "Rotary" // Suffix "1A"
#define D_SENSOR_HRE_CLOCK "HRE Clock"
#define D_SENSOR_HRE_DATA "HRE Data"
// Units
#define D_UNIT_AMPERE "安"
#define D_UNIT_CENTIMETER "厘米"
#define D_UNIT_HOUR "时"
#define D_UNIT_GALLONS "gal"
#define D_UNIT_GALLONS_PER_MIN "g/m"
#define D_UNIT_INCREMENTS "inc"
#define D_UNIT_KILOGRAM "千克"
#define D_UNIT_KILOMETER_PER_HOUR "公里/时" // or "km/h"

View File

@ -93,6 +93,7 @@
#define D_FALLBACK_TOPIC "Fallback Topic"
#define D_FALSE "False"
#define D_FILE "文件:"
#define D_FLOW_RATE "Flow rate"
#define D_FREE_MEMORY "可用記憶體"
#define D_FREQUENCY "Frequency"
#define D_GAS "氣體"
@ -156,6 +157,7 @@
#define D_TO "to"
#define D_TOGGLE "切換"
#define D_TOPIC "主題"
#define D_TOTAL_USAGE "Total Usage"
#define D_TRANSMIT "發送"
#define D_TRUE "True"
#define D_TVOC "TVOC"
@ -492,6 +494,9 @@
#define D_TX20_SOUTH "S"
#define D_TX20_WEST "W"
//xsns_43_hre.ino
#define D_LOG_HRE "HRE: "
// sonoff_template.h - keep them as short as possible to be able to fit them in GUI drop down box
#define D_SENSOR_NONE "None"
#define D_SENSOR_USER "User"
@ -576,12 +581,16 @@
#define D_SENSOR_TXD "Serial Tx"
#define D_SENSOR_RXD "Serial Rx"
#define D_SENSOR_ROTARY "Rotary" // Suffix "1A"
#define D_SENSOR_HRE_CLOCK "HRE Clock"
#define D_SENSOR_HRE_DATA "HRE Data"
// Units
#define D_UNIT_AMPERE "安"
#define D_UNIT_CENTIMETER "cm"
#define D_UNIT_HERTZ "Hz"
#define D_UNIT_HOUR "時"
#define D_UNIT_GALLONS "gal"
#define D_UNIT_GALLONS_PER_MIN "g/m"
#define D_UNIT_INCREMENTS "inc"
#define D_UNIT_KILOGRAM "kg"
#define D_UNIT_KILOMETER_PER_HOUR "km/h" // or "km/h"

View File

@ -178,6 +178,8 @@ enum UserSelectablePins {
GPIO_ROT1B, // Rotary switch1 B Pin
GPIO_ROT2A, // Rotary switch2 A Pin
GPIO_ROT2B, // Rotary switch2 B Pin
GPIO_HRE_CLOCK, // Clock/Power line for HR-E Water Meter
GPIO_HRE_DATA, // Data line for HR-E Water Meter
GPIO_SENSOR_END };
// Programmer selectable GPIO functionality
@ -241,6 +243,7 @@ const char kSensorNames[] PROGMEM =
D_SENSOR_CSE7766_TX "|" D_SENSOR_CSE7766_RX "|"
D_SENSOR_ARIRFRCV "|" D_SENSOR_TXD "|" D_SENSOR_RXD "|"
D_SENSOR_ROTARY "1a|" D_SENSOR_ROTARY "1b|" D_SENSOR_ROTARY "2a|" D_SENSOR_ROTARY "2b|"
D_SENSOR_HRE_CLOCK "|" D_SENSOR_HRE_DATA "|"
;
/********************************************************************************************/
@ -584,7 +587,11 @@ const uint8_t kGpioNiceList[] PROGMEM = {
GPIO_ROT1B, // Rotary switch1 B Pin
GPIO_ROT2A, // Rotary switch2 A Pin
GPIO_ROT2B, // Rotary switch2 B Pin
GPIO_ARIRFRCV // AliLux RF Receive input
GPIO_ARIRFRCV, // AliLux RF Receive input
#ifdef USE_HRE
GPIO_HRE_CLOCK,
GPIO_HRE_DATA
#endif
};
const uint8_t kModuleNiceList[MAXMODULE] PROGMEM = {

289
sonoff/xsns_43_hre.ino Normal file
View File

@ -0,0 +1,289 @@
/*
xsns_43_hre.ino - Badger HR-E Water Meter Encoder interface
Copyright (C) 2019 Jon Little
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/>.
*/
/*********************************************************************************************\
* HR-E LCD Water meter register interface
*
* https://www.badgermeter.com/business-lines/utility/high-resolution-lcd-encoders-hr-e-lcd/
* Source: Jon Little, https://github.com/burundiocibu/particle/blob/master/water_meter/src/HRE_Reader.cpp
*
* This code marches the bits out the data line as ASCII characters with the form
* KG44?Q45484=0444444V;RB000000022;IB018435683
* where the RB...; is the miligalons used
*
* Note that this sensor takes a _long_ time to read. 62 bits * 4 ms/bit for the
* sync sequence plus 46 bytes * 40 ms/byte = 2088 ms minimum. If we aren't alligned
* to the sync sequence, it could be almost twice that.
* To keep from bogging the kernel down, we read 8 bits at a time on the 50 ms callback.
* It will take seconds to discover if the device is there.
*
* In lieu of an actual schematic to describe the electrical interface, here is a description:
*
* hre_clock_pin: drives the power/clock for the water meter through a 1k resister to
* the base of a pnp transistor
* hre_data_pin: is the data and has a 1 k pulldown
*
* The pnp transitor has the collector connected to the power/clock and is pulled up
* to +5 via a 1 k resistor.
* The emitter is connected to ground
*
\*********************************************************************************************/
#ifdef USE_HRE
#define XSNS_43 43
enum hre_states {
hre_idle, // Initial state,
hre_sync, // Start search for sync sequence
hre_syncing, // Searching for sync sequence
hre_read, // Start reading data block
hre_reading, // Reading data
hre_sleep, // Start sleeping
hre_sleeping // pausing before reading again
};
hre_states hre_state = hre_idle;
float hre_usage = 0; // total water usage, in gal
float hre_rate = 0; // flow rate, in gal/min
uint32_t hre_usage_time = 0; // uptime associated with hre_usage and hre_rate
int hre_read_errors = 0; // total number of read errors since boot
bool hre_good = false;
// The settling times here were determined using a single unit hooked to a scope
int hreReadBit()
{
digitalWrite(pin[GPIO_HRE_CLOCK], HIGH);
delay(1);
int bit = digitalRead(pin[GPIO_HRE_DATA]);
digitalWrite(pin[GPIO_HRE_CLOCK], LOW);
delay(1);
return bit;
}
// With the times in the HreReadBit routine, a characer will take
// 20 ms plus io time.
char hreReadChar(int &parity_errors)
{
// start bit
hreReadBit();
unsigned ch=0;
int sum=0;
for (int i=0; i<7; i++)
{
int b = hreReadBit();
ch |= b << i;
sum += b;
}
// parity
if ( (sum & 0x1) != hreReadBit())
parity_errors++;
// stop bit
hreReadBit();
return ch;
}
void hreInit(void)
{
hre_read_errors = 0;
hre_good = false;
pinMode(pin[GPIO_HRE_CLOCK], OUTPUT);
pinMode(pin[GPIO_HRE_DATA], INPUT);
// Note that the level shifter inverts this line and we want to leave it
// high when not being read.
digitalWrite(pin[GPIO_HRE_CLOCK], LOW);
hre_state = hre_sync;
}
void hreEvery50ms(void)
{
static int sync_counter = 0; // Number of sync bit reads
static int sync_run = 0; // Number of consecutive '1's read
static uint32_t curr_start = 0; // uptime when entered hre_reading for current read
static int read_counter = 0; // number of bytes in the current read
static int parity_errors = 0; // Number of parity errors in current read
static char buff[46]; // 8 char and a term
static char ch;
static size_t i;
switch (hre_state)
{
case hre_sync:
if (uptime < 10)
break;
sync_run = 0;
sync_counter = 0;
hre_state = hre_syncing;
AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_HRE "hre_state:hre_syncing"));
break;
case hre_syncing:
// Find the header, a string of 62 '1's
// Since each bit taks 2 ms, we just read 20 bits at a time
for (int i=0; i<20; i++)
{
if (hreReadBit())
sync_run++;
else
sync_run = 0;
if (sync_run == 62)
{
hre_state = hre_read;
break;
}
sync_counter++;
}
// If the meter doesn't get in sync within 1000 bits, give up for now
if (sync_counter > 1000)
{
hre_state = hre_sleep;
AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_HRE D_ERROR));
}
break;
// Start reading the data block
case hre_read:
AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_HRE "sync_run:%d, sync_counter:%d"), sync_run, sync_counter);
read_counter = 0;
parity_errors = 0;
curr_start = uptime;
memset(buff, 0, sizeof(buff));
hre_state = hre_reading;
AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_HRE "hre_state:hre_reading"));
// So this is intended to fall through to the hre_reading section.
// it seems that if there is much of a delay between getting the sync
// bits and starting the read, the HRE won't output the message we
// are looking for...
case hre_reading:
// Read two characters at a time...
buff[read_counter++] = hreReadChar(parity_errors);
buff[read_counter++] = hreReadChar(parity_errors);
if (read_counter == 46)
{
AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_HRE "pe:%d, re:%d, buff:%s"),
parity_errors, hre_read_errors, buff);
if (parity_errors == 0)
{
float curr_usage;
curr_usage = 0.01 * atol(buff+24); // useage in gal
if (hre_usage_time)
{
double dt = 1.666e-2 * (curr_start - hre_usage_time); // dt in minutes
hre_rate = (curr_usage - hre_usage)/dt; // gallons/min
}
hre_usage = curr_usage;
hre_usage_time = curr_start;
hre_good = true;
hre_state = hre_sleep;
}
else
{
hre_read_errors++;
hre_state = hre_sleep;
}
}
break;
case hre_sleep:
hre_usage_time = curr_start;
hre_state = hre_sleeping;
AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_HRE "hre_state:hre_sleeping"));
case hre_sleeping:
// If there isn't some delay between readings, rate calculations
// aren't as accurate. 27 seconds will give about a 30 second refresh rate
if (uptime - hre_usage_time >= 27)
hre_state = hre_sync;
}
}
void hreShow(boolean json)
{
if (!hre_good)
return;
const char *id = "HRE";
char usage[16];
char rate[16];
dtostrfd(hre_usage, 2, usage);
dtostrfd(hre_rate, 3, rate);
if (json)
{
ResponseAppend_P(JSON_SNS_GNGPM, id, usage, rate);
#ifdef USE_WEBSERVER
}
else
{
WSContentSend_PD(HTTP_SNS_GALLONS, id, usage);
WSContentSend_PD(HTTP_SNS_GPM, id, rate);
#endif // USE_WEBSERVER
}
}
/*********************************************************************************************\
* Interface
\*********************************************************************************************/
bool Xsns43(byte function)
{
// If we don't have pins assigned give up quickly.
if (pin[GPIO_HRE_CLOCK] >= 99 || pin[GPIO_HRE_DATA] >= 99)
return false;
switch (function)
{
case FUNC_INIT:
hreInit();
break;
case FUNC_EVERY_50_MSECOND:
hreEvery50ms();
break;
case FUNC_EVERY_SECOND:
break;
case FUNC_JSON_APPEND:
hreShow(1);
break;
#ifdef USE_WEBSERVER
case FUNC_WEB_SENSOR:
hreShow(0);
break;
#endif // USE_WEBSERVER
}
return false;
}
#endif // USE_HRE