How to use the denonavr.DenonAVR function in denonavr

To help you get started, we’ve selected a few denonavr examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github scarface-4711 / denonavr / tests / test_denonavr.py View on Github external
def test_input_func_switch(self, mock):
        """Switch through all input functions of all tested receivers."""
        mock.add_matcher(self.custom_matcher)
        for receiver, zones in TESTING_RECEIVERS.items():
            # Switch receiver and update to load new sample files
            self._testing_receiver = receiver
            self.denon = denonavr.DenonAVR(FAKE_IP, add_zones=zones)
            # Switch through all functions and check if successful
            for zone in self.denon.zones.values():
                for input_func in zone.input_func_list:
                    self.denon.set_input_func(input_func)
                    self.assertEqual(
                        input_func, self.denon.input_func,
                        ("Input function change to {func} "
                         "not successful").format(func=input_func))
github home-assistant / home-assistant / homeassistant / components / denonavr / media_player.py View on Github external
new_hosts.append(NewHost(host=host, name=name))

    # 3. option: discovery using denonavr library
    if config.get(CONF_HOST) is None and discovery_info is None:
        d_receivers = denonavr.discover()
        # More than one receiver could be discovered by that method
        for d_receiver in d_receivers:
            host = d_receiver["host"]
            name = d_receiver["friendlyName"]
            new_hosts.append(NewHost(host=host, name=name))

    for entry in new_hosts:
        # Check if host not in cache, append it and save for later
        # starting
        if entry.host not in cache:
            new_device = denonavr.DenonAVR(
                host=entry.host,
                name=entry.name,
                show_all_inputs=show_all_sources,
                timeout=timeout,
                add_zones=add_zones,
            )
            for new_zone in new_device.zones.values():
                receivers.append(DenonDevice(new_zone))
            cache.add(host)
            _LOGGER.info("Denon receiver at host %s initialized", host)

    # Add all freshly discovered receivers
    if receivers:
        add_entities(receivers)

denonavr

Automation Library for Denon AVR receivers

MIT
Latest version published 27 days ago

Package Health Score

72 / 100
Full package analysis

Similar packages