Since this a rewrite of my DDS238-2 ZN/SR as SDM120C rename everything
This commit is contained in:
90
README.md
90
README.md
@ -1,13 +1,13 @@
|
|||||||
# Domoticz DS238-2 ZN/S ModbusTCP plugin
|
# Domoticz SDM120c ModbusTCP plugin
|
||||||
|
|
||||||
A Domoticz plugin to collect data from Hiking DS238-2 ZN/S power meter ModbusTCP.
|
A Domoticz plugin to collect data from SDM120c power meter ModbusTCP.
|
||||||
|
|
||||||
## Requirements
|
## Requirements
|
||||||
|
|
||||||
You need the DS238 to be connected over modbus over TCP. Wired or wireless.
|
You need the SDM120C to be connected over modbus over TCP. Wired or wireless.
|
||||||
Setup that use this on this plugin is using PW21
|
Setup that use this on this plugin is using PW21
|
||||||
|
|
||||||
You need also to find the address of the DS238. You can find it using the
|
You need also to find the address of the SDM120C. You can find it using the
|
||||||
push button. Per default the address is 1.
|
push button. Per default the address is 1.
|
||||||
|
|
||||||
## Installation of the plugin
|
## Installation of the plugin
|
||||||
@ -32,13 +32,13 @@ Install the plugin:
|
|||||||
|
|
||||||
``` shell
|
``` shell
|
||||||
cd domoticz/plugins
|
cd domoticz/plugins
|
||||||
git clone https://github.com/xbeaudouin/domoticz-ds238-modbus-tcp.git
|
git clone https://github.com/xbeaudouin/domoticz-sdm120c-modbus-tcp.git
|
||||||
```
|
```
|
||||||
|
|
||||||
Go to the plugin folder and install all required addons:
|
Go to the plugin folder and install all required addons:
|
||||||
|
|
||||||
``` shell
|
``` shell
|
||||||
cd domoticz/plugins/domoticz-ds238-modbus-tcp
|
cd domoticz/plugins/domoticz-sdm120c-modbus-tcp
|
||||||
sudo pip3 install -r requirements.txt
|
sudo pip3 install -r requirements.txt
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -50,12 +50,12 @@ sudo service domoticz.sh restart
|
|||||||
|
|
||||||
## Configuration in Domoticz
|
## Configuration in Domoticz
|
||||||
|
|
||||||
Once the plugin is installed, a new hardware type will be available: `DS238-2 ZN/S ModbusTCP`.
|
Once the plugin is installed, a new hardware type will be available: `SDM120c ModbusTCP`.
|
||||||
|
|
||||||
To add the inverter, go to `Setup` -> `Hardware` and add the counter:
|
To add the inverter, go to `Setup` -> `Hardware` and add the counter:
|
||||||
|
|
||||||
- Enter a `name` for the counter.
|
- Enter a `name` for the counter.
|
||||||
- Select `DS238-2 ZN/S ModbusTCP` from the `type` dropdown list.
|
- Select `SDM120c ModbusTCP` from the `type` dropdown list.
|
||||||
- Enter the IP address of the PW21 in the `IP Address` field.
|
- Enter the IP address of the PW21 in the `IP Address` field.
|
||||||
- Enter the port number (default: 502) of the PW21 in the `Port Number` field.
|
- Enter the port number (default: 502) of the PW21 in the `Port Number` field.
|
||||||
- Optionally turn on `Debug`; be aware: this will generate a lot of entries in the Domoticz log!
|
- Optionally turn on `Debug`; be aware: this will generate a lot of entries in the Domoticz log!
|
||||||
@ -68,7 +68,7 @@ This should result in a lot of new devices in the `Setup` -> `Devices` menu.
|
|||||||
Go to the plugin folder and get the new verion:
|
Go to the plugin folder and get the new verion:
|
||||||
|
|
||||||
``` shell
|
``` shell
|
||||||
cd domoticz/plugins/domoticz-ds238-modbus-tcp
|
cd domoticz/plugins/domoticz-sdm120c-modbus-tcp
|
||||||
git pull
|
git pull
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -79,7 +79,7 @@ sudo service domoticz.sh restart
|
|||||||
```
|
```
|
||||||
## ScreenShots
|
## ScreenShots
|
||||||
|
|
||||||
Hardware page showing a configured PW21 to get data from a DS238-2 ZN/S
|
Hardware page showing a configured PW21 to get data from a SDM120c
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
@ -97,74 +97,6 @@ Total power meter with Return energy (usefull for PV/Wind turbine generators)
|
|||||||
|
|
||||||
## Documentation about the registers used.
|
## Documentation about the registers used.
|
||||||
|
|
||||||
This is a copy of : https://gist.github.com/alphp/95e1efe916c0dd6df7156f43dd521d53
|
TODO
|
||||||
|
|
||||||
### Modbus holding registers:
|
|
||||||
|
|
||||||
| Register(s) | Meaning | Scale Unit | Data format | R/W |
|
|
||||||
|-------------|-----------------|------------|----------------|:---:|
|
|
||||||
| 0000h-0001h | total energy | 1/100 kWh | unsigned dword | R<> |
|
|
||||||
| 0002h-0003h | reserved | | unsigned dword | |
|
|
||||||
| 0004h-0005h | reserved | | unsigned dword | |
|
|
||||||
| 0006h-0007h | reserved | | unsigned dword | |
|
|
||||||
| 0008h-0009h | export energy | 1/100 kWh | unsigned dword | R<> |
|
|
||||||
| 000Ah-000Bh | import energy | 1/100 kWh | unsigned dword | R<> |
|
|
||||||
| 000Ch | voltage | 1/10 V | unsigned word | R |
|
|
||||||
| 000Dh | current | 1/100 A | unsigned word | R |
|
|
||||||
| 000Eh | active power | 1 W | signed word | R |
|
|
||||||
| 000Fh | reactive power | 1 VAr | unsigned word | R |
|
|
||||||
| 0010h | power factor | 1/1000 | unsigned word | R |
|
|
||||||
| 0011h | frequency | 1/100 Hz | unsigned word | R |
|
|
||||||
| 0012h | reserved | | unsigned word | |
|
|
||||||
| 0013h | reserved | | unsigned word | |
|
|
||||||
| 0014h | reserved | | unsigned word | |
|
|
||||||
| 0015h:high | station address | 1-247 | unsigned char | R/W |
|
|
||||||
| 0015h:low | baud rate | 1-4<> | unsigned char | R/W |
|
|
||||||
| 001Ah | relay<61> | | unsigned word | R/W |
|
|
||||||
|
|
||||||
#### Notes:
|
|
||||||
|
|
||||||
##### Note 1:
|
|
||||||
|
|
||||||
Total, export and import energy counters can erased writing 0 in total energy
|
|
||||||
registers.
|
|
||||||
|
|
||||||
##### Note 2:
|
|
||||||
|
|
||||||
Value mapping, default 1.
|
|
||||||
|
|
||||||
| Value | Baud rate |
|
|
||||||
|:-----:|:---------:|
|
|
||||||
| 1 | 9600 Bd |
|
|
||||||
| 2 | 4800 Bd |
|
|
||||||
| 3 | 2400 Bd |
|
|
||||||
| 4 | 1200 Bd |
|
|
||||||
|
|
||||||
##### Note 3:
|
|
||||||
|
|
||||||
In DDS238-2 ZN/SR model the relay can be switched by 0x001A register.
|
|
||||||
|
|
||||||
| Value | Relay |
|
|
||||||
|:-----:|:-----:|
|
|
||||||
| 0 | Off |
|
|
||||||
| 1 | On |
|
|
||||||
|
|
||||||
##### Data formats
|
|
||||||
|
|
||||||
| Data format | Lenght | Byte order |
|
|
||||||
|-------------|--------:|------------|
|
|
||||||
| char | 8 bits | |
|
|
||||||
| word | 16 bits | Big endian |
|
|
||||||
| dword | 32 bits | Big endian |
|
|
||||||
|
|
||||||
|
|
||||||
### Writing registers
|
|
||||||
|
|
||||||
The meter does not understand the 'write sigle register' function code (06h),
|
|
||||||
only the 'write multiple registers' function code (10h).
|
|
||||||
|
|
||||||
## Credits
|
|
||||||
|
|
||||||
Some part of the code has been taken from SolarEgde Modbus TCP Plugin. Thanks !
|
|
||||||
https://github.com/addiejanssen/domoticz-solaredge-modbustcp-plugin/
|
|
||||||
|
|
||||||
|
|||||||
@ -1,13 +1,13 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
"""
|
"""
|
||||||
Hiking DDS238-2 ZN/S Energy Meter
|
SDM120c Energy Meter
|
||||||
Author: Xavier Beaudouin
|
Author: Xavier Beaudouin
|
||||||
Requirements:
|
Requirements:
|
||||||
1. modbus over TCP adapter like PW21
|
1. modbus over TCP adapter like PW21
|
||||||
2. pymodbus AND pymodbusTCP
|
2. pymodbus AND pymodbusTCP
|
||||||
"""
|
"""
|
||||||
"""
|
"""
|
||||||
<plugin key="DS238_ModbusTCP" name="DS238-2 ZN/S ModbusTCP" author="Xavier Beaudouin" version="0.0.1" externallink="https://github.com/xbeaudouin/domoticz-ds238-modbus-tcp">
|
<plugin key="DS238_ModbusTCP" name="SDM120c ModbusTCP" author="Xavier Beaudouin" version="0.0.1" externallink="https://github.com/xbeaudouin/domoticz-sdm120c-modbus-tcp">
|
||||||
<params>
|
<params>
|
||||||
<param field="Address" label="IP Address" width="150px" required="true" />
|
<param field="Address" label="IP Address" width="150px" required="true" />
|
||||||
<param field="Port" label="Port Number" width="100px" required="true" default="502" />
|
<param field="Port" label="Port Number" width="100px" required="true" default="502" />
|
||||||
|
|||||||
Reference in New Issue
Block a user