예제 #1
0
파일: server.py 프로젝트: jbouwh/core
        def get_roon_host():
            host = self.config_entry.data.get(CONF_HOST)
            port = self.config_entry.data.get(CONF_PORT)
            if host:
                _LOGGER.debug("static roon core host=%s port=%s", host, port)
                return (host, port)

            discover = RoonDiscovery(core_id)
            server = discover.first()
            discover.stop()
            _LOGGER.debug("dynamic roon core core_id=%s server=%s", core_id, server)
            return (server[0], server[1])
예제 #2
0
    async def discover(self):
        """Try and discover roon servers."""
        def get_discovered_servers(discovery):
            servers = discovery.all()
            discovery.stop()
            return servers

        discovery = RoonDiscovery(None)
        servers = await self._hass.async_add_executor_job(
            get_discovered_servers, discovery)
        _LOGGER.debug("Servers = %s", servers)
        return servers
예제 #3
0
파일: groups.py 프로젝트: pavoni/pyroon
appinfo = {
    "extension_id": "python_roon_test",
    "display_name": "Python library for Roon",
    "display_version": "1.0.0",
    "publisher": "gregd",
    "email": "*****@*****.**",
}

try:
    core_id = open("my_core_id_file").read()
    token = open("my_token_file").read()
except OSError:
    print("Please authorise first using discovery.py")
    exit()

discover = RoonDiscovery(core_id)
server = discover.first()
discover.stop()
roonapi = RoonApi(appinfo, token, server[0], server[1], True)


# get all zones (as dict)
zones = roonapi.zones
outputs = roonapi.outputs

for (k, v) in outputs.items():
    zone_id = v["zone_id"]
    output_id = k
    display_name = v["display_name"]
    is_group_main = roonapi.is_group_main(output_id)
    is_grouped = roonapi.is_grouped(output_id)
예제 #4
0
import time

from roonapi import RoonApi, RoonDiscovery

appinfo = {
    "extension_id": "python_roon_test",
    "display_name": "Python library for Roon",
    "display_version": "1.0.0",
    "publisher": "gregd",
    "email": "*****@*****.**",
}

discover = RoonDiscovery(None)
servers = discover.all()
apis = [
    RoonApi(appinfo, None, server[0], server[1], False) for server in servers
]

auth_api = []
while len(auth_api) == 0:
    print(
        "\nWaiting for authorization - in Roon, click \033[1mSettings -> Extensions -> Enable\033[0m\n",
        flush=True)
    time.sleep(15)
    auth_api = [api for api in apis if api.token is not None]

api = auth_api[0]

print("RoonCoreIP =", api.host)