nstrelow / ha_philips_android_tv

Home Assistant custom component for the newer (2016+) Philips Android TVs
109 stars 28 forks source link

Making the code more python-friendly #13

Closed marcosamorim closed 5 years ago

marcosamorim commented 5 years ago

Removing camel case from methods and variable names and turning the code more python-friendly

marcosamorim commented 5 years ago

Sorry for committing without testing, having some issues with my RPi. I've done the changes before some code change, but I believe that I merged correctly. Please, could you verify that I didn't broke anything before commit this PR? Thank you very much.

nstrelow commented 5 years ago

Thank you so much :D

I sadly cannot test, as I currently do not have my Philips TV near me :/ Would be nice, if you could test it first, or I will try and ask somebody else from the community.

nstrelow commented 5 years ago

Love your work :D Should have done this right from the beginning and changed the old stuff.

Did you get the chance to test it yet? 😁

marcosamorim commented 5 years ago

Thanks 🙂

I've just tested the basic functionalities and seems to be working fine. Power and volume up/down.

Feel free to merge it.

nstrelow commented 5 years ago

Thank you so much, MERGED! Code readability is much better now :D

olbjan commented 5 years ago

Remember to update version for custom_updater.

nstrelow commented 5 years ago

Thank for reminding me. But the code does not change the functionality, I can update it anyway.

olbjan commented 5 years ago

initpy too ;) version still needs to increase on every release ... ;)

olbjan commented 5 years ago

I can't turn on the TV:

'PhilipsTVBase' object has no attribute '_getReq' Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 121, in handle_call_service connection.context(msg)) File "/usr/src/homeassistant/homeassistant/core.py", line 1150, in async_call self._execute_service(handler, service_call)) File "/usr/src/homeassistant/homeassistant/core.py", line 1172, in _execute_service await handler.func(service_call) File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 194, in handle_service required_features File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 316, in entity_service_call future.result() # pop exception if have File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 337, in _handle_service_platform_call await getattr(entity, func)(data) File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run result = self.fn(*self.args, *self.kwargs) File "/config/custom_components/philips_android_tv/media_player.py", line 135, in turn_off self.update() File "/usr/src/homeassistant/homeassistant/util/init.py", line 224, in wrapper result = method(args, kwargs) File "/config/custom_components/philips_android_tv/media_player.py", line 244, in update self._tv.update() File "/config/custom_components/philips_android_tv/media_player.py", line 339, in update self.get_favorite_channels() File "/config/custom_components/philips_android_tv/media_player.py", line 394, in get_favorite_channels r = self._getReq('channeldb/tv/channelLists/all') AttributeError: 'PhilipsTVBase' object has no attribute '_getReq'

This is on 0.94.0b4

olbjan commented 5 years ago

Same on 0.93.2

olbjan commented 5 years ago

Turning off doesn't work either and the sources list does not populate at all. :(

marcosamorim commented 5 years ago

My bad, a couple of places are still using the old method name. Pushing the fix now.

nstrelow commented 5 years ago

Thanks @olbjan