After upgrade from 2021.12 to 2022.5 (and 2022.5 - same effect) some Switches changed from accustomed toggle to
Declaration of same entities in config.yaml:
# Shelly SwimpoolBoiler switch
- platform: mqtt
name: "SwimpoolBoiler"
state_topic: "shellies/shelly1pm-E09806A9F1F8/relay/0"
command_topic: "shellies/shelly1pm-E09806A9F1F8/relay/0/command"
payload_on: "on"
payload_off: "off"
# Shelly SwimpoolProjector switch
- platform: mqtt
name: "SwimpoolProjector "
state_topic: "shellies/shelly1l-E8DB84A1B187/relay/0"
command_topic: "shellies/shelly1l-E8DB84A1B187/relay/0/command"
payload_on: "on"
payload_off: "off"
The former changed to 2-button switch, while the latter remains in toggle style.
Can’t find out the reason, please help to sort it out.
zoogara
(Daryl)
May 5, 2022, 10:51pm
2
This changed quite a while back - if you search in the forum there are plenty of discussions re MQTT switches and binary sensors.
The default state was changed from off to unknown, the fix is to ensure that your device sets the retain flag. Depending on your device there are a bunch of methods to do this - see the forum discussions.
I understand some changes were made in the latest updates. Unfortunately i don’t know enough on how to have these binary sensors reflect the correct state or how to fix my dashboard.
I see this with :
# 433Mhz PIR sensors, also added in group.yaml
- unique_id: studyroom_pir_motion_sensor_1
platform: mqtt
name: 'Study Room PIR Motion Sensor 1 motion'
state_topic: 'home/studyroom_pir_motion_sensor_1'
off_delay: 5
device_class: motion
and the EufyMqtt integration as well…
Hi there!
Since a few versions ago, HA started to forget states for some mqtt based, sensors and switches when restarted together with mqtt-addon.
I’ve tried to set tasmota to sensorretain and switchretain, but for some “unknown” reason , tasmota would not send switch2 state with retain.
Here it is what i’ve done to bypass this:
#########################
# Tasmotas fix for Unknown state after home assistant and mqtt restart.
# This fix gets mqtt messages from tasmota, and using automat…
Is there a way to have the battery report as “good” instead of “unknown” in Lovelace?
Here is a sample code:
- platform: mqtt
name: "Main Bathroom Window sensor battery"
state_topic: "home/sensor10_battery"
device_class: battery
qos: 1
I just want to make it if there is nothing sent (since it only sends if there is a low battery) that it states Good or OK.