Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tweak geniushub and bump client to v0.6.26 #26640

Merged
merged 55 commits into from Oct 2, 2019
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
dadbeba
use state attribute rather than type
zxdavb Sep 12, 2019
3e41c71
HA style tweaks
zxdavb Sep 13, 2019
5b39ee3
small tweak
zxdavb Sep 13, 2019
d45e16e
bump client
zxdavb Sep 14, 2019
2dcfe12
Merge remote-tracking branch 'upstream/dev' into geniushub_tweak
zxdavb Sep 14, 2019
0c42f24
add more device_state_attributes
zxdavb Sep 16, 2019
ff5cf36
bump client
zxdavb Sep 17, 2019
0979c9c
small tweak
zxdavb Sep 18, 2019
2451080
bump client for concurrent IO
zxdavb Sep 19, 2019
84f51e1
force snake_case, and refactor (consolidate) Devices/Zones
zxdavb Sep 19, 2019
7c61e51
force snake_case, and refactor (consolidate) Devices/Zones 2
zxdavb Sep 19, 2019
96bc9ea
force snake_case, and refactor (consolidate) Devices/Zones 3
zxdavb Sep 19, 2019
e09d086
Merge remote-tracking branch 'upstream/dev' into geniushub_tweak
zxdavb Sep 19, 2019
743527a
refactor last_comms / wakeup_interval check
zxdavb Sep 19, 2019
84fba7d
movement sensor is dynamic, and tweaking
zxdavb Sep 20, 2019
f59d004
tweak
zxdavb Sep 20, 2019
caf6781
bump client to v0.6.20
zxdavb Sep 20, 2019
2f3a943
dummy
zxdavb Sep 20, 2019
549324e
dummy 2
zxdavb Sep 20, 2019
70f2d94
Merge remote-tracking branch 'upstream/dev' into geniushub_tweak
zxdavb Sep 20, 2019
212ebdb
bump client to handle another edge case
zxdavb Sep 20, 2019
72fc3a4
Merge remote-tracking branch 'upstream/dev' into geniushub_tweak
zxdavb Sep 21, 2019
ac700d4
use entity_id fro zones
zxdavb Sep 21, 2019
71572d6
small tweak
zxdavb Sep 21, 2019
a2ec709
bump client to 0.6.22
zxdavb Sep 21, 2019
c2f09a2
add recursive snake_case converter
zxdavb Sep 23, 2019
92dc3fe
fix regression
zxdavb Sep 23, 2019
95146b7
fix regression 2
zxdavb Sep 23, 2019
7c4d086
fix regression 3
zxdavb Sep 23, 2019
4423d5e
remove Awaitables
zxdavb Sep 23, 2019
e31653c
don't dynamically create function every scan_interval
zxdavb Sep 26, 2019
151491e
log kast_comms as localtime, delint dt_util
zxdavb Sep 26, 2019
67e50c0
add sensors fro v1 API
zxdavb Sep 26, 2019
8ed69c3
tweak entity_id
zxdavb Sep 28, 2019
ce18192
bump client
zxdavb Sep 29, 2019
cca2c8d
bump client to v0.6.24
zxdavb Sep 29, 2019
c2d9283
bump client to v0.6.25
zxdavb Sep 29, 2019
37f1f96
explicit device attrs, dt as UTC
zxdavb Oct 1, 2019
c4535df
Merge remote-tracking branch 'upstream/dev' into geniushub_tweak
zxdavb Oct 1, 2019
1d4a9c8
add unique_id, remove entity_id
zxdavb Oct 1, 2019
92532ee
Bump client to 0.6.26 - add Hub UID
zxdavb Oct 1, 2019
7527db1
remove convert_dict()
zxdavb Oct 1, 2019
d748ef3
add mac_address (uid) for v1 API
zxdavb Oct 2, 2019
5383f36
tweak var names
zxdavb Oct 2, 2019
13fcf7c
add UID.upper() to avoid unwanted unique_id changes
zxdavb Oct 2, 2019
10361b2
Update homeassistant/components/geniushub/__init__.py
zxdavb Oct 2, 2019
37b3396
Update homeassistant/components/geniushub/__init__.py
zxdavb Oct 2, 2019
e03814e
remove underscores
zxdavb Oct 2, 2019
1ba2479
Merge branch 'geniushub_tweak' of github.com:zxdavb/home-assistant in…
zxdavb Oct 2, 2019
82b2b3a
refactor for broker
zxdavb Oct 2, 2019
79f23d0
ready now
zxdavb Oct 2, 2019
9bdb7e2
validate UID (MAC address)
zxdavb Oct 2, 2019
a699ee4
move uid to broker
zxdavb Oct 2, 2019
9ada043
use existing constant
zxdavb Oct 2, 2019
67affb1
pass client to broker
zxdavb Oct 2, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion homeassistant/components/geniushub/__init__.py
Expand Up @@ -88,7 +88,7 @@ async def async_update(self, now, **kwargs):
try:
await self.client.update()
except aiohttp.ClientResponseError as err:
_LOGGER.warning("Update failed, %s", err)
_LOGGER.warning("Update failed, message is: %s", err)
return
self.make_debug_log_entries()

Expand Down
19 changes: 13 additions & 6 deletions homeassistant/components/geniushub/binary_sensor.py
Expand Up @@ -6,15 +6,18 @@

from . import DOMAIN, GeniusEntity

GH_IS_SWITCH = ["Dual Channel Receiver", "Electric Switch", "Smart Plug"]


async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
"""Set up the Genius Hub sensor entities."""
if discovery_info is None:
return

client = hass.data[DOMAIN]["client"]

switches = [
GeniusBinarySensor(d) for d in client.device_objs if d.type[:21] in GH_IS_SWITCH
GeniusBinarySensor(d)
for d in client.device_objs
if "outputOnOff" in d.data["state"]
]

async_add_entities(switches)
Expand Down Expand Up @@ -44,9 +47,13 @@ def device_state_attributes(self) -> Dict[str, Any]:
attrs = {}
attrs["assigned_zone"] = self._device.data["assignedZones"][0]["name"]

# pylint: disable=protected-access
last_comms = self._device._raw["childValues"]["lastComms"]["val"]
attrs["state"] = dict(self._device.data["state"])
zxdavb marked this conversation as resolved.
Show resolved Hide resolved
attrs["state"].update(self._device.data["_state"])
attrs["state"].pop("outputOnOff")
attrs["state"].pop("lastComms")

last_comms = self._device.data["_state"]["lastComms"]
if last_comms != 0:
attrs["last_comms"] = utc_from_timestamp(last_comms).isoformat()

return {**attrs}
return attrs
7 changes: 4 additions & 3 deletions homeassistant/components/geniushub/climate.py
Expand Up @@ -29,10 +29,11 @@
GH_PRESET_TO_HA = {v: k for k, v in HA_PRESET_TO_GH.items()}


async def async_setup_platform(
hass, hass_config, async_add_entities, discovery_info=None
):
async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
"""Set up the Genius Hub climate entities."""
if discovery_info is None:
return

client = hass.data[DOMAIN]["client"]

entities = [
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/geniushub/manifest.json
Expand Up @@ -3,7 +3,7 @@
"name": "Genius Hub",
"documentation": "https://www.home-assistant.io/components/geniushub",
"requirements": [
"geniushub-client==0.6.13"
"geniushub-client==0.6.16"
],
"dependencies": [],
"codeowners": ["@zxdavb"]
Expand Down
21 changes: 15 additions & 6 deletions homeassistant/components/geniushub/sensor.py
Expand Up @@ -7,8 +7,6 @@

from . import DOMAIN, GeniusEntity

GH_HAS_BATTERY = ["Room Thermostat", "Genius Valve", "Room Sensor", "Radiator Valve"]

GH_LEVEL_MAPPING = {
"error": "Errors",
"warning": "Warnings",
Expand All @@ -18,9 +16,16 @@

async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
"""Set up the Genius Hub sensor entities."""
if discovery_info is None:
return

client = hass.data[DOMAIN]["client"]

sensors = [GeniusBattery(d) for d in client.device_objs if d.type in GH_HAS_BATTERY]
sensors = [
GeniusBattery(d)
for d in client.device_objs
if "batteryLevel" in d.data["state"]
]
issues = [GeniusIssue(client, i) for i in list(GH_LEVEL_MAPPING)]

async_add_entities(sensors + issues, update_before_add=True)
Expand Down Expand Up @@ -85,11 +90,15 @@ def device_state_attributes(self) -> Dict[str, Any]:
attrs = {}
attrs["assigned_zone"] = self._device.data["assignedZones"][0]["name"]

# pylint: disable=protected-access
last_comms = self._device._raw["childValues"]["lastComms"]["val"]
attrs["state"] = dict(self._device.data["state"])
attrs["state"].update(self._device.data["_state"])
attrs["state"].pop("batteryLevel")
attrs["state"].pop("lastComms")

last_comms = self._device.data["_state"]["lastComms"]
attrs["last_comms"] = utc_from_timestamp(last_comms).isoformat()

return {**attrs}
return attrs


class GeniusIssue(GeniusEntity):
Expand Down
14 changes: 6 additions & 8 deletions homeassistant/components/geniushub/water_heater.py
Expand Up @@ -37,10 +37,11 @@
GH_STATE_ATTRS = ["type", "override"]


async def async_setup_platform(
hass, hass_config, async_add_entities, discovery_info=None
):
async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
"""Set up the Genius Hub water_heater entities."""
if discovery_info is None:
return

client = hass.data[DOMAIN]["client"]

entities = [
Expand Down Expand Up @@ -68,11 +69,8 @@ def name(self) -> str:
@property
def device_state_attributes(self) -> Dict[str, Any]:
"""Return the device state attributes."""
return {
"status": {
k: v for k, v in self._boiler.data.items() if k in GH_STATE_ATTRS
}
}
tmp = self._boiler.data.items()
return {"status": {k: v for k, v in tmp if k in GH_STATE_ATTRS}}

@property
def current_temperature(self) -> Optional[float]:
Expand Down
2 changes: 1 addition & 1 deletion requirements_all.txt
Expand Up @@ -527,7 +527,7 @@ gearbest_parser==1.0.7
geizhals==0.0.9

# homeassistant.components.geniushub
geniushub-client==0.6.13
geniushub-client==0.6.16

# homeassistant.components.geo_json_events
# homeassistant.components.nsw_rural_fire_service_feed
Expand Down