I start this post with the fact that realize that ESPHome may be better suited to accomplish this (I will be testing that setup next), but I am using this as a learning experience to work with Tasmota and understand configuration and communications with Home Assistant.
With that being said, I have an ESP8266 NodeMCU that I have flashed with Tasmota and I am trying to read the status of the GPIO pins being opened / closed (in the hopes to monitor the status of say the states in a washer machine cycle).
I have Tasmota Configured like this.
MQTT is setup like this.
When I start the NodeMCU, the Tasmota console prints the following.
00:00:00 CFG: Loaded from flash at F6, Count 38
00:00:00 Project tasmota Tasmota Version 8.2.0(tasmota)-STAGE
00:00:00 WIF: Connecting to AP1 FF5 in mode 11N as tasmota_test-2713...
00:00:07 WIF: Connected
00:00:07 HTP: Web server active on tasmota_test-2713 with IP address 192.168.86.132
11:59:32 MQT: Attempting connection...
11:59:33 MQT: Connected
11:59:33 MQT: tele/tasmota_test/LWT = Online (retained)
11:59:33 MQT: cmnd/tasmota_test/POWER =
11:59:33 MQT: tele/tasmota_test/INFO1 = {"Module":"Generic","Version":"8.2.0(tasmota)","FallbackTopic":"cmnd/DVES_D66A99_fb/","GroupTopic":"cmnd/tasmotas/"}
11:59:33 MQT: tele/tasmota_test/INFO2 = {"WebServerMode":"Admin","Hostname":"tasmota_test-2713","IPAddress":"192.168.86.132"}
11:59:33 MQT: tele/tasmota_test/INFO3 = {"RestartReason":"Software/System restart"}
11:59:36 MQT: tele/tasmota_test/STATE = {"Time":"2020-04-29T11:59:36","Uptime":"0T00:00:14","UptimeSec":14,"Heap":27,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"MqttCount":1,"Wifi":{"AP":1,"SSId":"FF5","BSSId":"28:BD:89:F6:A1:6C","Channel":11,"RSSI":100,"Signal":-44,"LinkCount":1,"Downtime":"0T00:00:08"}}
11:59:36 MQT: tele/tasmota_test/SENSOR = {"Time":"2020-04-29T11:59:36","Switch1":"OFF","Switch2":"OFF","Switch3":"OFF"}
The tele/tasmota_test/SENSOR
command is showing the status of the switches / GPIO pins.
When I close the GPIO pins 12, 13 and / or 14, I get the following command on the console.
12:01:46 MQT: cmnd/tasmota_test/POWER = ON
12:01:46 MQT: stat/tasmota_test/RESULT = {"Command":"Error"}
I’m not sure why there is a command error (could be from me messing around with other configuration), but the change in GPIO pin state executes a POWER = ON
command and is not specific to the actual GPIO pins closed.
When Tasmota runs the tele/tasmota_test/SENSOR
command, the console displays the following for the switch states which is correct.
tele/tasmota_test/SENSOR = {"Time":"2020-04-29T12:04:36","Switch1":"ON","Switch2":"OFF","Switch3":"OFF"}
Question 1: For troubleshooting purposes, how can I call the tele/tasmota_test/SENSOR
command to get the sensor statuses instead of waiting for Tasmota to print that statement automatically?
Now working in Home Assistant, I have the following YAML setup…
binary_sensor:
- platform: mqtt
name: Switch1
state_topic: "tele/tasmota_D66A99/SENSOR"
value_template: "{{ value_json.Switch }}"
…but when changing the state of the GPIO pin, the status is not reflected in Home Assistant. I suspect that I have either the state_topic
or the value_template
(or more) not setup properly.
Question 2: In general, what am I going wrong here on the Home Assistant side?
Question 3: I’ve been at this on and off for a couple of days, still new and trying to learn as I go, but I keep failing with what I feel are some basic setups / concepts. Any suggestions on things to read / watch at this point to understand this further?