Skip to content

Commit

Permalink
Housekeeping, implement upstream changes
Browse files Browse the repository at this point in the history
  • Loading branch information
golles committed Jun 3, 2022
1 parent fa97799 commit d2c0fbf
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
4 changes: 2 additions & 2 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// See https://aka.ms/vscode-remote/devcontainer.json for format details.
{
"image": "ludeeus/container:integration-debian",
"image": "ghcr.io/ludeeus/devcontainer/integration:stable",
"name": "HA KNMI development",
"context": "..",
"appPort": [
Expand All @@ -16,7 +16,7 @@
"settings": {
"files.eol": "\n",
"editor.tabSize": 4,
"terminal.integrated.defaultProfile.linux": "bash",
"terminal.integrated.shell.linux": "/bin/bash",
"python.pythonPath": "/usr/bin/python3",
"python.analysis.autoSearchPaths": false,
"python.linting.pylintEnabled": true,
Expand Down
2 changes: 1 addition & 1 deletion custom_components/knmi/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
hass.config_entries.async_forward_entry_setup(entry, platform)
)

entry.add_update_listener(async_reload_entry)
entry.async_on_unload(entry.add_update_listener(async_reload_entry))
return True


Expand Down
10 changes: 6 additions & 4 deletions custom_components/knmi/sensor.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
"""Sensor platform for knmi."""
from homeassistant.components.sensor import SensorEntity
from homeassistant.const import CONF_NAME

from .const import DEFAULT_NAME, DOMAIN, SENSORS
from .entity import KnmiEntity

Expand All @@ -26,7 +28,7 @@ async def async_setup_entry(hass, entry, async_add_devices):
async_add_devices(sensors)


class KnmiSensor(KnmiEntity):
class KnmiSensor(KnmiEntity, SensorEntity):
"""Knmi Sensor class."""

def __init__(
Expand Down Expand Up @@ -55,12 +57,12 @@ def name(self):
return f"{DEFAULT_NAME} {self.entry_name} {self._name}"

@property
def state(self):
"""Return the state of the sensor."""
def native_value(self):
"""Return the native_value of the sensor."""
return super().getData(self._data_key)

@property
def unit_of_measurement(self):
def native_unit_of_measurement(self):
"""Return the unit of measurement of this entity, if any."""
return self._unit_of_measurement

Expand Down

0 comments on commit d2c0fbf

Please sign in to comment.