Skip to content

add support for Kodi discovery#13790

Merged
balloob merged 5 commits intohome-assistant:devfrom
escoand:add-kodi-discovery
Apr 14, 2018
Merged

add support for Kodi discovery#13790
balloob merged 5 commits intohome-assistant:devfrom
escoand:add-kodi-discovery

Conversation

@escoand
Copy link
Copy Markdown
Contributor

@escoand escoand commented Apr 9, 2018

Description:

Add support for discovering of Kodi media players.

Pull request in home-assistant.github.io with documentation (if applicable): home-assistant/home-assistant.io#5144

Checklist:

  • The code change is tested and works locally.
  • Local tests pass with tox. Your PR cannot be merged unless tests pass

If user exposed functionality or configuration variables are added/changed:

async_add_devices([entity], update_before_add=True)
hass.data[DATA_KODI] = dict()

# Is this a manual configuration?
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just check based on if discovery_info is None or not.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This "workflow" was copied from media_player/samsungtv. First I would do it like you say but then thought there is maybe a reason.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

samsungtv is wrong.

# Only add a device once, so discovered devices do not override manual
# config.
ip_addr = socket.gethostbyname(host)
if ip_addr not in hass.data[DATA_KODI]:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just return.

if ip_addr in hass.data[DATA_KODI]:
    return

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh OK, now I can see your point. The return is missing for else. But why shouldn't there be a log message?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The log message should be removed or at least be downgraded to debug. It is already logging that the entity is added.

@balloob
Copy link
Copy Markdown
Member

balloob commented Apr 10, 2018

You should only register the services the first time the platform is set up.

@balloob
Copy link
Copy Markdown
Member

balloob commented Apr 14, 2018

Awesome, thanks 👍

@balloob balloob merged commit 5a5dad6 into home-assistant:dev Apr 14, 2018
@escoand escoand deleted the add-kodi-discovery branch April 14, 2018 13:18
pvizeli added a commit that referenced this pull request Apr 15, 2018
pvizeli added a commit that referenced this pull request Apr 15, 2018
* Revert "Add unique_id for BMW ConnectedDrive (#13888)"

This reverts commit 9014e26.

* Revert "Added snips service descriptions (#13883)"

This reverts commit 1c4da0c.

* Revert "Fix race condition for component loaded before listening (#13887)"

This reverts commit bba997e.

* Revert "Missing property decorator added (#13889)"

This reverts commit bf98b79.

* Revert "Update frontend to 20180414.0"

This reverts commit 1617fbe.

* Revert "Further untangle data entry flow (#13855)"

This reverts commit 4d44c0f.

* Revert "add support for Kodi discovery (#13790)"

This reverts commit 5a5dad6.

* Revert "Update yweather.py (#13851)"

This reverts commit c3388d6.
@balloob balloob mentioned this pull request Apr 27, 2018
@home-assistant home-assistant locked and limited conversation to collaborators Jul 26, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants