Compare commits

...

2 Commits

Author SHA1 Message Date
2cc74193e7
fix monitors yaml parsing 2023-12-29 11:07:03 +01:00
536feac30a
implement reload service 2023-12-29 11:06:48 +01:00
2 changed files with 8 additions and 5 deletions

View File

@ -67,3 +67,10 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
)
return True
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"""Unload a config entry."""
return await hass.config_entries.async_forward_entry_unload(
entry, "switch"
)

View File

@ -2,7 +2,6 @@ import logging
import re
import fabric2
import yaml
from fabric2 import Connection
_LOGGER = logging.getLogger(__name__)
@ -213,10 +212,7 @@ def change_monitors_config(connection: Connection, monitors_config: dict):
if is_unix_system(connection):
command_parts = ["gnome-monitor-config", "set"]
# Convert str to dict (yaml)
monitors_config = yaml.safe_load(monitors_config)
for monitor, settings in monitors_config.get('monitors', {}).items():
for monitor, settings in monitors_config.items():
if settings.get('enabled', False):
if 'primary' in settings and settings['primary']:
command_parts.append(f'-LpM {monitor}')