Fix incorrect Rainmachine dict lookups (#30550)

This commit is contained in:
Aaron Bach 2020-01-07 10:43:12 -07:00 committed by GitHub
parent 9aa02e35a7
commit 856db4d122
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 6 deletions

View File

@ -96,7 +96,9 @@ class RainMachineBinarySensor(RainMachineEntity, BinarySensorDevice):
async def async_update(self): async def async_update(self):
"""Update the state.""" """Update the state."""
if self._sensor_type == TYPE_FLOW_SENSOR: if self._sensor_type == TYPE_FLOW_SENSOR:
self._state = self.rainmachine.data[PROVISION_SETTINGS].get("useFlowSensor") self._state = self.rainmachine.data[PROVISION_SETTINGS]["system"].get(
"useFlowSensor"
)
elif self._sensor_type == TYPE_FREEZE: elif self._sensor_type == TYPE_FREEZE:
self._state = self.rainmachine.data[RESTRICTIONS_CURRENT]["freeze"] self._state = self.rainmachine.data[RESTRICTIONS_CURRENT]["freeze"]
elif self._sensor_type == TYPE_FREEZE_PROTECTION: elif self._sensor_type == TYPE_FREEZE_PROTECTION:

View File

@ -97,14 +97,14 @@ class RainMachineSensor(RainMachineEntity):
async def async_update(self): async def async_update(self):
"""Update the sensor's state.""" """Update the sensor's state."""
if self._sensor_type == TYPE_FLOW_SENSOR_CLICK_M3: if self._sensor_type == TYPE_FLOW_SENSOR_CLICK_M3:
self._state = self.rainmachine.data[PROVISION_SETTINGS].get( self._state = self.rainmachine.data[PROVISION_SETTINGS]["system"].get(
"flowSensorClicksPerCubicMeter" "flowSensorClicksPerCubicMeter"
) )
elif self._sensor_type == TYPE_FLOW_SENSOR_CONSUMED_LITERS: elif self._sensor_type == TYPE_FLOW_SENSOR_CONSUMED_LITERS:
clicks = self.rainmachine.data[PROVISION_SETTINGS].get( clicks = self.rainmachine.data[PROVISION_SETTINGS]["system"].get(
"flowSensorWateringClicks" "flowSensorWateringClicks"
) )
clicks_per_m3 = self.rainmachine.data[PROVISION_SETTINGS].get( clicks_per_m3 = self.rainmachine.data[PROVISION_SETTINGS]["system"].get(
"flowSensorClicksPerCubicMeter" "flowSensorClicksPerCubicMeter"
) )
@ -113,11 +113,11 @@ class RainMachineSensor(RainMachineEntity):
else: else:
self._state = None self._state = None
elif self._sensor_type == TYPE_FLOW_SENSOR_START_INDEX: elif self._sensor_type == TYPE_FLOW_SENSOR_START_INDEX:
self._state = self.rainmachine.data[PROVISION_SETTINGS].get( self._state = self.rainmachine.data[PROVISION_SETTINGS]["system"].get(
"flowSensorStartIndex" "flowSensorStartIndex"
) )
elif self._sensor_type == TYPE_FLOW_SENSOR_WATERING_CLICKS: elif self._sensor_type == TYPE_FLOW_SENSOR_WATERING_CLICKS:
self._state = self.rainmachine.data[PROVISION_SETTINGS].get( self._state = self.rainmachine.data[PROVISION_SETTINGS]["system"].get(
"flowSensorWateringClicks" "flowSensorWateringClicks"
) )
elif self._sensor_type == TYPE_FREEZE_TEMP: elif self._sensor_type == TYPE_FREEZE_TEMP: