Skip to content

Commit

Permalink
0.6
Browse files Browse the repository at this point in the history
  • Loading branch information
mawinkler committed Nov 17, 2024
1 parent 1d7c910 commit 1ad03b0
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 18 deletions.
13 changes: 12 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
# [0.5](https://github.com/mawinkler/astrolive/compare/v0.4...v0.5) ()
# [0.6](https://github.com/mawinkler/astrolive/compare/v0.5...v0.6) (2024-11-17)

### Changes

- Bump dependencies to current versions
- Added support for MQTTv5

### Fixes

- Fixed an uncached error that occurred when the filter wheel is inaccessible.

# [0.5](https://github.com/mawinkler/astrolive/compare/v0.4...v0.5) (2023-10-13)

### Features

Expand Down
2 changes: 1 addition & 1 deletion astrolive/mqttdevices.py
Original file line number Diff line number Diff line change
Expand Up @@ -866,7 +866,7 @@ async def _publish_filterwheel(self, sys_id, device, device_type):
_LOGGER.debug("%s: Update", sys_id)
topic = "astrolive/" + device_type + "/" + sys_id_ + "/"
try:
if device.connected():
if device.connected() and len(device.names()) > 0:
await self._publisher.publish_mqtt(topic + "lwt", "ON")
state = {
"position": device.position(),
Expand Down
23 changes: 15 additions & 8 deletions astrolive/mqtthandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,22 @@ def on_log(self, client, userdata, level, buf):

_LOGGER.debug("%s", buf)

def on_connect(self, client, userdata, flags, rc):
def on_connect(self, client, userdata, flags, rc, properties):
"""Connected to MQTT"""

client.publish(
"astrolive/lwt",
"ON",
)
if flags.get("session_present"):
_LOGGER.debug("MQTT session present")

if rc == 0:
_LOGGER.debug("MQTT success connect")
client.publish(
"astrolive/lwt",
"ON",
)
else:
_LOGGER.debug("MQTT success not successful")

def on_disconnect(self, client, userdata, flags, rc):
def on_disconnect(self, client, userdata, flags, rc, properties):
"""Disconnecting from MQTT"""

client.publish(
Expand Down Expand Up @@ -81,8 +88,8 @@ def __init__(self, *args, **kwargs) -> None:
self._client = None
unique_id = "".join(random.SystemRandom().choice(string.ascii_uppercase + string.digits) for _ in range(12))
if self._publisher is None:
proto = mqtt.MQTTv311
self._client = mqtt.Client(f"{options['mqtt']['client']}-{unique_id}", proto)
proto = mqtt.MQTTv5
self._client = mqtt.Client(client_id=f"{options['mqtt']['client']}-{unique_id}", protocol=proto)
self._client.on_message = self.on_message
self._client.on_log = self.on_log
self._client.on_connect = self.on_connect
Expand Down
14 changes: 7 additions & 7 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
astropy==6.0.0
numpy==1.26.4
paho_mqtt==1.6.1
pandas==2.2.0
PyYAML==6.0.1
Requests==2.31.0
astropy==6.1.6
numpy==2.1.3
paho_mqtt==2.1.0
pandas==2.2.3
PyYAML==6.0.2
Requests==2.32.3
tabulate==0.9.0
opencv-python-headless==4.9.0.80
opencv-python-headless==4.10.0.84
2 changes: 1 addition & 1 deletion run.py
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
""" The test for the API """
#!/usr/bin/env python3
import asyncio
import logging
import sys
Expand Down

0 comments on commit 1ad03b0

Please sign in to comment.