Skip to content

Instantly share code, notes, and snippets.

@mitchese
Last active May 18, 2021 08:51
Show Gist options
  • Save mitchese/f3e05aca57848d79240b9b45bdb7d745 to your computer and use it in GitHub Desktop.
Save mitchese/f3e05aca57848d79240b9b45bdb7d745 to your computer and use it in GitHub Desktop.
registers:
- name: L1 Voltage
unit_of_measurement: V
register: 0
data_type: float
precision: 2
count: 2
- name: L2 Voltage
unit_of_measurement: V
register: 2
data_type: float
precision: 2
count: 2
- name: L3 Voltage
unit_of_measurement: V
register: 4
data_type: float
precision: 2
count: 2
- name: L1 Current
unit_of_measurement: A
register: 6
data_type: float
precision: 2
count: 2
- name: L2 Current
unit_of_measurement: A
register: 8
data_type: float
precision: 2
count: 2
- name: L3 Current
unit_of_measurement: A
register: 10
data_type: float
precision: 2
count: 2
- name: L1 Power
unit_of_measurement: W
register: 12
data_type: float
precision: 2
count: 2
- name: L2 Power
unit_of_measurement: W
register: 14
data_type: float
precision: 2
count: 2
- name: L3 Power
unit_of_measurement: W
register: 16
data_type: float
precision: 2
count: 2
- name: L1 VA
unit_of_measurement: VA
register: 18
data_type: float
precision: 2
count: 2
- name: L2 VA
unit_of_measurement: VA
register: 20
data_type: float
precision: 2
count: 2
- name: L3 VA
unit_of_measurement: VA
register: 22
data_type: float
precision: 2
count: 2
- name: L1 VAr
unit_of_measurement: VAr
register: 24
data_type: float
precision: 2
count: 2
- name: L2 VAr
unit_of_measurement: VAr
register: 26
data_type: float
precision: 2
count: 2
- name: L3 VAr
unit_of_measurement: VAr
register: 28
data_type: float
precision: 2
count: 2
- name: L1 PowerFactor
unit_of_measurement: '%'
register: 30
data_type: float
precision: 2
count: 2
- name: L2 PowerFactor
unit_of_measurement: '%'
register: 32
data_type: float
precision: 2
count: 2
- name: L3 PowerFactor
unit_of_measurement: '%'
register: 34
data_type: float
precision: 2
count: 2
- name: L1 Phase Angle
unit_of_measurement: °
register: 36
data_type: float
precision: 2
count: 2
- name: L2 Phase Angle
unit_of_measurement: °
register: 38
data_type: float
precision: 2
count: 2
- name: L3 Phase Angle
unit_of_measurement: °
register: 40
data_type: float
precision: 2
count: 2
- name: Average Volts
unit_of_measurement: V
register: 42
data_type: float
precision: 2
count: 2
- name: Average Current
unit_of_measurement: A
register: 46
data_type: float
precision: 2
count: 2
- name: Sum of Current
unit_of_measurement: A
register: 48
data_type: float
precision: 2
count: 2
- name: Total System Power
unit_of_measurement: W
register: 52
data_type: float
precision: 2
count: 2
- name: Total System VA
unit_of_measurement: VA
register: 56
data_type: float
precision: 2
count: 2
- name: Total System VAr
unit_of_measurement: VAr
register: 60
data_type: float
precision: 2
count: 2
- name: Total System Power Factor
register: 62
data_type: float
precision: 2
count: 2
- name: Total System Phase Angle
unit_of_measurement: °
register: 66
data_type: float
precision: 2
count: 2
- name: Supply Frequency
unit_of_measurement: Hz
register: 70
data_type: float
precision: 2
count: 2
- name: Import Watt Hours
unit_of_measurement: kWh
register: 72
data_type: float
precision: 2
count: 2
- name: Export Watt Hours
unit_of_measurement: kWh
register: 74
data_type: float
precision: 2
count: 2
- name: Import VArh
unit_of_measurement: kVArh
register: 76
data_type: float
precision: 2
count: 2
- name: Export VArh
unit_of_measurement: kVArh
register: 78
data_type: float
precision: 2
count: 2
- name: VAh since last reset
unit_of_measurement: kVAh
register: 80
data_type: float
precision: 2
count: 2
- name: Ah since last reset
unit_of_measurement: Ah
register: 82
data_type: float
precision: 2
count: 2
- name: Total System Power Demand
unit_of_measurement: W
register: 84
data_type: float
precision: 2
count: 2
- name: Maximum total system power demand
unit_of_measurement: VA
register: 86
data_type: float
precision: 2
count: 2
- name: Total system VA demand
unit_of_measurement: VA
register: 100
data_type: float
precision: 2
count: 2
- name: Maximum total system VA demand
unit_of_measurement: VA
register: 102
data_type: float
precision: 2
count: 2
- name: Neutral Current Demand
unit_of_measurement: A
register: 104
data_type: float
precision: 2
count: 2
- name: Maximum Neutral Current Demand
unit_of_measurement: A
register: 106
data_type: float
precision: 2
count: 2
- name: L1-L2 Voltage
unit_of_measurement: V
register: 200
data_type: float
precision: 2
count: 2
- name: L2-L3 Voltage
unit_of_measurement: V
register: 202
data_type: float
precision: 2
count: 2
- name: L3-L1 Voltage
unit_of_measurement: V
register: 204
data_type: float
precision: 2
count: 2
- name: Average L-L Voltage
unit_of_measurement: V
register: 206
data_type: float
precision: 2
count: 2
- name: Neutral Current
unit_of_measurement: A
register: 224
data_type: float
precision: 2
count: 2
- name: L1-N Volts THD
unit_of_measurement: '%'
register: 234
data_type: float
precision: 2
count: 2
- name: L2-N Volts THD
unit_of_measurement: '%'
register: 236
data_type: float
precision: 2
count: 2
- name: L3-N Volts THD
unit_of_measurement: '%'
register: 238
data_type: float
precision: 2
count: 2
- name: L1 Current THD
unit_of_measurement: '%'
register: 240
data_type: float
precision: 2
count: 2
- name: L2 Current THD
unit_of_measurement: '%'
register: 242
data_type: float
precision: 2
count: 2
- name: L3 Current THD
unit_of_measurement: '%'
register: 244
data_type: float
precision: 2
count: 2
- name: Average L-N Volts THD
unit_of_measurement: '%'
register: 248
data_type: float
precision: 2
count: 2
- name: Average Line Current THD
unit_of_measurement: '%'
register: 250
data_type: float
precision: 2
count: 2
- name: Total System Power Factor
unit_of_measurement: °
register: 254
data_type: float
precision: 2
count: 2
- name: L1 Current Demand
unit_of_measurement: A
register: 258
data_type: float
precision: 2
count: 2
- name: L2 Current Demand
unit_of_measurement: A
register: 260
data_type: float
precision: 2
count: 2
- name: L3 Current Demand
unit_of_measurement: A
register: 262
data_type: float
precision: 2
count: 2
- name: L1 Max Current demand
unit_of_measurement: A
register: 264
data_type: float
precision: 2
count: 2
- name: L2 Max Current demand
unit_of_measurement: A
register: 266
data_type: float
precision: 2
count: 2
- name: L3 Max Current demand
unit_of_measurement: A
register: 268
data_type: float
precision: 2
count: 2
- name: L1-L2 Volts THD
unit_of_measurement: '%'
register: 334
data_type: float
precision: 2
count: 2
- name: L2-L3 Volts THD
unit_of_measurement: '%'
register: 336
data_type: float
precision: 2
count: 2
- name: L3-L1 Volts THD
unit_of_measurement: '%'
register: 338
data_type: float
precision: 2
count: 2
- name: Average L-N THD
unit_of_measurement: '%'
register: 340
data_type: float
precision: 2
count: 2
- name: Total kWh
unit_of_measurement: kWh
register: 342
data_type: float
precision: 2
count: 2
- name: Total kVArh
unit_of_measurement: kVArh
register: 344
data_type: float
precision: 2
count: 2
- name: L1 Import kWh
unit_of_measurement: kWh
register: 346
data_type: float
precision: 2
count: 2
- name: L2 Import kWh
unit_of_measurement: kWh
register: 348
data_type: float
precision: 2
count: 2
- name: L3 Import kWh
unit_of_measurement: kWh
register: 350
data_type: float
precision: 2
count: 2
- name: L1 Export kWh
unit_of_measurement: kWh
register: 352
data_type: float
precision: 2
count: 2
- name: L2 Export kWh
unit_of_measurement: kWh
register: 354
data_type: float
precision: 2
count: 2
- name: L3 Export kWh
unit_of_measurement: kWh
register: 356
data_type: float
precision: 2
count: 2
- name: L1 Total kWh
unit_of_measurement: kWh
register: 358
data_type: float
precision: 2
count: 2
- name: L2 Total kWh
unit_of_measurement: kWh
register: 360
data_type: float
precision: 2
count: 2
- name: L3 Total kWh
unit_of_measurement: kWh
register: 362
data_type: float
precision: 2
count: 2
- name: L1 Import kVArh
unit_of_measurement: kVArh
register: 364
data_type: float
precision: 2
count: 2
- name: L2 Import kVArh
unit_of_measurement: kVArh
register: 366
data_type: float
precision: 2
count: 2
- name: L3 Import kVArh
unit_of_measurement: kVArh
register: 368
data_type: float
precision: 2
count: 2
- name: L1 Export kVArh
unit_of_measurement: kVArh
register: 370
data_type: float
precision: 2
count: 2
- name: L2 Export kVArh
unit_of_measurement: kVArh
register: 372
data_type: float
precision: 2
count: 2
- name: L3 Export kVArh
unit_of_measurement: kVArh
register: 374
data_type: float
precision: 2
count: 2
- name: L1 Total kVArh
unit_of_measurement: kVArh
register: 376
data_type: float
precision: 2
count: 2
- name: L2 Total kVArh
unit_of_measurement: kVArh
register: 378
data_type: float
precision: 2
count: 2
- name: L3 Total kVArh
unit_of_measurement: kVArh
register: 380
data_type: float
precision: 2
count: 2
@mitchese
Copy link
Author

