From 840f69ffe673401f5b1434dbf23213a51489d569 Mon Sep 17 00:00:00 2001 From: acshef Date: Fri, 17 May 2024 22:17:09 -0600 Subject: [PATCH 1/5] Add device_class to valve core config (#6765) --- esphome/components/valve/__init__.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/esphome/components/valve/__init__.py b/esphome/components/valve/__init__.py index 22d617cc36..13c2947438 100644 --- a/esphome/components/valve/__init__.py +++ b/esphome/components/valve/__init__.py @@ -14,6 +14,8 @@ from esphome.const import ( CONF_STATE, CONF_STOP, CONF_TRIGGER_ID, + DEVICE_CLASS_GAS, + DEVICE_CLASS_WATER, ) from esphome.core import CORE, coroutine_with_priority from esphome.cpp_helpers import setup_entity @@ -22,6 +24,11 @@ IS_PLATFORM_COMPONENT = True CODEOWNERS = ["@esphome/core"] +DEVICE_CLASSES = [ + DEVICE_CLASS_GAS, + DEVICE_CLASS_WATER, +] + valve_ns = cg.esphome_ns.namespace("valve") Valve = valve_ns.class_("Valve", cg.EntityBase) @@ -65,6 +72,7 @@ VALVE_SCHEMA = cv.ENTITY_BASE_SCHEMA.extend(cv.MQTT_COMMAND_COMPONENT_SCHEMA).ex { cv.GenerateID(): cv.declare_id(Valve), cv.OnlyWith(CONF_MQTT_ID, "mqtt"): cv.declare_id(mqtt.MQTTValveComponent), + cv.Optional(CONF_DEVICE_CLASS): cv.one_of(*DEVICE_CLASSES, lower=True), cv.Optional(CONF_POSITION_COMMAND_TOPIC): cv.All( cv.requires_component("mqtt"), cv.subscribe_topic ), From 4fc2f2284afd663d6e5649a959ed312dc96c5a38 Mon Sep 17 00:00:00 2001 From: esphomebot Date: Sat, 18 May 2024 19:15:52 +1200 Subject: [PATCH 2/5] Synchronise Device Classes from Home Assistant (#6768) --- esphome/components/valve/__init__.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/esphome/components/valve/__init__.py b/esphome/components/valve/__init__.py index 13c2947438..ea6bfc6055 100644 --- a/esphome/components/valve/__init__.py +++ b/esphome/components/valve/__init__.py @@ -14,6 +14,7 @@ from esphome.const import ( CONF_STATE, CONF_STOP, CONF_TRIGGER_ID, + DEVICE_CLASS_EMPTY, DEVICE_CLASS_GAS, DEVICE_CLASS_WATER, ) @@ -25,6 +26,7 @@ IS_PLATFORM_COMPONENT = True CODEOWNERS = ["@esphome/core"] DEVICE_CLASSES = [ + DEVICE_CLASS_EMPTY, DEVICE_CLASS_GAS, DEVICE_CLASS_WATER, ] From 7452879fb1a85c4bd1795b44d08c4853595ae97e Mon Sep 17 00:00:00 2001 From: Markus <974709+Links2004@users.noreply.github.com> Date: Sun, 19 May 2024 22:33:20 +0200 Subject: [PATCH 3/5] Fix Upload from Dashboard with MQTT discovery. (#6774) Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com> --- esphome/__main__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/esphome/__main__.py b/esphome/__main__.py index 54c1aa112a..1d316a97ee 100644 --- a/esphome/__main__.py +++ b/esphome/__main__.py @@ -346,7 +346,7 @@ def upload_program(config, args, host): not is_ip_address(CORE.address) # pylint: disable=too-many-boolean-expressions and (get_port_type(host) == "MQTT" or config[CONF_MDNS][CONF_DISABLED]) and CONF_MQTT in config - and (not args.device or args.device == "MQTT") + and (not args.device or args.device in ("MQTT", "OTA")) ): from esphome import mqtt From ec6d86c8f5a57ca652449ed9b91b5e975d23f882 Mon Sep 17 00:00:00 2001 From: Markus <974709+Links2004@users.noreply.github.com> Date: Mon, 20 May 2024 01:52:14 +0200 Subject: [PATCH 4/5] Fix MQTT dashboard discovery (Exception in MqttStatusThread). (#6775) --- esphome/dashboard/status/mqtt.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/esphome/dashboard/status/mqtt.py b/esphome/dashboard/status/mqtt.py index 8c35dd2535..0e53c21679 100644 --- a/esphome/dashboard/status/mqtt.py +++ b/esphome/dashboard/status/mqtt.py @@ -18,7 +18,7 @@ class MqttStatusThread(threading.Thread): """Run the status thread.""" dashboard = DASHBOARD entries = dashboard.entries - current_entries = entries.all() + current_entries = entries.async_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.set_state(entry, EntryState.ONLINE) + entries.async_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.all() + current_entries = entries.async_all() # will be set to true on on_message for entry in current_entries: if entry.no_mdns: - entries.set_state(entry, EntryState.OFFLINE) + entries.async_set_state(entry, EntryState.OFFLINE) client.publish("esphome/discover", None, retain=False) dashboard.mqtt_ping_request.wait() From d2d3db4b8c2a29db046eb3478199c9917a28904d Mon Sep 17 00:00:00 2001 From: Jesse Hills <3060199+jesserockz@users.noreply.github.com> Date: Mon, 20 May 2024 17:14:17 +1200 Subject: [PATCH 5/5] Bump version to 2024.5.1 --- esphome/const.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/esphome/const.py b/esphome/const.py index 9871ea704f..9d2b8b78ea 100644 --- a/esphome/const.py +++ b/esphome/const.py @@ -1,6 +1,6 @@ """Constants used by esphome.""" -__version__ = "2024.5.0" +__version__ = "2024.5.1" ALLOWED_NAME_CHARS = "abcdefghijklmnopqrstuvwxyz0123456789-_" VALID_SUBSTITUTIONS_CHARACTERS = (