diff --git a/custom_components/easy_computer_manager/__init__.py b/custom_components/easy_computer_manager/__init__.py index 4bbe5a9..1876e2d 100644 --- a/custom_components/easy_computer_manager/__init__.py +++ b/custom_components/easy_computer_manager/__init__.py @@ -16,7 +16,7 @@ from homeassistant.core import HomeAssistant, ServiceCall from .const import DOMAIN, SERVICE_SEND_MAGIC_PACKET, SERVICE_CHANGE_MONITORS_CONFIG -_LOGGER = logging.getLogger(__name__) +LOGGER = logging.getLogger(__name__) WAKE_ON_LAN_SEND_MAGIC_PACKET_SCHEMA = vol.Schema({ vol.Required(CONF_MAC): cv.string, @@ -40,7 +40,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: if broadcast_port is not None: service_kwargs["port"] = broadcast_port - _LOGGER.info( + LOGGER.info( "Sending magic packet to MAC %s (broadcast: %s, port: %s)", mac_address, broadcast_address, diff --git a/custom_components/easy_computer_manager/config_flow.py b/custom_components/easy_computer_manager/config_flow.py index 3821320..e35402b 100644 --- a/custom_components/easy_computer_manager/config_flow.py +++ b/custom_components/easy_computer_manager/config_flow.py @@ -7,7 +7,6 @@ from typing import Any import voluptuous as vol from homeassistant import config_entries, exceptions from homeassistant.core import HomeAssistant -from paramiko.ssh_exception import AuthenticationException from .computer import Computer from .const import DOMAIN @@ -54,7 +53,7 @@ class Hub: _LOGGER.info("Testing connection to %s", self._host) return True - except AuthenticationException: + except Exception: return False @@ -86,7 +85,7 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN): try: info = await validate_input(self.hass, user_input) return self.async_create_entry(title=info["title"], data=user_input) - except (AuthenticationException, CannotConnect, InvalidHost) as ex: + except (CannotConnect, InvalidHost) as ex: errors["base"] = str(ex) except Exception as ex: # pylint: disable=broad-except _LOGGER.exception("Unexpected exception: %s", ex) diff --git a/custom_components/easy_computer_manager/const.py b/custom_components/easy_computer_manager/const.py index cc7fe28..a5d00f0 100644 --- a/custom_components/easy_computer_manager/const.py +++ b/custom_components/easy_computer_manager/const.py @@ -43,5 +43,15 @@ ACTIONS = { }, "get_monitors_config": { "linux": ["gnome-monitor-config list"] + }, + "get_speakers": { + "linux": ["pactl list sinks"] + }, + "get_microphones": { + "linux": ["pactl list sources"] + }, + "get_bluetooth_devices": { + "exit": False, + "linux": ["bluetoothctl info"] } } \ No newline at end of file diff --git a/custom_components/easy_computer_manager/switch.py b/custom_components/easy_computer_manager/switch.py index 38bbc82..33b7afc 100644 --- a/custom_components/easy_computer_manager/switch.py +++ b/custom_components/easy_computer_manager/switch.py @@ -3,7 +3,6 @@ from __future__ import annotations import asyncio -import logging from typing import Any import voluptuous as vol @@ -31,8 +30,6 @@ from .const import SERVICE_RESTART_TO_WINDOWS_FROM_LINUX, SERVICE_PUT_COMPUTER_T SERVICE_START_COMPUTER_TO_WINDOWS, SERVICE_RESTART_COMPUTER, SERVICE_RESTART_TO_LINUX_FROM_WINDOWS, \ SERVICE_CHANGE_MONITORS_CONFIG, SERVICE_STEAM_BIG_PICTURE, SERVICE_CHANGE_AUDIO_CONFIG, SERVICE_DEBUG_INFO, DOMAIN -_LOGGER = logging.getLogger(__name__) - async def async_setup_entry( hass: HomeAssistant, @@ -225,6 +222,6 @@ class ComputerSwitch(SwitchEntity): "operating_system_version": self.computer.get_operating_system_version(), "mac_address": self.computer.mac, "ip_address": self.computer.host, - "connected_devices": self.computer.get_bluetooth_devices(as_str=True), + "connected_devices": self.computer.get_bluetooth_devices(return_as_string=True), }