From 6395087a406c9d56af55b4029462f3eb309ff350 Mon Sep 17 00:00:00 2001 From: Jonathan Keljo Date: Fri, 11 Jan 2019 20:54:22 -0800 Subject: [PATCH] Upgrade greeneye_monitor to 1.0 (#19631) * Upgrade greeneye_monitor to 1.0 This is a breaking change; it causes the `serial_number` field in configuration to be treated as the full 8-digit serial number rather than the last 5 digits as was previously done, which results in the unique identifiers for the sensors being different. (Fixing them up in `config/.storage/core.entity_registry` before rebooting into the updated version seems to prevent any weirdness.) The last-5-digits behavior was a result of me misunderstanding the packet format docs and not realizing that the true serial number was split across two fields. In addition to being confusing (see https://community.home-assistant.io/t/brultech-greeneye-issues/86852), it was technically incorrect. The `greeneye_monitor` platform was just introduced in 0.82, so it seems like the kind of thing that's best to fix now while adoption is relatively low rather than later when somebody runs into it as more than just a point of confusion. * Switch to 8-character string * Coerce to int * Remove now-unnecessary cast --- homeassistant/components/greeneye_monitor.py | 12 ++++++++++-- requirements_all.txt | 2 +- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/greeneye_monitor.py b/homeassistant/components/greeneye_monitor.py index f5c51da88be..c1e2f285772 100644 --- a/homeassistant/components/greeneye_monitor.py +++ b/homeassistant/components/greeneye_monitor.py @@ -16,7 +16,7 @@ from homeassistant.const import ( import homeassistant.helpers.config_validation as cv from homeassistant.helpers.discovery import async_load_platform -REQUIREMENTS = ['greeneye_monitor==0.1'] +REQUIREMENTS = ['greeneye_monitor==1.0'] _LOGGER = logging.getLogger(__name__) @@ -81,7 +81,15 @@ CHANNEL_SCHEMA = vol.Schema({ CHANNELS_SCHEMA = vol.All(cv.ensure_list, [CHANNEL_SCHEMA]) MONITOR_SCHEMA = vol.Schema({ - vol.Required(CONF_SERIAL_NUMBER): cv.positive_int, + vol.Required(CONF_SERIAL_NUMBER): + vol.All( + cv.string, + vol.Length( + min=8, + max=8, + msg="GEM serial number must be specified as an 8-character " + "string (including leading zeroes)."), + vol.Coerce(int)), vol.Optional(CONF_CHANNELS, default=[]): CHANNELS_SCHEMA, vol.Optional( CONF_TEMPERATURE_SENSORS, diff --git a/requirements_all.txt b/requirements_all.txt index 51cbc19a7e4..947eca9876b 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -466,7 +466,7 @@ googlemaps==2.5.1 gps3==0.33.3 # homeassistant.components.greeneye_monitor -greeneye_monitor==0.1 +greeneye_monitor==1.0 # homeassistant.components.light.greenwave greenwavereality==0.5.1