Skip to content

Commit cbce879

Browse files
authored
CAN bus support
1 parent 8f2261b commit cbce879

File tree

1 file changed

+54
-4
lines changed

1 file changed

+54
-4
lines changed

docs/Smart-Meter-Interface.md

Lines changed: 54 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ Additional features can be enabled by adding the following `#define` compiler di
3434
|NO_SML_REPLACE_VARS | disables replacement of any text in descriptor by script text variables. Useful if several occurrences of a text occupies a lot of space and you get short of script buffer. Readability may get worse so only makes sense on large descriptors. Note: to use `%` symbol un measurement units, you need to escape it like `%%`.|
3535
|NO_USE_SML_DECRYPT | disables decoding of encrypted ams meters. decrypting needs TLS, so must define USE_TLS also.|
3636
|USE_SML_AUTHKEY | enables authentication, this is not needed by most energy meters.|
37-
|USE_SML_TCP | enables TCP MODBUS support.|
37+
|NO_USE_SML_TCP | disables TCP MODBUS support.|
38+
|NO_USE_SML_CANBUS | disables CANBUS support.|
3839

3940
### General description
4041

@@ -56,6 +57,7 @@ The Smart Meter Interface provides a means to connect many kinds of meters to Ta
5657
| OBIS ASCII | telegrams emitted from many smart meters, including [P1 Smart Meters](https://tasmota.github.io/docs/P1-Smart-Meter/) |
5758
| OBIS Binary SML| telegrams emitted from many smart meters |
5859
| MODBus Binary | telegrams used by many power meters and industrial devices |
60+
| CANBus Binary | telegrams used by battery monitoring systems and industrial devices |
5961
| Kamstrup Binary | telegrams used by many power meters from Kamstrup |
6062
| EBus Binary | telegrams emitted by many heaters and heat pumps (e.g. Vaillant, Wolf) |
6163
| VBus Binary | telegrams emitted by many solar thermal systems boilers (e.g. Resol, Viessmann) |
@@ -97,9 +99,9 @@ Declare `>M` section with the number of connected meters (n = `1..5`):
9799
| :--- | :--- |
98100
| `+<M>` | Meter number. The number must be increased with each additional Meter (default 1 to 5).|
99101
| `<rxGPIO>` | The GPIO pin number where meter data is received. <BR> [xxx.xxx.xxx.xxx] IP number instead of pin number enables MODBUS TCP mode, the tcp port number is given at the baudrate position. (tx pin can be any number and is ignored)|
100-
| `<type>` | The type of meter: <BR>- `o` - OBIS ASCII type of coding<BR>- `s` - SML binary smart message coding<BR>- `e` - EBus binary coding<BR>- `v` - VBus binary coding<BR>- `m` - MODBus binary coding with serial mode 8N1<BR>- `M` - MODBus binary coding with serial mode 8E1<BR>- `k` - Kamstrup binary coding with serial mode 8N1<BR>- `c` - Counter type<BR>- `r` - Raw binary coding (any binary telegram) |
102+
| `<type>` | The type of meter: <BR>- `o` - OBIS ASCII type of coding<BR>- `s` - SML binary smart message coding<BR>- `e` - EBus binary coding<BR>- `v` - VBus binary coding<BR>- `m` - MODBus binary coding with serial mode 8N1<BR>- `M` - MODBus binary coding with serial mode 8E1<BR>- `k` - Kamstrup binary coding with serial mode 8N1<BR>- `C` - CANBus type<BR>- `c` - Counter type<BR>- `r` - Raw binary coding (any binary telegram) |
101103
| `<flag>` | Options flag:<BR>- `0` - counter without pullup<BR>- `1` - counter with pullup<BR>- `16` - enable median filter for that meter. Can help with sporadic dropouts, reading errors (not available for counters). this option is enabled by default #define USE_SML_MEDIAN_FILTER, if you are low on memory and dont use this feature you may outcomment this define in the driver |
102-
| `<parameter>` | Parameters according to meter type:<BR>- for `o,s,e,v,m,M,k,r` types: serial baud rate e.g. `9600` (or port# for Modbus TCP).<BR>- for `c` type: a positive value = counter poll interval (not really recommended) or a negative value = debounce time (milliseconds) for irq driven counters. |
104+
| `<parameter>` | Parameters according to meter type:<BR>- for `o,s,e,v,m,M,k,r` types: serial baud rate e.g. `9600` (or port# for Modbus TCP).<BR>- for type `c` Canbus Baudrates and Number of receive buffers. (see example)<BR>- for `c` type: a positive value = counter poll interval (not really recommended) or a negative value = debounce time (milliseconds) for irq driven counters. |
103105
| `<jsonPrefix>` | Prefix for Web UI and MQTT JSON payload. Up to 7 characters.|
104106
| `<txGPIO>` | The GPIO pin number where meter command is transmitted (optional).|
105107
| `<tx enable>` | The GPIO pin number to enable transmitter (RS485) may follow the TX pin in bracket (pin) without a colon an 'i' in front of the pin number means 'inverted' (optional).|
@@ -218,7 +220,9 @@ With `=` character at the beginning of a line you can do some special decoding.
218220
| `M,=so5 `| sets AES authentication key for encrypted meters.must define exactly 16 hexadecimal chars<BR>e.g. not needed by most energy meters (needs USE_SML_AUTHKEY).<BR>|
219221
| `M,=so6 `| sync time in milliseconds for serial block detection with AMS meters (defaults to 1000).<BR>|
220222
| `M,=so7 `| on ESP32 force selection of UART Nr. X (0,1,2) allows coexistence with other serial drivers <BR>|
221-
223+
| `M,=so8 `| CAN bus filter mask <BR>|
224+
| `M,=so9 `| CAB bus filter <BR>|
225+
222226
!!! example
223227
To get the value of one of the descriptor lines, use `sml[X]`. `X` = Line number. Starts with `1`. (compiling with `USE_SML_SCRIPT_CMD` required)
224228
```
@@ -3208,3 +3212,49 @@ Tested on an AEConversion INV500-90 with RS485 interface.
32083212
1,030408U64@i14:1000,Batt_EntLadung,kWh,v15,3
32093213
#
32103214
```
3215+
3216+
### HUAWEI R4850G2 Lipo Charger (CANBus)
3217+
3218+
??? summary "View script"
3219+
3220+
```
3221+
>D 40
3222+
IP=192.168.188.117
3223+
ovolt=45
3224+
maxc=30
3225+
cstr=""
3226+
>B
3227+
=>sensor53 r
3228+
>S
3229+
if chg[ovolt]>0 {
3230+
; change voltage 41.5 - 58.5
3231+
cstr="908180FE0801000000"+hx(ovolt*1024)
3232+
sml(1 3 cstr)
3233+
}
3234+
if chg[maxc]>0 {
3235+
; change max current 0-60A
3236+
cstr="908180FE0801030000"+hx(maxc*20)
3237+
sml(1 3 cstr)
3238+
}
3239+
>M 1
3240+
; Huawei R4850G2
3241+
; params -> 03 = baudrate 125kb + number of receive buffers * 100
3242+
+1,7,C,0,3203,CAN,6,10,908040FE080000000000000000
3243+
1,1081407f0801700000UUuuUUuu@1024,Input Power,W,ipwr,1
3244+
1,1081407f0801710000UUuuUUuu@1024,Input Frequency,Hz,freq,1
3245+
1,1081407f0801780000UUuuUUuu@1024,Input Voltage,V,ivolt,1
3246+
1,1081407f0801720000UUuuUUuu@1024,Input Current,A,icurr,1
3247+
1,1081407f0801750000UUuuUUuu@1024,Output Voltage,V,ovolt,1
3248+
1,1081407f0801810000UUuuUUuu@1024,Output Current,A,ocurr,1
3249+
1,1081407f0801760000UUuuUUuu@20,Output Max Current,A,mcurr,1
3250+
1,1081407f0801800000UUuuUUuu@1024,Input Temp,C,itmp,1
3251+
1,1081407f08017f0000UUuuUUuu@1024,Output Temp,C,otmp,1
3252+
1,1081407f0801740000UUuuUUuu@1024,Efficiency,%%,eff,1
3253+
1,=so8,00000000
3254+
1,=so9,1081407f
3255+
#
3256+
>W
3257+
<hr>
3258+
nm(41.5 58.5 0.1 ovolt "Output Voltage (V): " 80 1)
3259+
nm(0 60 0.1 maxc "Max Current (A): " 80 1)
3260+
```

0 commit comments

Comments
 (0)