Hello,
I’ve been playig around on this for a couple of days, and read many posts, I have rewritten the code in espeasy many times and now using MQTT.fx for testing without any luck.
I have an issue with configuring the state topic in HA - Ha seems to subscribe to the state_topic, but dosnt do anything when i send values to it.
I am running version 61.1 (updated 21/01/2017) the issue i have has existed since 60.0.
I’m running mosquito on the same HA machine.
I have in created debug logging in HA and added the logging below.
I can turn on the switch using HA, then after a couple of seconds the switch returns to its original position ( I think this is an indication that the “state” is not working)
my birth and LWT messages do work.
However when i set “optimistic” to “false” i expect the state_topic to control the switch position when receiving updates?
I can see the messages do reach HA, but HA does not toggle the switch?
2018-01-21 14:24:58 DEBUG (MainThread) [homeassistant.components.mqtt] Received message on /esp11/status: Connected
2018-01-21 14:25:04 DEBUG (MainThread) [homeassistant.components.mqtt] Received message on /esp11/relay/Switch: on
2018-01-21 14:25:04 DEBUG (MainThread) [homeassistant.components.mqtt] Received message on /esp11/relay/Switch: 0
2018-01-21 14:25:10 DEBUG (MainThread) [homeassistant.components.mqtt] Received message on /esp11/relay/Switch: 1
2018-01-21 14:25:22 DEBUG (MainThread) [homeassistant.components.mqtt] Received message on /esp11/relay/Switch: 1.0
2018-01-21 14:25:35 DEBUG (MainThread) [homeassistant.components.mqtt] Received message on /esp11/relay/Switch: "1.0"
2018-01-21 14:25:44 DEBUG (MainThread) [homeassistant.components.mqtt] Received message on /esp11/relay/Switch: "1"
2018-01-21 14:25:54 DEBUG (MainThread) [homeassistant.components.mqtt] Received message on /esp11/relay/Switch: 1
2018-01-21 14:26:50 DEBUG (MainThread) [homeassistant.components.mqtt] Received message on /esp11/relay/Switch: 0
2018-01-21 14:26:59 DEBUG (MainThread) [homeassistant.components.mqtt] Received message on /esp11/relay/Switch: 1
Here is my switch configuration:
- platform: mqtt
name: “Recycle Fountain”
state_topic: “/esp11/relay/Switch”
command_topic: “/esp11/gpio/12”
payload_on: “1”
payload_off: “0”
availability_topic: “/esp11/status”
payload_available: “Connected”
payload_not_available: “Connection Lost”
optimistic: false
qos: 0
retain: false
value_template: ‘{{ value.x }}’
How is it possible that HA receives the MQTT message, the message matches the state_topic and yet the switch doesn’t toggle? - im pretty new to HA so maybe I misunderstand what the state topic does?
any help much appreciated.
NZcam