sorry but every 2 to 3 update cause 2 simple switches to stop working again, and now lovelace default is gone and discovery was enabled again.
You’re going to have to provide more information and details. None of us know your setup or what you’re referring to.
Home Assistant
0.89.1
configuration yaml
add mqtt switches
switch:
-
platform: mqtt
name: “Turtle Tank Lights”
command_topic: “cmnd/sonoff61/power”
state_topic: “stat/sonoff61/POWER”
qos: 1
payload_on: “ON”
payload_off: “OFF”
retain: true -
platform: mqtt
name: “Turtle Tank Outlet”
command_topic: “cmnd/sonoff52/power”
state_topic: “stat/sonoff52/POWER”
qos: 1
payload_on: “ON”
payload_off: “OFF”
retain: true
automation.yaml
-
alias: “Turtle Tank Lights On”
hide_entity: True
trigger:
platform: time
at: ‘14:05:00’
action:- service: homeassistant.turn_on
entity_id: switch.turtle_tank_lights
- service: homeassistant.turn_on
-
alias: “Turtle Tank Lights Off”
hide_entity: True
trigger:
platform: time
at: ‘21:30:00’
action:- service: homeassistant.turn_off
entity_id: switch.turtle_tank_lights
- service: homeassistant.turn_off
both sonoff basic and th on 6.4.1
YAML is whitespace sensitive. The way your code currently looks, as posted, it’s impossible to tell if it will work. I’m sure in your file the white space is different, but nobody on the forum can tell if it’s correct.
Copy and paste your code in, then highlight all of the code, then press the </>
symbol. Or put a “```” before and a “```” after your code. That will also format it correctly in the forum.
90% of your problems are because you use retain: true. You need to delete that and then remove the persistence database. Use MQTT explorer to delete the retain flag.
There is also a video showing how to correctly setup retain and power-on status. There’s a link to this here Sonoff Tasmota S26 Constantly Disconnecting
You should also look at using MQTT discovery.
There are issues with 6.4.1.x if you are using core 2.4.2 of Tasmota as well. Try going to either core 2.3.0 or 2.5.0. I have stability issues with everything but core 2.3.0.
thank you for your response. I have complete int instruction but no luck.
i just noticed something weird
in sonoff tasmota i see this:
00:00:00 Project sonoff Sonoff52 (Topic sonoff52, Fallback DVES_0DCFCF, GroupTopic sonoffs) Version 6.2.1-2_3_0
00:00:00 WIF: Connecting to AP1 wlan-g in mode 11N as sonoff52-4047…
funny the mqtt information and name of the device is Sonoff52
Do you have MQTT discovery enabled?
discovery is back enabled and restart still no luck. tomorrow i will start from scratch again re-flash sonoff and rebuild HA again, this would be 3 times in 2 months.
You don’t need to rebuild HA again! Just fix the problem!
Reflash? Why? This is mostlikely a configuration problem although if you are using Tasmota 2.4.1 I would recommend flashing with the latest dev version and 2.3.0 core (not 2.4.2 which is the default)
I use MQTT discovery. MQTT discovery is probably why the switches are showing as they are.
Look… remove all MQTT from the configuration including the switch definitions. Use the default broker settings (make sure that Tasmota is using a valid home assistant username and password for the broker - I just created a home assistant user with the username and password I was using previously with Tasmota - then you can just use default settings in the broker)
Use the MQTT integration with discovery enabled.
You need to get rid of the retain flag out of the persistence database… this is 90% of your grief.
Steps to follow:
- comment out all mqtt: settings and switches from config yaml
- remove the mosquitto broker from HA. If using a username and password in Tasmota, make sure that is a home assistant user.
- Remove the MQTT integration
- Flash latest dev 2.3.0 core to devices and enable MQTT discovery SetOption19 On
- Restart Home Assistant
- Add the broker and leave at the default settings
- Add the MQTT integration and check Discovery
- Check states and see your switches…
Then you can change their names etc…
i clear the flash a rebuilt down to 6.2.1 then use a backlog to reset everything hostname, ip etc…
it’s weird it’s works for a little while then a updates mess everything up.
I don’t understand what you mean by this…
Are you doing a reset 5 from the console?
It will ‘remember’ any settings you made when you compiled the firmware… What is a backlog? Never done that.
I have always edited user_config.h to enter all my settings and then compiled my own firmware…
There is a definite issue with 6.4.1 if you just used core 2.4.2…
i did in the beginning. i had atom crash too many time.
i use latest easy and fast method I easy8266 to flash with standard bin then i open terminate and use a backlog configuration and example Backlog mqtthost ; mqttuser ; mqttpassword . I have a notepad++ file with each device hostname and ipaddress, then i have satndard like ,ssid, password, default gateway, dns, mqtt, etc.
I can do a sonoff from start to finish in about 2 minutes.
.
Same but all my MQTT and WLAN and set options all via the firmware file… Anyway doesn’t matter… I think your firmware is one issue and the retain another… See steps to fix both above.
even clean install 89.1 and clean 6.2.1 sonoff tasmota can’t coneect to mqtt, i’m done!
after the third attempt evening was working for 14 hours until 89.2 was installed
now I can’t connect to mqt server anymore