@junior_m2011 I finally fixed this issue so I thought I’d come back and update the thread with the steps I took.
Remove the Existing Config Topic from MQTT
Note: When doing this again to write this update, I didn’t need to remove the config, re-enrolling the phone updated the config automatically, however initially when solving the issue the config wasn’t getting updated, ymmv.
First you need to remove the config for the existing device from MQTT (I also removed & reconfigured the MQTT instance, but I don’t think that was really needed.) I used MQTT Explorer on my Mac. If you open the espresense folder, and then rooms you’ll find the config for your device under it’s irk ID. Just delete this topic to remove the config.
This image shows my old config, the ID changes when I re-enroll it below.
Check the contents first to make sure you have the right one. Once you’ve done that have your phone “Forget” the Espresence pairing.
Re-Enroll your phone with Espresense
Just follow the instructions on the espresense website
Make sure you follow HA’s naming requirements as outlined in those docs, the default name generated by espresense will not work with home assistant, it can only include letters, numbers and underscores. Espresense uses colons & dashes by default which HA will not parse, and will not throw an error or warning about!
You might get the config to work if you quote the names with other characters, I have seen config that claims to work written like this, but I have not confirmed that myself, I made sure my names followed the naming instructions exactly, to remove as many variables from the problem as possible.
You might need to restart all your other espresense devices so they pick up the new enrolled name. Use your MQTT viewer and check if new messages are still coming in to the old topic, you should be able to tell which device is sending them by how recent the messages are.
Update your configuration.yaml
First, remove any config for the the device that isn’t working and RESTART HOME ASSISTANT. You can check it’s been removed by filtering the entity list in HA by the mqtt_room
integration (if this was you’re only device and it’s gone, the integration won’t be available to filter by.)
Add a section that maps your device’s ID from Espresense to a Home Assistant device.
sensor:
- platform: mqtt_room
device_id: stuarts_iphone
name: ESP Stuarts iPhone
state_topic: espresense/devices/stuarts_iphone
timeout: 60
away_timeout: 120
After this you must RESTART HOME ASSISTANT, simply re-loading the yaml config will not pick up your changes. I suspect this is the most important step tbh, possibly the only step actually needed, but I have no way to verify that, but again, ymmv.