Thanks @mxr662, you were right, if you let it sit or power cycle the whole unit the control comes back. I’m wondering if the MCU gets some garbage in its input buffer that puts it in a bad state when we are playing with the ESP pins during configuration. Anyhow, with that fixed I was able to get everything connected to HASS and even Google Assistant so thanks.
I am noticing another issue with either the MCU or the Tasmota FW. It seems the FW does not update with every press of the switch button and thus HASS and Google do not either. Instead it takes two cycles to get the FW to update and trigger an update in HASS. For example:
- Press Button -> Switch lights On, FW updates to On
- Press Button -> Switch lights Off, FW stays On
- Press Button -> Switch lights On, FW stays On
- Press Button -> Switch lights Off, FW updates to Off
A little annotated console output:
********** NOTE: About 00:48:34 First Button Press to turn ON
00:48:34 MQT: Device-Dimmer-MasterBedroom/tele/HASS_STATE = {"Version":"7.1.2(tasmota)","BuildDateTime":"2019-12-06T11:22:22","Core":"2_6_1","SDK":"2.2.2-dev(38a443e)","Module":"Tuya MCU","RestartReason":"Power on","Uptime":"0T00:10:02","WiFi LinkCount":1,"WiFi Downtime":"0T00:00:07","MqttCount":1,"BootCount":21,"SaveCount":246,"IPAddress":"172.16.1.107","RSSI":"80","LoadAvg":19}
00:48:36 {"TuyaReceived":{"Data":"55AA03070005010100010112","Cmnd":7,"CmndData":"0101000101","DpId":1,"DpIdType":1,"DpIdData":"01"}}
00:48:36 TYA: fnId=11 is set for dpId=1
00:48:36 TYA: RX Relay-1 --> MCU State: On Current State:Off
00:48:36 SRC: Switch
00:48:36 TYA: Send dim value=329 (id=2)
00:48:36 TYA: Send "55aa0006000802020004000001495f"
00:48:36 MQT: Device-Dimmer-MasterBedroom/tele/STATE = {"Time":"2019-12-12T00:48:36","Uptime":"0T00:10:04","UptimeSec":604,"Heap":27,"SleepMode":"Dynamic","Sleep":10,"LoadAvg":25,"MqttCount":1,"POWER":"ON","Dimmer":33,"Fade":"OFF","Speed":1,"LedTable":"ON","Wifi":{"AP":1,"SSId":"Jingleheimer-IoT","BSSId":"00:16:B6:EB:8F:68","Channel":1,"RSSI":80,"LinkCount":1,"Downtime":"0T00:00:07"}}
00:48:36 MQT: Device-Dimmer-MasterBedroom/stat/RESULT = {"POWER":"ON"}
00:48:36 MQT: Device-Dimmer-MasterBedroom/stat/POWER = ON
00:48:36 {"TuyaReceived":{"Data":"55AA03070008020200040000014963","Cmnd":7,"CmndData":"0202000400000149","DpId":2,"DpIdType":2,"DpIdData":"00000149"}}
00:48:36 TYA: fnId=21 is set for dpId=2
00:48:36 TYA: RX Dim State=329
00:48:36 CFG: Saved to flash at F6, Count 247, Bytes 4096
00:48:37 TYA: Send "55aa00000000ff"
00:48:37 {"TuyaReceived":{"Data":"55AA030000010104","Cmnd":0,"CmndData":"01"}}
00:48:37 TYA: Heartbeat
00:48:40 WIF: Checking connection...
00:48:40 WIF: Connected
********** NOTE: About 00:48:40 Second Button Press to turn OFF
********** NOTE: About 00:48:45 Third Button Press to turn ON
00:48:45 MQT: Device-Dimmer-MasterBedroom/tele/STATE = {"Time":"2019-12-12T00:48:45","Uptime":"0T00:10:13","UptimeSec":613,"Heap":27,"SleepMode":"Dynamic","Sleep":10,"LoadAvg":67,"MqttCount":1,"POWER":"ON","Dimmer":33,"Fade":"OFF","Speed":1,"LedTable":"ON","Wifi":{"AP":1,"SSId":"Jingleheimer-IoT","BSSId":"00:16:B6:EB:8F:68","Channel":1,"RSSI":74,"LinkCount":1,"Downtime":"0T00:00:07"}}
00:48:45 {"TuyaReceived":{"Data":"55AA03070008020200040000014A64","Cmnd":7,"CmndData":"020200040000014A","DpId":2,"DpIdType":2,"DpIdData":"0000014A"}}
00:48:45 TYA: fnId=21 is set for dpId=2
00:48:45 TYA: RX Dim State=330
00:48:48 TYA: Send "55aa00000000ff"
00:48:48 {"TuyaReceived":{"Data":"55AA030000010104","Cmnd":0,"CmndData":"01"}}
00:48:48 TYA: Heartbeat
********** NOTE: About 00:48:50 Fourth Button Press to turn OFF
00:48:50 {"TuyaReceived":{"Data":"55AA03070005010100010011","Cmnd":7,"CmndData":"0101000100","DpId":1,"DpIdType":1,"DpIdData":"00"}}
00:48:50 TYA: fnId=11 is set for dpId=1
00:48:50 TYA: RX Relay-1 --> MCU State: Off Current State:On
00:48:50 SRC: Switch
00:48:50 TYA: Send dim skipped value=0
00:48:50 MQT: Device-Dimmer-MasterBedroom/tele/STATE = {"Time":"2019-12-12T00:48:50","Uptime":"0T00:10:18","UptimeSec":618,"Heap":27,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":87,"MqttCount":1,"POWER":"OFF","Dimmer":33,"Fade":"OFF","Speed":1,"LedTable":"ON","Wifi":{"AP":1,"SSId":"Jingleheimer-IoT","BSSId":"00:16:B6:EB:8F:68","Channel":1,"RSSI":70,"LinkCount":1,"Downtime":"0T00:00:07"}}
00:48:50 MQT: Device-Dimmer-MasterBedroom/stat/RESULT = {"POWER":"OFF"}
00:48:50 MQT: Device-Dimmer-MasterBedroom/stat/POWER = OFF
00:48:51 CFG: Saved to flash at F5, Count 248, Bytes 4096
Given this Im going to try ESPHome and see if its an MCU issue or Tasmota issue (before filing a defect).
@backcountrymountains in setting up ESPHome, what did you select for the board type? I’ve got this as my current configuration but figured I’d ask before flashing:
esphome:
name: maser_bedroom_dimmer
platform: ESP8266
board: esp8285
wifi:
ssid:
password:
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid:
password:
captive_portal:
# Make sure logging is not using the serial port
logger:
baud_rate: 0
level: VERBOSE
# Enable Home Assistant API
api:
password:
ota:
password:
# My dimmer used the hardware serial port on the alternate pins
uart:
rx_pin: GPIO3
tx_pin: GPIO1
baud_rate: 9600
# Register the Tuya MCU connection
tuya:
# Make the light
light:
- platform: "tuya"
name: "Dimmer"
dimmer_datapoint: 2
switch_datapoint: 1
min_value: 10
max_value: 1000
Thanks all again!