mirror of
https://github.com/esphome/esphome.git
synced 2025-01-31 10:10:56 +00:00
commit
0ee4348777
@ -63,7 +63,13 @@ def validate_tolerance(value):
|
|||||||
if "%" in str(value):
|
if "%" in str(value):
|
||||||
type_ = TYPE_PERCENTAGE
|
type_ = TYPE_PERCENTAGE
|
||||||
else:
|
else:
|
||||||
|
try:
|
||||||
|
cv.positive_time_period_microseconds(value)
|
||||||
type_ = TYPE_TIME
|
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(
|
return TOLERANCE_SCHEMA(
|
||||||
{
|
{
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,6 @@
|
|||||||
"""Constants used by esphome."""
|
"""Constants used by esphome."""
|
||||||
|
|
||||||
__version__ = "2024.5.1"
|
__version__ = "2024.5.2"
|
||||||
|
|
||||||
ALLOWED_NAME_CHARS = "abcdefghijklmnopqrstuvwxyz0123456789-_"
|
ALLOWED_NAME_CHARS = "abcdefghijklmnopqrstuvwxyz0123456789-_"
|
||||||
VALID_SUBSTITUTIONS_CHARACTERS = (
|
VALID_SUBSTITUTIONS_CHARACTERS = (
|
||||||
|
@ -103,7 +103,7 @@ class DashboardEntries:
|
|||||||
|
|
||||||
def all(self) -> list[DashboardEntry]:
|
def all(self) -> list[DashboardEntry]:
|
||||||
"""Return all entries."""
|
"""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]:
|
def async_all(self) -> list[DashboardEntry]:
|
||||||
"""Return all entries."""
|
"""Return all entries."""
|
||||||
|
@ -18,7 +18,7 @@ class MqttStatusThread(threading.Thread):
|
|||||||
"""Run the status thread."""
|
"""Run the status thread."""
|
||||||
dashboard = DASHBOARD
|
dashboard = DASHBOARD
|
||||||
entries = dashboard.entries
|
entries = dashboard.entries
|
||||||
current_entries = entries.async_all()
|
current_entries = entries.all()
|
||||||
|
|
||||||
config = mqtt.config_from_env()
|
config = mqtt.config_from_env()
|
||||||
topic = "esphome/discover/#"
|
topic = "esphome/discover/#"
|
||||||
@ -33,7 +33,7 @@ class MqttStatusThread(threading.Thread):
|
|||||||
return
|
return
|
||||||
for entry in current_entries:
|
for entry in current_entries:
|
||||||
if entry.name == data["name"]:
|
if entry.name == data["name"]:
|
||||||
entries.async_set_state(entry, EntryState.ONLINE)
|
entries.set_state(entry, EntryState.ONLINE)
|
||||||
return
|
return
|
||||||
|
|
||||||
def on_connect(client, userdata, flags, return_code):
|
def on_connect(client, userdata, flags, return_code):
|
||||||
@ -53,11 +53,11 @@ class MqttStatusThread(threading.Thread):
|
|||||||
client.loop_start()
|
client.loop_start()
|
||||||
|
|
||||||
while not dashboard.stop_event.wait(2):
|
while not dashboard.stop_event.wait(2):
|
||||||
current_entries = entries.async_all()
|
current_entries = entries.all()
|
||||||
# will be set to true on on_message
|
# will be set to true on on_message
|
||||||
for entry in current_entries:
|
for entry in current_entries:
|
||||||
if entry.no_mdns:
|
if entry.no_mdns:
|
||||||
entries.async_set_state(entry, EntryState.OFFLINE)
|
entries.set_state(entry, EntryState.OFFLINE)
|
||||||
|
|
||||||
client.publish("esphome/discover", None, retain=False)
|
client.publish("esphome/discover", None, retain=False)
|
||||||
dashboard.mqtt_ping_request.wait()
|
dashboard.mqtt_ping_request.wait()
|
||||||
|
@ -3,6 +3,7 @@ remote_receiver:
|
|||||||
pin: ${pin}
|
pin: ${pin}
|
||||||
rmt_channel: ${rmt_channel}
|
rmt_channel: ${rmt_channel}
|
||||||
dump: all
|
dump: all
|
||||||
|
tolerance: 25%
|
||||||
on_abbwelcome:
|
on_abbwelcome:
|
||||||
then:
|
then:
|
||||||
- logger.log:
|
- logger.log:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user