Skip to content

Commit

Permalink
added startup timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
mr-manuel committed Dec 18, 2023
1 parent d1c56c4 commit 559aaf4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Changelog

## v0.1.5
* Added: Timeout on driver startup. Prevents problems, if the MQTT broker is not reachable on driver startup
* Changed: Fixed status flapping between running and standby

## v0.1.4
Expand Down
11 changes: 10 additions & 1 deletion dbus-mqtt-pv/dbus-mqtt-pv.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ def __init__(
self._dbusservice.add_path('/ProductId', 0xFFFF)
self._dbusservice.add_path('/ProductName', productname)
self._dbusservice.add_path('/CustomName', customname)
self._dbusservice.add_path('/FirmwareVersion', '0.1.4 (20231106)')
self._dbusservice.add_path('/FirmwareVersion', '0.1.5 (20231218)')
# self._dbusservice.add_path('/HardwareVersion', '')
self._dbusservice.add_path('/Connected', 1)

Expand Down Expand Up @@ -363,6 +363,15 @@ def main():
logging.info("Waiting 5 seconds for receiving first data...")
else:
logging.warning("Waiting since %s seconds for receiving first data..." % str(i * 5))

# check if timeout was exceeded
if timeout <= (i * 5):

This comment has been minimized.

Copy link
@dyn4mic

dyn4mic Feb 2, 2024

with timeout=0(option to disable timeout) this stops the driver.
how is the desired behaviour for nights, where no power is produced?
i want to avoid restarts of the driver and dont want to send fake zero values.
Thanks for clarification.

This comment has been minimized.

Copy link
@mr-manuel

mr-manuel Feb 2, 2024

Author Owner

Set the timeout to a half day 43200 or day 86400. You cannot disable it, else you won't never see if the driver is stale or not.

This comment has been minimized.

Copy link
@mr-manuel

mr-manuel Feb 2, 2024

Author Owner

I will fix that, so you can disable it again

This comment has been minimized.

Copy link
@dyn4mic

dyn4mic Feb 5, 2024

i went with a value of the longest night in my location. lets see how this goes.

logging.error(
"Driver stopped. Timeout of %i seconds exceeded, since no new MQTT message was received in this time."
% timeout
)
sys.exit()

sleep(5)
i += 1

Expand Down

0 comments on commit 559aaf4

Please sign in to comment.