mirror of
https://github.com/esphome/esphome.git
synced 2024-12-22 05:24:53 +01:00
commit
0ee4348777
6 changed files with 3991 additions and 4000 deletions
|
@ -63,7 +63,13 @@ def validate_tolerance(value):
|
|||
if "%" in str(value):
|
||||
type_ = TYPE_PERCENTAGE
|
||||
else:
|
||||
type_ = TYPE_TIME
|
||||
try:
|
||||
cv.positive_time_period_microseconds(value)
|
||||
type_ = TYPE_TIME
|
||||
except cv.Invalid as exc:
|
||||
raise cv.Invalid(
|
||||
"Tolerance must be a percentage or time. Configurations made before 2024.5.0 treated the value as a percentage."
|
||||
) from exc
|
||||
|
||||
return TOLERANCE_SCHEMA(
|
||||
{
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,6 +1,6 @@
|
|||
"""Constants used by esphome."""
|
||||
|
||||
__version__ = "2024.5.1"
|
||||
__version__ = "2024.5.2"
|
||||
|
||||
ALLOWED_NAME_CHARS = "abcdefghijklmnopqrstuvwxyz0123456789-_"
|
||||
VALID_SUBSTITUTIONS_CHARACTERS = (
|
||||
|
|
|
@ -103,7 +103,7 @@ class DashboardEntries:
|
|||
|
||||
def all(self) -> list[DashboardEntry]:
|
||||
"""Return all entries."""
|
||||
return asyncio.run_coroutine_threadsafe(self._async_all, self._loop).result()
|
||||
return asyncio.run_coroutine_threadsafe(self._async_all(), self._loop).result()
|
||||
|
||||
def async_all(self) -> list[DashboardEntry]:
|
||||
"""Return all entries."""
|
||||
|
|
|
@ -18,7 +18,7 @@ class MqttStatusThread(threading.Thread):
|
|||
"""Run the status thread."""
|
||||
dashboard = DASHBOARD
|
||||
entries = dashboard.entries
|
||||
current_entries = entries.async_all()
|
||||
current_entries = entries.all()
|
||||
|
||||
config = mqtt.config_from_env()
|
||||
topic = "esphome/discover/#"
|
||||
|
@ -33,7 +33,7 @@ class MqttStatusThread(threading.Thread):
|
|||
return
|
||||
for entry in current_entries:
|
||||
if entry.name == data["name"]:
|
||||
entries.async_set_state(entry, EntryState.ONLINE)
|
||||
entries.set_state(entry, EntryState.ONLINE)
|
||||
return
|
||||
|
||||
def on_connect(client, userdata, flags, return_code):
|
||||
|
@ -53,11 +53,11 @@ class MqttStatusThread(threading.Thread):
|
|||
client.loop_start()
|
||||
|
||||
while not dashboard.stop_event.wait(2):
|
||||
current_entries = entries.async_all()
|
||||
current_entries = entries.all()
|
||||
# will be set to true on on_message
|
||||
for entry in current_entries:
|
||||
if entry.no_mdns:
|
||||
entries.async_set_state(entry, EntryState.OFFLINE)
|
||||
entries.set_state(entry, EntryState.OFFLINE)
|
||||
|
||||
client.publish("esphome/discover", None, retain=False)
|
||||
dashboard.mqtt_ping_request.wait()
|
||||
|
|
|
@ -3,6 +3,7 @@ remote_receiver:
|
|||
pin: ${pin}
|
||||
rmt_channel: ${rmt_channel}
|
||||
dump: all
|
||||
tolerance: 25%
|
||||
on_abbwelcome:
|
||||
then:
|
||||
- logger.log:
|
||||
|
|
Loading…
Reference in a new issue