Skip to content

Commit

Permalink
Add status option to pyduro (#9)
Browse files Browse the repository at this point in the history
Co-authored-by: Clément P <clement.prevot@gmail.com>
  • Loading branch information
brjhaverkamp and clementprevot authored Jan 11, 2023
1 parent 07b0d99 commit da07284
Show file tree
Hide file tree
Showing 2 changed files with 139 additions and 2 deletions.
22 changes: 20 additions & 2 deletions src/pyduro/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import argparse
import json

from pyduro.actions import FUNCTIONS, discover, get, set, raw
from pyduro.actions import FUNCTIONS, STATUS_PARAMS, discover, get, set, raw

# --------------------------------------------------------------------------------------------------

Expand Down Expand Up @@ -46,6 +46,8 @@ def main():

sub_parsers.add_parser("discover", help="Discover any burner on your network")

sub_parsers.add_parser("status", help="Get status of the burner")

parser_get = sub_parsers.add_parser("get", help="Get information from a burner")
parser_get.add_argument(
"function_name",
Expand Down Expand Up @@ -90,6 +92,15 @@ def main():
response = None
if args.action is None or args.action == "discover":
response = discover.run(verbose=args.verbose)
elif args.action == "status":
response = raw.run(
burner_address=args.burner,
serial=args.serial,
pin_code=args.pin,
function_id=11,
payload="*",
verbose=args.verbose,
)
elif args.action == "get":
response = get.run(
burner_address=args.burner,
Expand Down Expand Up @@ -119,7 +130,14 @@ def main():
)

if response:
if args.action == "get":
if args.action == "status":
status = response.parse_payload().split(",")
i=0
for key in STATUS_PARAMS:
STATUS_PARAMS[key]=status[i]
i+=1
print(str(STATUS_PARAMS))
elif args.action == "get":
print(json.dumps(response.parse_payload(), sort_keys=True, indent=2))
else:
print(response.parse_payload())
Expand Down
119 changes: 119 additions & 0 deletions src/pyduro/actions/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,122 @@
"dhw_years",
"counter",
)

STATUS_PARAMS= dict.fromkeys([
'boiler_temp',
'boiler_ref',
'content',
'dhw_temp',
'dhw_ref',
'dhw_valve_state',
'state',
'substate_sec',
'substate',
'ash_clean',
'compressor_clean',
'boiler_pump_state',
'house_valve_state',
'house_pump_state',
'house2_pump_state',
'exhaust_speed',
'off_on_alarm',
'chill_out',
'external_temp',
'forward_temp',
'forward_ref',
'mean_out_temp',
'distance',
'pressure',
'feed_high',
'feed_low',
'oxygen',
'oxygen_ref',
'photo_level',
'corr_low',
'corr_high',
'power_kw',
'return_temp',
'flow1',
'corr_medium',
'shaft_temp',
'power_pct',
'smoke_temp',
'internet_uptime',
'sun_pumpspeed',
'sun_temp',
'sun2_temp',
'sun_power_kw',
'sun_dhw_temp',
'city',
'outdoor_temp',
'house2_valve_state',
'clouds',
'mean2_out_temp',
'humidity',
'wind_direction',
'chill2_out',
'air_pressure',
'wind_speed',
'forward2_temp',
'forward2_ref',
'boiler.diff_over',
'auger.kw_min',
'auger.kw_max',
'auger.auger_capacity',
'hot_water.diff_under',
'hot_water.output',
'hot_water.timer',
'regulation.boiler_gain_i',
'regulation.boiler_gain_p',
'hopper.trip1',
'hopper.trip2',
'hopper.auger_capacity',
'wifi.router',
'cleaning.output_ash',
'cleaning.output_burner',
'cleaning.output_boiler1',
'cleaning.output_boiler2',
'cleaning.pressure_t7',
'pump.output',
'pump.start_temp_run',
'pump.start_temp_idle',
'weather.active',
'weather.output_pump',
'weather.output_up',
'weather.output_down',
'weather2.active',
'weather2.output_pump',
'weather2.output_up',
'weather2.output_down',
'fan.output_exhaust',
'fan.exhaust_10',
'fan.exhaust_50',
'fan.exhaust_100',
'sun.output_pump',
'sun.output_excess',
'consumption_midnight',
'consumption_total',
'consumption_heat_vvb',
'time',
'sun_pump_state',
'sun_surplus_state',
'state_super',
'state_sec',
'regulation.fixed_power',
'operation_mode',
'co_yellow',
'co_red',
'setup.varmluft_setpunkt',
'drift.back_pressure',
'drift.varmeblaeser_pct',
'drift.t1_temp',
'drift.wifi_load',
'drift.co',
'setup.min_beholdning',
'compressor_countdown',
'drift.vacuum_aktiv',
'vacuum_time',
'drift.askeskuffekontakt',
'drift.askeskuffe_minutter',
'boiler.timer']
)

0 comments on commit da07284

Please sign in to comment.