The Wireless Eastron things seem to be (at least the ones I found), all LoRa. This should abstract all the RS485 stuff away, but I'm not sure, never used these yet.

The RS485 <--> TCP Gateway is physically wired to the power meter via two wires (RS485), and has ethernet coming out of it. From this point, everything is then TCP, so home assistant has nothing physically connected to the power meter; it just makes the calls over the network to the gateway.

I think what you're referring to with a Raspberry Pi via USB is replacing the RS485<-->TCP gateway with an RS485<-->UART, then hooking this to the Raspberry via USB. In this case, then raspberry pi would either have to have home assistant directly on it, or run some sort of software to provide the UART(/RS485/power meter) connection to the internet. This is then going in the direction of a DIY Gateway.

If you have specific products you're looking at, please post the links to help me understand what you're looking at.

@MarBoMue
Copy link

MarBoMue commented Apr 4, 2021

Hello, sorry for the stupid question, but could you show me an exact excerpt from your config.yaml regarding the integration of the SDM630 modbus? I've been trying for weeks and get no results. my excerpt:

Modbus

modbus:
name: electricity meter
type: tcp
host: 192.xxx.xxx.xx
port: xxx

I outsourced the sensors using: sensor:! include sensor.yaml.

there it starts with:

  • platform: modbus
    scan_interval: 20
    registers:

