Skip to content

Commit 64c5006

Browse files
marq24marq24
authored and
marq24
committed
remove country from hacs.json
def state -> def native_value
1 parent f73018e commit 64c5006

File tree

5 files changed

+20
-16
lines changed

5 files changed

+20
-16
lines changed

custom_components/tibber_local/manifest.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@
1010
"iot_class": "local_polling",
1111
"issue_tracker": "https://github.com/marq24/ha-tibber-pulse-local/issues",
1212
"requirements": ["smllib==1.4"],
13-
"version": "2024.8.0"
13+
"version": "2024.9.0"
1414
}

custom_components/tibber_local/sensor.py

+16-12
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
from homeassistant.components.sensor import SensorEntity, SensorEntityDescription
44
from homeassistant.config_entries import ConfigEntry
55
from homeassistant.core import HomeAssistant
6+
from homeassistant.helpers.typing import StateType
67
from homeassistant.util import slugify
7-
88
from . import TibberLocalDataUpdateCoordinator, TibberLocalEntity
99
from .const import (
1010
DOMAIN,
@@ -77,14 +77,18 @@ def __init__(
7777
self._attr_suggested_display_precision = 2
7878

7979
@property
80-
def state(self):
81-
"""Return the current state."""
82-
value = getattr(self.coordinator.bridge, 'attr' + self.entity_description.key)
83-
if type(value) != type(False):
84-
try:
85-
rounded_value = round(float(value), self._attr_suggested_display_precision)
86-
return rounded_value
87-
except (ValueError, TypeError):
88-
return value
89-
else:
90-
return value
80+
def native_value(self) -> StateType:
81+
return getattr(self.coordinator.bridge, 'attr' + self.entity_description.key)
82+
83+
# @property
84+
# def state(self):
85+
# """Return the current state."""
86+
# value = getattr(self.coordinator.bridge, 'attr' + self.entity_description.key)
87+
# if type(value) != type(False):
88+
# try:
89+
# rounded_value = round(float(value), self._attr_suggested_display_precision)
90+
# return rounded_value
91+
# except (ValueError, TypeError):
92+
# return value
93+
# else:
94+
# return value

hacs.json

-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
{
22
"name": "Tibber Pulse Local",
3-
"country": [
4-
"ALL"
5-
],
63
"homeassistant": "2023.0.6",
74
"hacs": "1.18.0",
85
"render_readme": true

requirements.txt

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
homeassistant>=2024.8.2
2+
smllib>=1.4

requirements_dev.txt

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pytest-homeassistant-custom-component>=0.13.154

0 commit comments

Comments
 (0)