Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Turbokongen/issue104 #105

Merged
merged 2 commits into from
May 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions custom_components/ams/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""AMS hub platform."""
import asyncio
import logging
import threading
from copy import deepcopy
Expand Down Expand Up @@ -409,10 +410,15 @@ def _check_for_new_sensors_and_update(self, sensor_data):
_LOGGER.debug("Got %s new devices from the serial",
len(new_devices))
_LOGGER.debug("DUMP %s", sensor_data)
self._hass.async_create_task(self._signal_new_sensor())
asyncio.run_coroutine_threadsafe(self._signal_new_sensor(),
self._hass.loop).result()
else:
# _LOGGER.debug("sensors are the same, updating states")
async_dispatcher_send(self._hass, SIGNAL_UPDATE_AMS)
asyncio.run_coroutine_threadsafe(self._signal_update_sensors(),
self._hass.loop).result()

async def _signal_new_sensor(self) -> None:
async_dispatcher_send(self._hass, SIGNAL_NEW_AMS_SENSOR)

async def _signal_update_sensors(self) -> None:
async_dispatcher_send(self._hass, SIGNAL_UPDATE_AMS)
2 changes: 1 addition & 1 deletion custom_components/ams/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@
"iot_class": "local_push",
"issue_tracker": "https://github.com/turbokongen/hass-AMS/issues",
"requirements": ["pyserial==3.5", "crccheck==1.0"],
"version": "2.0.2"
"version": "2.0.3"
}
Loading