Custom component not found

I have several custom_components in my home assistant configuration.
They all load just fine, exept one: a customized version of lgwebostv.

Testing configuration at /home/homeassistant/.homeassistant
Failed config
  General Errors:
    - Platform not found: media_player.webostv_ext

The folder structure is correct: custom_components/media_player/webostv_ext.py
What is causing this error?

Either the file is not correctly validating as a component or the permissions on the file are incorrect.

File permissions are correct. Just to be sure I chmod 755 the file, but problem still remains.
As for the validation: Itā€™s exactly the same code as found on github, with an extra if statement added.

maybe a spelling mistake?

also checked that one, did copy-paste on the file name just to be sure.
I think it has something to do how the component announces itselfā€¦
All my components have the folder structure of service\componentname.py
The webostv component has it in reverse: componentname\service.py (like: webostv\media_player.py)

So it is a replacement for the builtin component right?
Name the file webostv2.py in the folder media_player. And in your config file use platform: webostv2. Can you try that?

Itā€™s indeed a replacement for the builtin component.
What you describe is exactly what I did. I just named it webostv_ext in stead of webostv2.
Also tried it in reverse, create a folder named webostv_ext, and put media_player.py inside.
Always the same error, for that specific component.

That doesnā€™t work.

Did you also named the platform in your config webostv_ext?

Can you share your custom component? Iā€™ll have a look if itā€™s working in my test HA

Yes, I did.

If you use the code found on Github, the problem allready appears.
https://github.com/home-assistant/home-assistant/blob/dev/homeassistant/components/webostv/media_player.py

It has got to do something with how the component announces itself, but I know too little about these custom components to figure out why.

Are you using the beta version of HA? Because this version will not work on the stable version. They changed a few things in the upcomming release (as far as I can see) in the way components are loaded.

Why are you trying to load this dev component? The only difference with the ā€œnormalā€ webostv component is the way itā€™s loaded. Nothing functionally is different.

Iā€™m running the latest stable: 0.87.1
The reason Iā€™m using a custom component is that the ā€˜normalā€™ webostv component is missing the open_url method, implemented in pylgtv.
So I added the following to play_media:

 elif media_type == 'website':
            self._client.open_url(media_id)

Thatā€™s when I bumped into the problem of the component not willing to load.

Then you need to edit the master version of webostv and add that as a custom component.

1 Like

I canā€™t believe that I didnā€™t notice that!
Thnx a lot, Itā€™s loading now.

1 Like

They haveā€¦ Iā€™m on 0.88.0b0 and custom components wonā€™t break but you will get a warning and instructions on how to fix in the logā€¦ no big issue FWIW

To continue on this conversation:

how can I add an extra method to the component?
In the code Iā€™ve added:

def tv_send_enter_key(self):
    self._client.send_enter_key()

This calls the send_enter_key from pylgtv.
Question is: how can I tell home assistant to fire this method?
I guess it has something to do with:

hass.services.register(DOMAIN, 'hello', handle_hello)

create a async def and register as an async service. the def and the async def need to go in the media player object.

SERVICE_PRESS_ENTER = 'enter'
    component.async_register_entity_service(
        SERVICE_PRESS_ENTER, MEDIA_PLAYER_SCHEMA,
        'async_tv_send_enter_key'
    )
def tv_send_enter_key(self):
    self._client.send_enter_key()

async def async_tv_send_enter_key(self):
    await self.hass.async_add_job(self.tv_send_enter_key)
    return

I donā€™t know if this helps anyone, but I had a problem with a custom component not showing up because I was missing a version tag in my manifest.

Additionally, if you are running home assistant docker, restarting Home Assistant from the web gui is not enough, you have to restart the entire docker containerā€¦ At least that is what worked for me, it may have been because that force restarts everything, ignoring the configuration checkā€¦

Yeah nah. Restarting HA is restarting the container