remove unneeded exception handling
This commit is contained in:
@@ -203,15 +203,12 @@ class Mqtt(metaclass=Singleton):
|
|||||||
|
|
||||||
def dcu_cmd(self, message):
|
def dcu_cmd(self, message):
|
||||||
payload = message.payload.decode("UTF-8")
|
payload = message.payload.decode("UTF-8")
|
||||||
try:
|
val = round(float(payload) * 10)
|
||||||
val = round(float(payload) * 10)
|
if val < 1000 or val > 8000:
|
||||||
if val < 1000 or val > 8000:
|
logger_mqtt.error('dcu_power: value must be in'
|
||||||
logger_mqtt.error('dcu_power: value must be in'
|
'the range 100..800,'
|
||||||
'the range 100..800,'
|
f' got: {payload}')
|
||||||
f' got: {payload}')
|
else:
|
||||||
else:
|
pdu = struct.pack('>BBBBBBH', 1, 1, 6, 1, 0, 1, val)
|
||||||
pdu = struct.pack('>BBBBBBH', 1, 1, 6, 1, 0, 1, val)
|
for fnc in self.each_inverter(message, "send_dcu_cmd"):
|
||||||
for fnc in self.each_inverter(message, "send_dcu_cmd"):
|
fnc(pdu)
|
||||||
fnc(pdu)
|
|
||||||
except Exception:
|
|
||||||
pass
|
|
||||||
|
|||||||
Reference in New Issue
Block a user