Hi everyone!
I’m relatively new to HA and today I developed my first custom component. From my perspective, it’s fairy simple, as its just a copy of the history_stats domain but a little changed to show the sensor measure with a specific format (HH:MM:SS) instead of in decimals with tho digits (eg. 1.01)
I have used the history_stats folder from home assistant core and have modified the pretty duration function and have called it in the native value function:
@property
def native_value(self):
"""Return the state of the sensor."""
if self.value is None or self.count is None:
return None
if self._type == CONF_TYPE_TIME:
return HistoryStatsSecondHelper.pretty_duration(self.value)
I have modified the domain to be “history_stats_second” in the init file, value used to call this function and have kept the PLATFORMS option to [“SENSOR”]
await async_setup_reload_service(hass, DOMAIN, PLATFORMS)
I add the integration in HACS and restart HA.
I don’t know how to see if something is going wrong, but when I try to create a sensor in config.yaml using this domain as a template (template: history_stats_second) the config checker raises an error:
Platform error sensor.history_stats_second - Integration 'history_stats_second' not found.
The integration can be found here: GitHub - gontxomde/ha-seconds-history-stats at dedd85e83386b81a226a16b2dfdd9f475671acad
Sorry if the doubt is pretty obvious but I have not been able to find any solution
Thanks in advance