OK - fiddling around again. I turned on debug logging in configuration.yaml
:
logger:
default: info
logs:
homeassistant.components.mqtt: debug
I can see sensors and switches being created, but when I try to delete my entities only the sensors get deleted when I publish an empty config.
The creation looks like (I removed the device config for now):
2021-05-20 08:07:54 DEBUG (MainThread) [homeassistant.components.mqtt] Received message on homeassistant/switch/pi0-node0-valve0/config: b'{"name": "Valve 1", "state_topic": "homeassistant/switch/pi0-node0-valve0/state", "command_topic": "homeassistant/switch/pi0-node0-valve0/command", "availability": [{"topic": "homeassistant/switch/pi0-node0-valve0/available", "payload_not_available": "OFFLINE", "payload_available": "ONLINE"}], "unique_id": "pi0-node0-valve0", "icon": "mdi:water"}'
2021-05-20 08:07:54 DEBUG (MainThread) [homeassistant.components.mqtt.discovery] Process discovery payload {'name': 'Valve 1', 'state_topic': 'homeassistant/switch/pi0-node0-valve0/state', 'command_topic': 'homeassistant/switch/pi0-node0-valve0/command', 'availability': [{'topic': 'homeassistant/switch/pi0-node0-valve0/available', 'payload_not_available': 'OFFLINE', 'payload_available': 'ONLINE'}], 'unique_id': 'pi0-node0-valve0', 'icon': 'mdi:water', 'platform': 'mqtt'}
2021-05-20 08:07:54 INFO (MainThread) [homeassistant.components.mqtt.discovery] Found new component: switch pi0-node0-valve0
2021-05-20 08:07:54 INFO (SyncWorker_3) [homeassistant.loader] Loaded switch from homeassistant.components.switch
2021-05-20 08:07:54 INFO (MainThread) [homeassistant.setup] Setting up switch
2021-05-20 08:07:54 INFO (MainThread) [homeassistant.setup] Setup of domain switch took 0.0 seconds
Then when I send the empty messages to delete the entities I see this:
2021-05-20 08:08:12 DEBUG (MainThread) [homeassistant.components.mqtt] Received message on homeassistant/sensor/pi0-node0-valve0/config: b''
2021-05-20 08:08:12 DEBUG (MainThread) [homeassistant.components.mqtt.discovery] Process discovery payload {}
2021-05-20 08:08:12 DEBUG (MainThread) [homeassistant.components.mqtt] Received message on homeassistant/sensor/pi0-node0-flow0/config: b''
2021-05-20 08:08:12 DEBUG (MainThread) [homeassistant.components.mqtt.discovery] Process discovery payload {}
2021-05-20 08:08:12 INFO (MainThread) [homeassistant.components.mqtt.discovery] Component has already been discovered: sensor pi0-node0-flow0, sending update
2021-05-20 08:08:12 INFO (MainThread) [homeassistant.components.mqtt.mixins] Got update for entity with hash: ('sensor', 'pi0-node0-flow0') '{}'
2021-05-20 08:08:12 INFO (MainThread) [homeassistant.components.mqtt.mixins] Removing component: sensor.flow_1
2021-05-20 08:08:13 DEBUG (MainThread) [homeassistant.components.mqtt.discovery] Pending discovery for ('sensor', 'pi0-node0-flow0'): deque([])
Notice the distinct lack of activity for the valve (which is a switch). I can manually delete the entities in the user interface, and then sometimes I also need to restart the core before they disappear.
Why does this seem half baked?