Updated Smart Meter Interface (markdown)

Michael Ingraham 2019-09-07 12:21:21 -04:00
parent 543c53765e
commit 4a9609082a
1 changed files with 41 additions and 51 deletions

@ -1,86 +1,76 @@
**Driver for various meters , heating devices and reed like contacts**
**Driver for various meters , heating devices, and reed like contacts**
[Smart Meter Descriptors](Smart-Meter-Interface-Descriptors)
**supports the following signals:**
- asci OBIS telegrams emitted from many smart meters and also from P1 meter interface
**The following types of meter protocols are supported:**
- ascii OBIS telegrams emitted from many smart meters and also from P1 meter interface
- binary SML OBIS telegram emitted from many smart meters
- binary EBUS telegram emitted by many heaters and heat pumps (e.g. Vaillant, Wolf)
- binary MODBUS telegram used by many power meters
- binary RAW telegram decodes all kinds of binary data eg EMS heater bus
- counter interface (uses Tasmota counter storage) for e.g. reed contacts either in polling or IRQ mode
there may be more then one software serial driven meter
There may be more than one software serial driven meter. There are dozens of variants and use cases for this driver and this requires a means of defining these variants. This is done through so called [meter descriptors](Smart-Meter-Interface-Descriptors).
there are dozens of variants and use cases for this driver and this requires a means of defining these variants
A method exists already in Tasmota to define a meter by `#define` pragmas in the compiler. This requires recompiling the driver after each modification.
this is done through so called meter descriptors
The new, preferred, method uses the scripting language editor to define the descriptors in an `>M` section. For this only one firmware binary version is required and a modification can be made easily "on the fly".
the recent method which is still available is defining a meter by `#define` pragmas in the compiler
this requires recompiling the driver after each modification
The driver reverts to the default `#define` definition if no `>M` section is found in the script or [scripting](Scripting-Language) is not compiled.
## Descriptor Syntax
Define an `>M` section with the number of meters to be connected (up to 5) - e.g. `>M 3`
the new preferred method is using the script editor to define the descriptors in an `>M` section
for this only one software version is required and a modification can be easily made on the fly.
Definitions are according to the type of interface for each meter.
the driver falls back to the default #define definition if no `>M` section is found in scripter or scripter is not compiled
**Descriptor defintion**
in script editor define a section called M with the number of different meters wanted (up to 5)
e.g. >M 3
next is defining the type of interface for each meter, seperated by commas
**e.g. +1,3,o,0,9600,OBIS**
`+1,3,o,0,9600,OBIS`
- `+1` adds the meter number 1
- the source GPIO pin of signal => here 3 => RX pin
- the type of meter => `o`=obis ASCI type of coding, `s`=sml binary smart message coding, `c`=counter type, `e`=ebus binary coding, `m`=modbus binary coding,`r`=raw binary coding (any binary telegram).
- the type of meter => `o`=obis ASCII type of coding, `s`=sml binary smart message coding, `c`=counter type, `e`=ebus binary coding, `m`=modbus binary coding,`r`=raw binary coding (any binary telegram).
- flag => 0=counter without pullup, 1=with pullup
- parameter => on `o,s,e,m,r` type serial baud rate, on type `c` positive value means counter poll interval, negative value irq driven counters with this debounce time (milliseconds)
- MQTT JSON prefix up to 7 chars,this prefix is also shown in WEBUI
- in case of interactive telegram comma separated
**e.g. +1,3,m,0,9600,MODBUS,1,1,01040000,01040002,01040004,01040006,01040008,0104000a,0104000c,0104000e,01040010**
`+1,3,m,0,9600,MODBUS,1,1,01040000,01040002,01040004,01040006,01040008,0104000a,0104000c,0104000e,01040010`
- GPIO pin of transmit signal
- timeframe in 250 ms steps
- comma separated hex coded byte blocks to send to meter device, every n*250 ms, in case of modbus each block is a command to retrieve a certain register of the meter
the list of meter entries start with the meter number to which this decoder belongs. (up to 16 entries, #define MAX_VARS 16)
**e.g. 1,1-0:1.8.0*255(@1,consumption,KWh,Total_in,4**
`1,1-0:1.8.0*255(@1,consumption,KWh,Total_in,4`
- meter number, comma separated
- then until `@` char => sequence to decode OBIS as ASCI, or SML, EBUS, RAW as HEX ASCI
OBIS: asci OBIS code until the `(` char which indicates the start of the meter value
SML: SML binary OBIS as hex until FF indicating start of SML coded value
EBUS,RAW: hex values of EBUS,RAW block to compare `xx` means ignore value, `ss` = extract this signed byte, `uu` = extract this unsigned byte, `uuuu` = extract this unsigned word, `ssss` = extract this signed word, `ffffffff` = extract this float value.
decoding a bit as 0,1 is done after the `@` sign with `bx:` x=0...7 extracting the corresponding bit from a byte. e.g. 1,xxxx5017xxuu@b0:1,Solarpumpe,,Solarpump,0 extracts bit zero
in case of modbus an ix: designates the index x (0...n) referring to the demanded block in the transmit section of the meter define line. (e.g. 1,010404ffffffffxxxx@i0:1,Voltage P1,V,Voltage_P1,2)
- then until `@` char => sequence to decode OBIS as ASCI, or SML, EBUS, RAW as HEX ASCII
- OBIS: ascii OBIS code until the `(` char which indicates the start of the meter value
- SML: SML binary OBIS as hex until FF indicating start of SML coded value
- EBUS,RAW: hex values of EBUS,RAW block to compare `xx` means ignore value, `ss` = extract this signed byte, `uu` = extract this unsigned byte, `uuuu` = extract this unsigned word, `ssss` = extract this signed word, `ffffffff` = extract this float value.
- decoding a bit as 0,1 is done after the `@` sign with `bx:` x=0..7 extracting the corresponding bit from a byte.
e.g., 1,xxxx5017xxuu@b0:1,Solarpump,,Solarpump,0 extracts bit zero
- in the case of modbus, `ix` designates the index x (0..n) referring to the demanded block in the transmit section of the meter definition.
e.g., 1,010404ffffffffxxxx@i0:1,Voltage P1,V,Voltage_P1,2
- scaling factor (divisor) (may also be negative or smaller then zero e.g. 0.1 => result * 10)
when decoding a string result (e.g. meter serial) put a # char here (only in one line per meter) after the # char you need a termination char at OBIS a `)`
when decoding a string result (e.g., a serial meter) put a `#` character here (only in one line per meter). For OBIS, you need a `)` termination character after the `#` character
- name of signal in WEBUI (max 23 chars)
- unit of signal (max 7 chars)
- name of MQTT signal (max 23 chars)
- number of decimals (decimal precision) (if you add 16 here the signal is transmitted immediately else on teleperiod)
- number of decimals (decimal precision). Add 16 to transmit the data immediately. Otherwise it is transmitted on [`TelePeriod`](Commands#teleperiod)
`#` char terminates the list
`#` character terminates the list
**special cmds**
**Special Commands**
with the '=' char at the beginning of a line you may do some special decoding
- `=m` does math `+,-,*,/` a `#` before a number designates a constant number
example
`=m 3+4+5/#3` add result of decoder entry 3,4,5 and divided by 3 (average)
example:
`=m 3+4+5/#3` add result of decoder entry 3,4,5 and divided by 3 (average)
- `=d` difference calculated time difference within a decoder entry
example
`=d 3 10` calculate difference of decoder entry 3 after 10 seconds each.
example:
`=d 3 10` calculate difference of decoder entry 3 after 10 seconds each.
- `=h` html text (up to 30 chars)
inserts a html line between entries (these lines do not count as decoder entry)
inserts a html line between entries (these lines do not count as decoder entry)