Remove None value before writing known_devices (#4098)

* Remove None

* Replace null
This commit is contained in:
Johann Kellerman authored and Paulus Schoutsen committed 2016-11-01 21:51:31 -07:00
1 parent 52eb816c62
commit e487a09190
3 files changed
+24 -12

No files matched your search

@@ -12,7 +12,6 @@ import threading
from typing import Any, Sequence, Callable
import voluptuous as vol
import yaml
from homeassistant.bootstrap import (
prepare_setup_platform, log_exception)
@@ -27,6 +26,7 @@ import homeassistant.helpers.config_validation as cv
import homeassistant.util as util
from homeassistant.util.async import run_coroutine_threadsafe
import homeassistant.util.dt as dt_util
from homeassistant.util.yaml import dump
from homeassistant.helpers.event import track_utc_time_change
from homeassistant.const import (
@@ -464,8 +464,6 @@ def setup_scanner_platform(hass: HomeAssistantType, config: ConfigType,
def update_config(path: str, dev_id: str, device: Device):
"""Add device to YAML configuration file."""
with open(path, 'a') as out:
out.write('\n')
device = {device.dev_id: {
'name': device.name,
'mac': device.mac,
@@ -473,7 +471,8 @@ def update_config(path: str, dev_id: str, device: Device):
'track': device.track,
CONF_AWAY_HIDE: device.away_hide
}}
yaml.dump(device, out, default_flow_style=False)
out.write('\n')
out.write(dump(device))
def get_gravatar_for_email(email: str):