Fix kodi media_player unavailable at start#41714
Conversation
1 similar comment
|
@alexanv1 are you planning to sign the CLA? If not, then do you mind if I remove you from the history in this PR to make sure we can proceed here? |
177ab01 to
5d98ded
Compare
|
Can this be merged? It seems a lot of people are waiting for it (including me :-). |
| def start_watchdog(event=None): | ||
| """Start websocket watchdog.""" |
There was a problem hiding this comment.
| def start_watchdog(event=None): | |
| """Start websocket watchdog.""" | |
| async def start_websocket(event=None): | |
| """Start websocket.""" | |
| await self._async_connect_websocket_if_disconnected() |
There was a problem hiding this comment.
While this may get the initial state 10 seconds (WEBSOCKET_WATCHDOG_INTERVAL) faster if kodi is available and responding, it will block HA startup longer than necessary if the kodi instance does not respond.
In my opinion, it's better to wait a bit and let HA start up before making the first connection attempt.
There was a problem hiding this comment.
Since its not happing until after the start event and its async, it shouldn't block anything since I/O is being awaited. We don't call async_block_till_done after the STARTED event.
What am I missing here?
There was a problem hiding this comment.
My mistake, it should indeed be possible to connect right away. I will make the change soon.
| # If Home Assistant is already in a running state, start the watchdog | ||
| # immediately, else trigger it after Home Assistant has finished starting. | ||
| if self.hass.state == CoreState.running: | ||
| start_watchdog() |
There was a problem hiding this comment.
| start_watchdog() | |
| await start_websocket() |
bdraco
left a comment
There was a problem hiding this comment.
You should be able to start the websocket right away after the started event is fired without having to wait.
Suggested change above (untested)
|
Thanks |
* 'dev' of https://github.com/home-assistant/core: (77 commits) Fix kodi media_player unavailable at start (home-assistant#41714) Add an option to template delay_on/off in template binary sensor (home-assistant#43259) Bump hatasmota to 0.0.31 (home-assistant#43319) Update cloud integration to 0.38.0 (home-assistant#43314) Add progress translation key to hassfest (home-assistant#43311) Bump codecov/codecov-action from v1.0.14 to v1.0.15 (home-assistant#43304) Improvement to allow parsing of station ID in vasttrafik integration. Addresses home-assistant#34851 (home-assistant#43136) Abort vizio discovery flow without unique ID (home-assistant#43303) Update directv to 0.4.0 (home-assistant#43302) Add notification binary_sensor to Plugwise integration (home-assistant#41473) [ci skip] Translation update Bump bimmer_connected to 0.7.13 (home-assistant#43294) Bump aioguardian to 1.0.4 (home-assistant#43299) Refactor how entities are created for homekit_controller services (home-assistant#43242) Updated frontend to 20201111.1 (home-assistant#43298) Update pytradfri to 7.0.4 (home-assistant#43297) Remove pts adjustments in stream (home-assistant#42399) Fix Enigma2 available entity property (home-assistant#43292) Make MQTT climate return PRESET_NONE when no preset is set (home-assistant#43257) Bump env_canada to 0.2.4, fix config validation (home-assistant#43251) ...
|
Is this in 0.118? Still getting this error. |
|
Nope, only in dev at the moment. Should be in 0.119.0 though. |
|
Allright thanks for the update. Great job! |
Proposed change
After the recent overhaul of the kodi integration, the media player entity is
unavailablewhen Home Assistant starts until the related kodi instance comes online. This prevents the power button from showing up on the media player card.This PR changes the behavior so the media player entities are
offat startup, allowing for power-on actions through the UI.The changes are largely based on changes made by alexanv1@571780f with some additional fixes as mentioned in the discussion of the issue at #40450
Type of change
Additional information
Checklist
black --fast homeassistant tests)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest.requirements_all.txt.Updated by running
python3 -m script.gen_requirements_all..coveragerc.The integration reached or maintains the following [Integration Quality Scale][quality-scale]: