From d67546ca6d0a8f9787ceeb715137db9dccb3bdad Mon Sep 17 00:00:00 2001 From: functionpointer Date: Wed, 27 Jan 2021 22:11:05 +0100 Subject: [PATCH] MySensors: Fix incorrect function calls --- homeassistant/components/mysensors/climate.py | 2 +- homeassistant/components/mysensors/device.py | 2 ++ homeassistant/components/mysensors/device_tracker.py | 1 - homeassistant/components/mysensors/handler.py | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/mysensors/climate.py b/homeassistant/components/mysensors/climate.py index d8cbc404767..7320680237a 100644 --- a/homeassistant/components/mysensors/climate.py +++ b/homeassistant/components/mysensors/climate.py @@ -181,7 +181,7 @@ class MySensorsHVAC(mysensors.device.MySensorsEntity, ClimateEntity): self.gateway.set_child_value( self.node_id, self.child_id, value_type, value, ack=1 ) - if self.om: + if self.assumed_state: # Optimistically assume that device has changed state self._values[value_type] = value self.async_write_ha_state() diff --git a/homeassistant/components/mysensors/device.py b/homeassistant/components/mysensors/device.py index 516953d85c7..13f0787ca64 100644 --- a/homeassistant/components/mysensors/device.py +++ b/homeassistant/components/mysensors/device.py @@ -138,7 +138,9 @@ class MySensorsDevice: ATTR_DESCRIPTION: child.description, ATTR_NODE_ID: self.node_id, } + # This works when we are actually an Entity (i.e. all platforms except device_tracker) if hasattr(self, "platform"): + # pylint: disable=no-member attr[ATTR_DEVICE] = self.platform.config_entry.data[CONF_DEVICE] set_req = self.gateway.const.SetReq diff --git a/homeassistant/components/mysensors/device_tracker.py b/homeassistant/components/mysensors/device_tracker.py index a990b08ed73..b395a48f28b 100644 --- a/homeassistant/components/mysensors/device_tracker.py +++ b/homeassistant/components/mysensors/device_tracker.py @@ -14,7 +14,6 @@ async def async_setup_scanner( """Set up the MySensors device scanner.""" new_devices = mysensors.setup_mysensors_platform( hass, - discovery_info[ATTR_GATEWAY_ID], DOMAIN, discovery_info, MySensorsDeviceScanner, diff --git a/homeassistant/components/mysensors/handler.py b/homeassistant/components/mysensors/handler.py index 1e21cdeaf02..197bff564da 100644 --- a/homeassistant/components/mysensors/handler.py +++ b/homeassistant/components/mysensors/handler.py @@ -36,7 +36,7 @@ async def handle_internal(hass, hass_config: ConfigEntry, msg: Message) -> None: @HANDLERS.register("I_BATTERY_LEVEL") async def handle_battery_level(hass, hass_config: ConfigEntry, msg: Message) -> None: """Handle an internal battery level message.""" - _handle_node_update(hass, msg) + _handle_node_update(hass, hass_config, msg) @HANDLERS.register("I_HEARTBEAT_RESPONSE")