From aa7f367c95087cb6043671c42f1eef16851f996d Mon Sep 17 00:00:00 2001 From: Arne Seime Date: Tue, 16 Apr 2024 09:43:39 +0200 Subject: [PATCH] Fix button entities not accepting command --- .../esphome/internal/message/ButtonMessageHandler.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/no/seime/openhab/binding/esphome/internal/message/ButtonMessageHandler.java b/src/main/java/no/seime/openhab/binding/esphome/internal/message/ButtonMessageHandler.java index c11c556..87fc1dd 100644 --- a/src/main/java/no/seime/openhab/binding/esphome/internal/message/ButtonMessageHandler.java +++ b/src/main/java/no/seime/openhab/binding/esphome/internal/message/ButtonMessageHandler.java @@ -34,15 +34,15 @@ public ButtonMessageHandler(ESPHomeHandler handler) { @Override public void handleCommand(Channel channel, Command command, int key) throws ProtocolAPIError { if (command instanceof OnOffType) { - handler.sendMessage(ButtonCommandRequest.newBuilder().setKey(key).build()); handler.updateState(channel.getUID(), OnOffType.OFF); + handler.sendMessage(ButtonCommandRequest.newBuilder().setKey(key).build()); } else { logger.warn("Unsupported command type: {}, use OnOffType instead", command); } } public void buildChannels(ListEntitiesButtonResponse rsp) { - Configuration configuration = configuration(rsp.getKey(), null, "Switch"); + Configuration configuration = configuration(rsp.getKey(), null, "Button"); String icon = getChannelIcon(rsp.getIcon(), "switch");