1
0
mirror of https://github.com/esphome/esphome.git synced 2025-11-06 18:11:49 +00:00

Compare commits

...

3 Commits

Author SHA1 Message Date
Jesse Hills
41a3a17456 Merge pull request #2734 from esphome/bump-2021.11.0b8
2021.11.0b8
2021-11-16 13:50:10 +13:00
Jesse Hills
cbbafbcca2 Bump version to 2021.11.0b8 2021-11-16 12:53:56 +13:00
Jesse Hills
c75566b374 Fix zeroconf time comparisons (#2733)
Co-authored-by: J. Nick Koston <nick@koston.org>
2021-11-16 12:53:56 +13:00
2 changed files with 5 additions and 4 deletions

View File

@@ -1,6 +1,6 @@
"""Constants used by esphome.""" """Constants used by esphome."""
__version__ = "2021.11.0b7" __version__ = "2021.11.0b8"
ALLOWED_NAME_CHARS = "abcdefghijklmnopqrstuvwxyz0123456789-_" ALLOWED_NAME_CHARS = "abcdefghijklmnopqrstuvwxyz0123456789-_"

View File

@@ -13,8 +13,9 @@ from zeroconf import (
RecordUpdateListener, RecordUpdateListener,
Zeroconf, Zeroconf,
ServiceBrowser, ServiceBrowser,
ServiceStateChange,
current_time_millis,
) )
from zeroconf._services import ServiceStateChange
_CLASS_IN = 1 _CLASS_IN = 1
_FLAGS_QR_QUERY = 0x0000 # query _FLAGS_QR_QUERY = 0x0000 # query
@@ -88,7 +89,7 @@ class DashboardStatus(threading.Thread):
entries = self.zc.cache.entries_with_name(key) entries = self.zc.cache.entries_with_name(key)
if not entries: if not entries:
return False return False
now = time.time() * 1000 now = current_time_millis()
return any( return any(
(entry.created + DashboardStatus.OFFLINE_AFTER) >= now for entry in entries (entry.created + DashboardStatus.OFFLINE_AFTER) >= now for entry in entries
@@ -99,7 +100,7 @@ class DashboardStatus(threading.Thread):
self.on_update( self.on_update(
{key: self.host_status(host) for key, host in self.key_to_host.items()} {key: self.host_status(host) for key, host in self.key_to_host.items()}
) )
now = time.time() * 1000 now = current_time_millis()
for host in self.query_hosts: for host in self.query_hosts:
entries = self.zc.cache.entries_with_name(host) entries = self.zc.cache.entries_with_name(host)
if not entries or all( if not entries or all(