Managing devices in Integrations and device_registry

I tried to use active: true but if you are using a Home Assistant user for MQTT then it just doesn’t work. Doesn’t matter what you put in the ACL!

Those ‘errors’ are just info I believe - not errors anyway.

So I just use the absolute defaults for the MQTT broker… I don’t configure anything there. I have nothing for MQTT in config and none of my switches are manually configured… everything is done via discovery.

Once Home Assistant has ‘seen’ a device it will continue to use that name when it ‘sees’ the device again - they all have unique ID’s. I don’t know why it gets screwed up sometimes. If the first device exists, it should just use that but if it can’t you end up with the _2 etc.

You then need to delete the wrong one in the entity registry and can rename the ‘new’ one. Alternate is scorched earth… I found that MQTT explorer was invaluable for getting rid of shit and also showing you what is actually in the MQTT persistence database… if you use that, you don’t need to remove the broker.

So I’d use MQTT explorer to clean out the broker and the entity registry to get rid of bogus entities/devices.

If that doesn’t work, delete all devices from entity_registry, remove the MQTT integration and delete the broker. Restart HA and then add back again. If you want to be 100% sure, stop HA instead of restarting and then get to work with an editor on the .storage files to remove any MQYY devices… just be very careful not to break the JSON structure and make sure you have a readily available backup in case. If you break the JSON, you’ll need to copy back and try again…

Ok, I think I might be close to understanding all this :slight_smile:
Migrating from manually configured Sonoffs using Tasmota before (I think) v6.3.0 is not really a trivial exercise.

One thing that is disappointing is that setting the ‘Name override’ in an entity only changes its ‘friendly name’.

I number my Sonoffs and label them and their device name is Sonoff01, 02… 06 etc. When they are manually configured they get to be called anything you like in HA you like but now I have to remember what number Sonoff is attached to what appliance or lamp in order to refer to them in my yaml code. All my existing automations and scripts will need to be checked and amended too.

@DavidFW1960 Did you go through all this when you changed to discovery?

Also I have so far only configured two Sonoff Basics. In MQTT Explorer under the homeassistant topic I have sub topics for light, switch and binary sensor. The light and switch topics each have eight sub topics and the biinary_sensor has four.

Why?

It is going to be a fairly long process upgrading all my Sonoffs and then having them ‘discovered’ but I do plan to document the process here for any future readers…

image

image

image

I did but only because I used a different friendly name in Tasmota under config other. It uses that name in Home Assistant.

I think I’m nearly there! (and I think having discovery actually has some benefits :slight_smile: )

On last (I hope) detail, I’m getting this warning when I plug in a Sonoff. Is there something I can do to stop it?

2019-03-19 12:18:29 WARNING (MainThread) [homeassistant.components.mqtt.binary_sensor] No matching payload found for entity: Sonoff06 BTN with state_topic: sonoff06/cmnd/POWER

Sounds like a retained message being sent on connect. Maybe check that MQTT Explorer…

I think you might be right.
I’m not entirely sure what was going on :slight_smile: but I deleted a load of stuff off the broker, cycled my sonoffs on and off a couple of times and all seems well… at the moment :wink:

1 Like

BTW… 6.5.0 firmware released today and it defaults to core 2.3.0 thankfully. Loaded here and it looks ok… no bootloops anyway…

Thanks for the heads up.
I never went for the dev version so I am missing those ‘automagic’ sensors you said get created…

1 Like