Skip to content

Commit

Permalink
chore: switch to extra_state_attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
vanstinator committed Jan 22, 2022
1 parent 2a5818e commit c247570
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
7 changes: 3 additions & 4 deletions custom_components/raincloud/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ def setup(hass, config):
)
return False


def handle_rain_delay(call):
"""Set the rain delay for all valves"""

Expand All @@ -133,7 +132,7 @@ def handle_rain_delay(call):
dispatcher_send(hass, SIGNAL_UPDATE_RAINCLOUD)

return True

hass.services.register(DOMAIN, RAIN_DELAY_SERVICE_ATTR, handle_rain_delay)

def hub_refresh(event_time):
Expand Down Expand Up @@ -205,11 +204,11 @@ def unit_of_measurement(self):
return UNIT_OF_MEASUREMENT_MAP.get(self._sensor_type)

@property
def device_state_attributes(self):
def extra_state_attributes(self):
"""Return the state attributes."""
return {ATTR_ATTRIBUTION: ATTRIBUTION, "identifier": self.data.serial}

@property
def icon(self):
"""Return the icon to use in the frontend, if any."""
return ICON_MAP.get(self._sensor_type)
return ICON_MAP.get(self._sensor_type)
2 changes: 1 addition & 1 deletion custom_components/raincloud/manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"domain": "raincloud",
"name": "Melnor RainCloud",
"version": "1.2.3",
"version": "1.2.4",
"documentation": "https://github.com/vanstinator/hass-raincloud/blob/master/README.md",
"requirements": ["raincloudy==1.1.1"],
"codeowners": ["@vanstinator"],
Expand Down
7 changes: 4 additions & 3 deletions custom_components/raincloud/switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
for controller in raincloud.controllers:
for faucet in controller.faucets:
for zone in faucet.zones:
sensors.append(RainCloudSwitch(default_watering_timer, zone, sensor_type))
sensors.append(RainCloudSwitch(
default_watering_timer, zone, sensor_type))

add_entities(sensors, True)

Expand Down Expand Up @@ -85,10 +86,10 @@ def update(self):
self._state = self.data.auto_watering

@property
def device_state_attributes(self):
def extra_state_attributes(self):
"""Return the state attributes."""
return {
ATTR_ATTRIBUTION: ATTRIBUTION,
"default_manual_timer": self._default_watering_timer,
"identifier": self.data.serial,
}
}
2 changes: 1 addition & 1 deletion hacs.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "Melnor Raincloud",
"render_readme": true,
"domains": ["binary_sensor", "sensor", "switch"],
"homeassistant": "0.115.0",
"homeassistant": "2021.4.0",
"zip_release": true,
"filename": "raincloud.zip",
"iot_class": "cloud_polling"
Expand Down

0 comments on commit c247570

Please sign in to comment.