From b969fea900f16c6a3e8ab0f951a8f0240d207cea Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Sun, 19 Feb 2017 22:25:03 -0800 Subject: [PATCH] Z-Wave config panel fix (#6113) --- homeassistant/components/config/zwave.py | 4 ++-- homeassistant/util/yaml.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/homeassistant/components/config/zwave.py b/homeassistant/components/config/zwave.py index c01f22f0207..1f52e4f5e9a 100644 --- a/homeassistant/components/config/zwave.py +++ b/homeassistant/components/config/zwave.py @@ -74,5 +74,5 @@ def _read(path): def _write(path, data): """Write YAML helper.""" - with open(path, 'w') as outfile: - dump(data, outfile) + with open(path, 'w', encoding='utf-8') as outfile: + outfile.write(dump(data)) diff --git a/homeassistant/util/yaml.py b/homeassistant/util/yaml.py index 8100c6e5f68..15366f1b670 100644 --- a/homeassistant/util/yaml.py +++ b/homeassistant/util/yaml.py @@ -69,9 +69,9 @@ def load_yaml(fname: str) -> Union[List, Dict]: raise HomeAssistantError(exc) -def dump(_dict: dict, outfile=None) -> str: +def dump(_dict: dict) -> str: """Dump yaml to a string and remove null.""" - return yaml.safe_dump(_dict, outfile, default_flow_style=False) \ + return yaml.safe_dump(_dict, default_flow_style=False) \ .replace(': null\n', ':\n')