Unfortunately, I don't get any sensors displayed. What am I doing wrong? I would be very happy about your help.
ps. am a home assistant beginner

@mitchese
Copy link
Author

mitchese commented Apr 5, 2021

I don't have this meter anymore, but pulling from my git history, I have the configuration still. In the future you can use backticks (`) to surround individual lines, and 3 backticks (```) to surround larger code blocks, then it formats correctly. I can't tell if you have a mistake with the indentation (yaml is very sensitive to this).

Note I have multiple modbus endpoints, so I had to alias these with name: sdm630 in the modbus section, then reference which "hub" the particular register readout hub: sdm630 in each value. You won't have to do this if you only have one, however I recommend you do this for when you get the next modbus thing.

Have you tried a tcpdump to see if homeassistant is sending any requests? Maybe the modbus gateway is wired wrong to the meter or something, such that everything on the homeassistant side is correct, but the modbus side is not. TCPDump should show outgoing requests and responses from the gateway.

configuration.yaml:

sensor: !include_dir_merge_list sensors

modbus:
  - type: tcp
    host: 192.168.x.x
    port: 502
    name: sdm630
  - type: tcp
    host: 192.168.x.x
    port: 502
    name: stp8
  - type: tcp
    host: 192.168.x.x
    port: 502
    name: sb25

sensors/modbus_sdm630.yaml:

- platform: modbus
  registers:
    - name: L1 Voltage
      hub: sdm630
      unit_of_measurement: V
      register: 0
      data_type: float
      precision: 2
      count: 2
    - name: L2 Voltage
      hub: sdm630
      unit_of_measurement: V
      register: 2
      data_type: float
      precision: 2
      count: 2
      ....etc.....

@dartfrogdk
Copy link

Hi the meter does not seem to be on amazon anymore, what would you recommend as an alternative, Im in Denmark 230V 3 fase

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment