springfall2008 / batpred

Home battery prediction and charging automation for Home Assistant, supporting many inverter types
https://springfall2008.github.io/batpred/
118 stars 41 forks source link

Add unique id's to predbat entities #104

Closed gcoan closed 8 months ago

gcoan commented 1 year ago

Currently the predbat control entities do not have unique id's so its not possible to manage them in the home assistant UI. For example to hide entities such as car charger that are not relevant to every user. Capture

springfall2008 commented 1 year ago

Yes you are right, to be honest I don't know how to fix it with AppDeamon either.

gcoan commented 1 year ago

Don't know if these help https://community.home-assistant.io/t/can-you-give-an-entity-created-by-set-state-in-appdaemon-an-unique-id/485513 https://community.home-assistant.io/t/how-to-programmatically-assign-a-unique-id/394856

springfall2008 commented 1 year ago

Yes I did see this, it seems I'd have to change Predbat to use MQTT to make this work, it seemed like a lot of effort.

springfall2008 commented 8 months ago

Really only fixable with an integration which is work in progress, so closing this ticket.

gcoan commented 8 months ago

I just had another look at this, as I had the same problem with sensors created via templates (and configuration.yaml) not having unique_id's but I was able to add unique_id's to those

So just had another look if it was possible to do this via Python set_state and it comes back to the same answer, of No, you have to use MQTT Discovery instead https://community.home-assistant.io/t/how-to-programmatically-assign-a-unique-id/394856

There are sample codes to do this, its not a wholesale change to MQTT, only needed in the bits of predbat that create entities on initial startup that would need to use MQTT instead of set_state