Skip to content

Commit

Permalink
Fix Voltcraft SEM6000 relay scanning. #874
Browse files Browse the repository at this point in the history
  • Loading branch information
theyosh committed Jan 5, 2024
1 parent 219a52d commit 424203e
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions hardware/relay/voltcraft_sem6000_relay.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ def _get_hardware_value(self):
data = terrariumUtils.get_script_data(
f"python 3rdparty/python3-voltcraft-sem6000/sem6000-cli-demo.py {self.address} 0000 request_measurement"
)
state = False
if data:
state = re.search(terrariumRelayVoltcraftSEM6000.POWER_STATE_REGEX, data.decode("utf-8"))
if state:
Expand All @@ -48,14 +49,14 @@ def _scan_relays(callback=None, **kwargs):
terrariumUtils.get_script_data(f"python 3rdparty/python3-voltcraft-sem6000/sem6000-cli-demo.py discover")
.decode("utf-8")
.strip()
.split("\n")
)
for device in devices:
device = device.split("\t")
yield terrariumRelay(
None,
terrariumRelayVoltcraftSEM6000.HARDWARE,
device[1],
f"{terrariumRelayVoltcraftSEM6000.NAME} {device[0]} device mac: {device[1]}",
callback=callback,
)
if devices:
for device in devices.split("\n"):
device = device.split("\t")
yield terrariumRelay(
None,
terrariumRelayVoltcraftSEM6000.HARDWARE,
device[1],
f"{terrariumRelayVoltcraftSEM6000.NAME} {device[0]} device mac: {device[1]}",
callback=callback,
)

0 comments on commit 424203e

Please sign in to comment.