Closed PhillyGilly closed 2 years ago
I don't think this can be implemented. I Did have a look into the config flows before (UI way of configuring things in Home Assistant). But this will take a massive amount of development effort to get implemented, because of all the different
option combinations powercalc has and also lots of other technical challenges and obstacles.
That would be the reason why a lot of core integrations also have no UI way of configuring (yet). For example:
When any of this integrations has a UI configuration I can have another look into how they approached te problem and see if I can do something similar in Powercalc.
Until that time I am not up to the task, as the my time is quite limited. And maintaining/supporting the current component takes a lot of my spare time.
Hi @bramstroker. I wasn't asking for a full UI implementation. And I agree such an idea isn't a good use of your time, because I think it is unlikely that users will be able to implement PowerCalc successfully without investing in learning about how it works. All I asked for was a simple badge to "cue" how many PowerCalc entities have been configured. I had forgotten about the Riemann sensor but the MQTT badge (as above) does show the number of manually configured entities. If it is of any use or interest this integration does include the kind of thing I was thinking of. https://github.com/MindrustUK/Heatmiser-for-home-assistant/tree/master/custom_components/heatmiserneo
I will have another look into other integrations. And also ask on discord to other devs. Did already dig into some other integrations, but they all create their entities from the config flow routine (UI procedure) by looking at the API data, not from user configuration in the yaml file. I think that's why you see them in the entity count on the card.
How exactly did you setup these mqtt entities? On my development installation I don't see any entities here, but I have a MQTT fan and humidifier created.
I have succeeded in adding an entity to powercalc card.
However now the bad news. As I suspected this only works when creating entities from the UI configuration flow, this will not give access to the configuration.yaml. So this will not work for powercalc way of creating entities.
Also the entity needs to have a unique_id (which can be the MAC address or some other information which uniquely identifies a device) to appear in the entities list. In powercalc most entities don't have a unique id. Because they are not a real device, or based on some real device, so we cannot generate a unique_id for it which would always be the same.
That would also be the reason why template sensors, integration sensors, virtual switches etc. also don't have a listing in the integration part of HA.
So unfortunately this can't be implemented with the current HA architecture. Maybe somewhere in the future when the Home Assistant core has been modified to also support the sensors types mentioned above.
I like the card! That's a good question about MQTT! I think the device count is for devices that are auto-discovered by HA. So in my Arduino Power Meter, I made it publish some json files which HA reads so that it can make use of the real payloads.
In the Heatmiser integration, there is just a little bit of Global Configuration (for Heatmiser hub IP address and port) from a pop-up box. The integration reads data being published by the Heatmiser hub and the number of devices looks like a count from a filtered list of devices in the device/entity views. Anything like a count from this would be enough to make me happy.
Unfortunately I cannot realize this because of the reasons mentioned above.
It is working for Heatmiser because they can create the entities from the UI configuration method async_setup_entry
, but this method only has access to the configuration the user provided in the GUI, not the configuration in configuration.yaml
. They only need access to the Heatmiser API data not the configuration.yaml.
And these heatmiser entities have a unique id which is also a prerequisite.
Both these things are not available to powercalc, so that's why it cannot be implemented, even if I wanted to.
Maybe somewhere in the future when the HA architecture provides a way for this.
@bramstroker Thanks for taking the time to investigate and explain. That's all been quite interesting. Cheers
Your welcome! Was a nice feature request, unfortunate it was infeasible.
It could be easier to manage Powercalc configuration if it showed up as an Integration under the HA configuration menu. (In fact PowerCalc is the only integration that I use that does not have this interface) The PowerCalc "badge" could show at a glance the number of sensors/entities. A further enhancement could be to give simple access to the global configuration. This is how it might appear (forgive the icon): Clicking on the number of entities opens this window: