summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEvgeny Zinoviev <me@ch1p.io>2022-09-02 13:37:49 +0300
committerEvgeny Zinoviev <me@ch1p.io>2022-09-02 13:38:02 +0300
commitc7e10c52a9cd5be57e86e4e911bd21d6380771a6 (patch)
treee1115e551d9fdb64048fa7ba1a2561d96c7eadb8 /src
parent06ca251b94e06b8fe58437704a7ada716d3056b0 (diff)
inverter: support inverter-tools 1.5.0
Diffstat (limited to 'src')
-rw-r--r--src/home/database/inverter.py8
-rw-r--r--src/home/inverter/monitor.py6
-rw-r--r--src/home/mqtt/message/inverter.py8
-rwxr-xr-xsrc/inverter_bot.py16
-rwxr-xr-xsrc/inverter_mqtt_receiver.py4
5 files changed, 21 insertions, 21 deletions
diff --git a/src/home/database/inverter.py b/src/home/database/inverter.py
index 8902f04..6fdf9d7 100644
--- a/src/home/database/inverter.py
+++ b/src/home/database/inverter.py
@@ -24,8 +24,8 @@ class InverterDatabase:
battery_voltage: int,
battery_voltage_scc: int,
battery_voltage_scc2: int,
- battery_discharging_current: int,
- battery_charging_current: int,
+ battery_discharge_current: int,
+ battery_charge_current: int,
battery_capacity: int,
inverter_heat_sink_temp: int,
mppt1_charger_temp: int,
@@ -83,8 +83,8 @@ class InverterDatabase:
battery_voltage,
battery_voltage_scc,
battery_voltage_scc2,
- battery_discharging_current,
- battery_charging_current,
+ battery_discharge_current,
+ battery_charge_current,
battery_capacity,
inverter_heat_sink_temp,
mppt1_charger_temp,
diff --git a/src/home/inverter/monitor.py b/src/home/inverter/monitor.py
index 444d3bc..87e07be 100644
--- a/src/home/inverter/monitor.py
+++ b/src/home/inverter/monitor.py
@@ -131,7 +131,7 @@ class InverterMonitor(Thread):
def run(self):
# Check allowed currents and validate the config.
- allowed_currents = list(inverter.exec('get-allowed-ac-charging-currents')['data'])
+ allowed_currents = list(inverter.exec('get-allowed-ac-charge-currents')['data'])
allowed_currents.sort()
for a in self.currents:
@@ -397,10 +397,10 @@ class InverterMonitor(Thread):
def set_hw_charging_current(self, current: int):
try:
- response = inverter.exec('set-max-ac-charging-current', (0, current))
+ response = inverter.exec('set-max-ac-charge-current', (0, current))
if response['result'] != 'ok':
logger.error(f'failed to change AC charging current to {current} A')
- raise InverterError('set-max-ac-charging-current: inverterd reported error')
+ raise InverterError('set-max-ac-charge-current: inverterd reported error')
else:
self.charging_event_handler(ChargingEvent.AC_CURRENT_CHANGED, current=current)
logger.info(f'changed AC charging current to {current} A')
diff --git a/src/home/mqtt/message/inverter.py b/src/home/mqtt/message/inverter.py
index 2df17e5..d36aad5 100644
--- a/src/home/mqtt/message/inverter.py
+++ b/src/home/mqtt/message/inverter.py
@@ -29,8 +29,8 @@ class Status:
int(data['battery_voltage'] * 10),
int(data['battery_voltage_scc'] * 10),
int(data['battery_voltage_scc2'] * 10),
- data['battery_discharging_current'],
- data['battery_charging_current'],
+ data['battery_discharge_current'],
+ data['battery_charge_current'],
data['battery_capacity'],
data['inverter_heat_sink_temp'],
data['mppt1_charger_temp'],
@@ -55,8 +55,8 @@ class Status:
'battery_voltage': data[8] / 10,
'battery_voltage_scc': data[9] / 10,
'battery_voltage_scc2': data[10] / 10,
- 'battery_discharging_current': data[11],
- 'battery_charging_current': data[12],
+ 'battery_discharge_current': data[11],
+ 'battery_charge_current': data[12],
'battery_capacity': data[13],
'inverter_heat_sink_temp': data[14],
'mppt1_charger_temp': data[15],
diff --git a/src/inverter_bot.py b/src/inverter_bot.py
index b8a01c4..54b17c8 100755
--- a/src/inverter_bot.py
+++ b/src/inverter_bot.py
@@ -145,11 +145,11 @@ def status(ctx: Context) -> None:
if power_direction == 'charging':
charging_rate = f'{chrg_at}%s %s' % (
- gs['battery_charging_current']['value'], gs['battery_charging_current']['unit'])
+ gs['battery_charge_current']['value'], gs['battery_charge_current']['unit'])
pd_label = ctx.lang('pd_charging')
elif power_direction == 'discharging':
charging_rate = f'{chrg_at}%s %s' % (
- gs['battery_discharging_current']['value'], gs['battery_discharging_current']['unit'])
+ gs['battery_discharge_current']['value'], gs['battery_discharge_current']['unit'])
pd_label = ctx.lang('pd_discharging')
else:
pd_label = ctx.lang('pd_nothing')
@@ -206,14 +206,14 @@ def generation(ctx: Context) -> None:
def setgencc(ctx: Context) -> None:
- allowed_values = inverter.exec('get-allowed-ac-charging-currents')['data']
+ allowed_values = inverter.exec('get-allowed-ac-charge-currents')['data']
try:
current = int(ctx.args[0])
if current not in allowed_values:
raise ValueError(f'invalid value {current}')
- response = inverter.exec('set-max-ac-charging-current', (0, current))
+ response = inverter.exec('set-max-ac-charge-current', (0, current))
ctx.reply('OK' if response['result'] == 'ok' else 'ERROR')
# TODO notify monitor
@@ -230,7 +230,7 @@ def setgenct(ctx: Context) -> None:
dv = float(ctx.args[1])
if 44 <= cv <= 51 and 48 <= dv <= 58:
- response = inverter.exec('set-charging-thresholds', (cv, dv))
+ response = inverter.exec('set-charge-thresholds', (cv, dv))
ctx.reply('OK' if response['result'] == 'ok' else 'ERROR')
else:
raise ValueError('invalid values')
@@ -254,8 +254,8 @@ def setacmode(mode: ACMode):
logger.debug(f'setacmode: mode={mode}, cv={cv}, dv={dv}, a={a}')
- inverter.exec('set-charging-thresholds', (cv, dv))
- inverter.exec('set-max-ac-charging-current', (0, a))
+ inverter.exec('set-charge-thresholds', (cv, dv))
+ inverter.exec('set-max-ac-charge-current', (0, a))
def setacmode_start(ctx: Context) -> None:
@@ -318,7 +318,7 @@ def setbatuv(ctx: Context) -> None:
v = float(ctx.args[0])
if 40.0 <= v <= 48.0:
- response = inverter.exec('set-battery-cut-off-voltage', (v,))
+ response = inverter.exec('set-battery-cutoff-voltage', (v,))
ctx.reply('OK' if response['result'] == 'ok' else 'ERROR')
else:
raise ValueError('invalid voltage')
diff --git a/src/inverter_mqtt_receiver.py b/src/inverter_mqtt_receiver.py
index dd61d9a..d3a487b 100755
--- a/src/inverter_mqtt_receiver.py
+++ b/src/inverter_mqtt_receiver.py
@@ -48,8 +48,8 @@ class MQTTReceiver(MQTTBase):
battery_voltage=int(data['battery_voltage'] * 10),
battery_voltage_scc=int(data['battery_voltage_scc'] * 10),
battery_voltage_scc2=int(data['battery_voltage_scc2'] * 10),
- battery_discharging_current=data['battery_discharging_current'],
- battery_charging_current=data['battery_charging_current'],
+ battery_discharge_current=data['battery_discharge_current'],
+ battery_charge_current=data['battery_charge_current'],
battery_capacity=data['battery_capacity'],
inverter_heat_sink_temp=data['inverter_heat_sink_temp'],
mppt1_charger_temp=data['mppt1_charger_temp'],