Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

S34U18 support #32

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
12 changes: 8 additions & 4 deletions smeterd/cli/read_meter.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,14 @@ def read_meter(elec_unit, gas_unit, raw, serial_baudrate, serial_bytesize, seria
if ('gas_eid' in show_output):
data.append(('Gas serial', packet['gas']['eid']))
if ('consumed' in show_output):
data.extend([
('Total electricity consumed (high, {})'.format(elec_unit), int(packet['kwh']['high']['consumed'] * elec_unit_factor[elec_unit])),
('Total electricity consumed (low, {})'.format(elec_unit), int(packet['kwh']['low']['consumed'] * elec_unit_factor[elec_unit])),
('Total gas consumed ({})'.format(gas_unit), int(packet['gas']['total'] * gas_unit_factor[gas_unit]))])
if packet['kwh']['consumed']['total']:
data.extend([('Total electricity consumed (total, {})'.format(elec_unit), float(packet['kwh']['consumed']['total'] * elec_unit_factor[elec_unit]))])
if packet['kwh']['consumed']['high']:
data.extend([('Total electricity consumed (high, {})'.format(elec_unit), float(packet['kwh']['consumed']['high'] * elec_unit_factor[elec_unit]))])
if packet['kwh']['consumed']['low']:
data.extend([('Total electricity consumed (low, {})'.format(elec_unit), float(packet['kwh']['consumed']['low'] * elec_unit_factor[elec_unit]))])
if packet['gas']['total']:
data.extent([('Total gas consumed ({})'.format(gas_unit), int(packet['gas']['total'] * gas_unit_factor[gas_unit]))])
if ('produced' in show_output):
data.extend([
('Total electricity produced (high, {})'.format(elec_unit), int(packet['kwh']['high']['produced'] * elec_unit_factor[elec_unit])),
Expand Down
27 changes: 14 additions & 13 deletions smeterd/meter.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,29 +140,30 @@ def __init__(self, datagram):
keys['kwh']['switch'] = self.get_int(rb'^0-0:96\.3\.10\((\d)\)\r\n')
keys['kwh']['treshold'] = self.get_float(rb'^0-0:17\.0\.0\(([0-9]{4}\.[0-9]{2})\*kW\)\r\n')

keys['kwh']['low'] = {}
keys['kwh']['low']['consumed'] = self.get_float(rb'^1-0:1\.8\.1\(([0-9]+\.[0-9]+)\*kWh\)\r\n')
keys['kwh']['low']['produced'] = self.get_float(rb'^1-0:2\.8\.1\(([0-9]+\.[0-9]+)\*kWh\)\r\n')

keys['kwh']['high'] = {}
keys['kwh']['high']['consumed'] = self.get_float(rb'^1-0:1\.8\.2\(([0-9]+\.[0-9]+)\*kWh\)\r\n')
keys['kwh']['high']['produced'] = self.get_float(rb'^1-0:2\.8\.2\(([0-9]+\.[0-9]+)\*kWh\)\r\n')

keys['kwh']['current_consumed'] = self.get_float(rb'^1-0:1\.7\.0\(([0-9]+\.[0-9]+)\*kW\)\r\n')
keys['kwh']['current_produced'] = self.get_float(rb'^1-0:2\.7\.0\(([0-9]+\.[0-9]+)\*kW\)\r\n')
keys['kwh']['consumed'] = {}
keys['kwh']['consumed']['now'] = self.get_float(rb'^1-0:1\.7\.0\(([0-9]+\.[0-9]+)\*kW\)\r\n')
keys['kwh']['consumed']['total'] = self.get_float(rb'^1-0:1\.8\.0\(([0-9]+\.[0-9]+)\*kWh\)\r\n')
keys['kwh']['consumed']['low'] = self.get_float(rb'^1-0:1\.8\.1\(([0-9]+\.[0-9]+)\*kWh\)\r\n') # Tariff 1
keys['kwh']['consumed']['high'] = self.get_float(rb'^1-0:1\.8\.2\(([0-9]+\.[0-9]+)\*kWh\)\r\n') # Tariff 2

keys['kwh']['produced'] = {}
keys['kwh']['produced']['now'] = self.get_float(rb'^1-0:2\.7\.0\(([0-9]+\.[0-9]+)\*kW\)\r\n')
keys['kwh']['produced']['total'] = self.get_float(rb'^1-0:2\.8\.0\(([0-9]+\.[0-9]+)\*kWh\)\r\n')
keys['kwh']['produced']['low'] = self.get_float(rb'^1-0:2\.8\.1\(([0-9]+\.[0-9]+)\*kWh\)\r\n') # Tariff 1
keys['kwh']['produced']['high'] = self.get_float(rb'^1-0:2\.8\.2\(([0-9]+\.[0-9]+)\*kWh\)\r\n') # Tariff 2

keys['instantaneous'] = {}
keys['instantaneous']['l1'] = {}
keys['instantaneous']['l1']['volts'] = self.get_float(rb'^1-0:32\.7\.0\((\d+\.\d+)\*V\)\r\n')
keys['instantaneous']['l1']['amps'] = self.get_int(rb'^1-0:31\.7\.0\((\d+)\*A\)\r\n')
keys['instantaneous']['l1']['amps'] = self.get_float(rb'^1-0:31\.7\.0\((\d+\.\d+)\*A\)\r\n')
keys['instantaneous']['l1']['watts'] = self.get_float(rb'^1-0:21\.7\.0\((\d+\.\d+)\*kW\)\r\n', 0) * 1000
keys['instantaneous']['l2'] = {}
keys['instantaneous']['l2']['volts'] = self.get_float(rb'^1-0:52\.7\.0\((\d+\.\d+)\*V\)\r\n')
keys['instantaneous']['l2']['amps'] = self.get_int(rb'^1-0:51\.7\.0\((\d+)\*A\)\r\n')
keys['instantaneous']['l2']['amps'] = self.get_float(rb'^1-0:51\.7\.0\((\d+\.\d+)\*A\)\r\n')
keys['instantaneous']['l2']['watts'] = self.get_float(rb'^1-0:41\.7\.0\((\d+\.\d+)\*kW\)\r\n', 0) * 1000
keys['instantaneous']['l3'] = {}
keys['instantaneous']['l3']['volts'] = self.get_float(rb'^1-0:72\.7\.0\((\d+\.\d+)\*V\)\r\n')
keys['instantaneous']['l3']['amps'] = self.get_int(rb'^1-0:71\.7\.0\((\d+)\*A\)\r\n')
keys['instantaneous']['l3']['amps'] = self.get_float(rb'^1-0:71\.7\.0\((\d+\.\d+)\*A\)\r\n')
keys['instantaneous']['l3']['watts'] = self.get_float(rb'^1-0:61\.7\.0\((\d+\.\d+)\*kW\)\r\n', 0) * 1000

keys['gas'] = {}
Expand Down