Hello_service integration sample

Hello everyone,

I’m very new to home assistant and I was trying to work my way through the custom integrations example hello_service on https://developers.home-assistant.io/docs/dev_101_services/
It really won’t work for me. I’ve copied the code on the page to __init__.py in the folder /custom_components/hello_service. I’ve added hello_service: to the configuration.yaml file, but when I click the “Check Configuration” button in server control, it tells me that it cannot find the integration: “Component error: hello_service - Integration ‘hello_service’ not found.” I cannot - for the life of me - find out what’s wrong here. Could you put me on the right track again please? thanks.

Um…

Could you expand on this? If you really are new to Home Assistant, custom integrations may not be the best place to start. But probably I’ve misunderstood. :roll_eyes:

1 Like

To think you actually took the time to reply this. Thank you oh great keeper of the home assistant secrets. I’ll just keep right-clicking the GUI then. Hello world is too difficult for me. Got it.

1 Like

@bvandevoorde Get off that soapbox platform and follow the guidelines pinned to the top of the forum if you want to get ANY benefit from the forum here.

Especially check out numbers 9, 11, 13 and ESPECIALLY 22!

@Prodigyplace, I read “Any question about Home Assistant, and about using things with Home Assistant, is welcome here.”. So what’s your point? Because mine is that the reply “you should not be doing custom components” is insulting and useless.

To answer the initial question, you have to restart HA after putting the files for HA to recognize the custom integration.
The custom components are only detected on startup.

1 Like

He never said that. He said, rightfully, that custom components are not the proper entry point to HA.
You’d have a bazillion other stuff to learn before getting to that.

If you are actually already experimented, then maybe “I’m very new to home assistant” wasn’t the proper introduction.

@koying thank you. But I cannot restart if the “check configuration” already finds a problem. So as I said, the check configuration thinks the custom component is not there. But it is. I’m running the os version of Hass. I installed the cli/ssh add-on so I could have a look at the permissions of the folders and files I created, but everything looks OK. I’ll have a go again later today.

If you don’t know how to restart HA besides through the GUI, then remove the hello_service:, restart, put it back, restart.

1 Like

I think now I got the missing part of the story through what you just said. The files need to be there and need to have been detected at a first restart before you can actually add the service (in this case) to the yaml configuration. Is restarting from the server control page any different then actually rebooting the ha os completely ? It’s bound to restart the same service I would think. So this integration in any case needs two restarts then?

Restarting through the GUI is an internal function, that does a check first as you noticed.
Restart the docker container or the OS restart the HA process itself.

1 Like

You did not follow the rules needed to get that assistance on the same page as your quote. This is NOT a paid HelpDesk of experts.

You did not show the code of your custom component nor the errors. We have insufficient information to even hazard a guess at the issue.

You may be better off asking for a refund of what you paid for HA and buying a product with paid support staff.

You must have misunderstood or misread something. I did describe the flow and the exact error properly mister policeman.

Thank you @koying. I’ll give it a go this evening.

You’re tact leaves something to be desired. Leave your attitude behind.

Please keep the discussion civil and review our Code of Conduct:

So for those struggling with this in the future and just to summarize: you cannot actually copy the files for the custom_components in place and refer to your service in the configuration.yaml at the same time. You would first need to copy the files in a subdirectory of /config/custom_components, then reboot the HA OS or the docker container (server control->restart seems not enough), then make the reference to your custom component in the yaml configuration and restart again. When restarting this second time, the server control->restart option in the GUI is sufficient.

Thanks @bvandevoorde for sharing the solution. Like a lot of the Home Assistant docs, the critical step of restarting the service before referencing the component in the config isn’t listed in the tutorial. I’m not sure if this community wants to grow, but replying to a question about something that isn’t documented with a rolling eye emoji is terrible way of inviting new users.