Custom components : questions

hello, maybe I’ve looked in the wrong place, but I’ve not found what I’m looking for, so I’m asking the questions here:
(please keep in mind I’m an experienced developer, but new to python)

  • how do I write logs from a custom_component ?
  • how do I customize a custom_component ? (I’ve tried the usual in customize.yaml but it doesn’t work, specifically icon and friendly_name)
    and this one is a bonus:
  • is there a way to reload a custom_component without restarting my hass.io ?

thx in advance,
M

anyone?
if I missed something, please point me to it, that would be of great help, thanks :grinning:

I can’t help with all of your points, but as far as my custom component development has gone, I can answer some:

The logs are written using the default python logger, if you check existing components, you’ll see a _LOGGER = logging.getLogger(__name__) statement below the imports, this ensures the logs are properly named (so you can track them in the logs).

afterwards, logging is as simple as using _LOGGER. command, where after the . you specify the level (info, debug, error, warning, etc)

Haven’t played around with customise on custom components, other than adding a custom card, which did seem to work just fine for me, following the normal configurations.

restarting hass is needed for changes to components to be visible I think, same as configurations to existing components

Hope this helps :slight_smile:

thx, I’ll try that for the logging part!