Tibber, accumulated reward (#53195)

Signed-off-by: Daniel Hjelseth Høyer <github@dahoiv.net>
This commit is contained in:
Daniel Hjelseth Høyer 2021-07-20 12:28:50 +02:00 committed by GitHub
parent 79a418f1bc
commit d17776af87
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 4 deletions

View File

@ -2,7 +2,7 @@
"domain": "tibber", "domain": "tibber",
"name": "Tibber", "name": "Tibber",
"documentation": "https://www.home-assistant.io/integrations/tibber", "documentation": "https://www.home-assistant.io/integrations/tibber",
"requirements": ["pyTibber==0.18.0"], "requirements": ["pyTibber==0.19.0"],
"codeowners": ["@danielhiversen"], "codeowners": ["@danielhiversen"],
"quality_scale": "silver", "quality_scale": "silver",
"config_flow": true, "config_flow": true,

View File

@ -129,6 +129,12 @@ RT_SENSOR_MAP = {
SIGNAL_STRENGTH_DECIBELS, SIGNAL_STRENGTH_DECIBELS,
STATE_CLASS_MEASUREMENT, STATE_CLASS_MEASUREMENT,
], ],
"accumulatedReward": [
"accumulated reward",
DEVICE_CLASS_MONETARY,
None,
STATE_CLASS_MEASUREMENT,
],
"accumulatedCost": [ "accumulatedCost": [
"accumulated cost", "accumulated cost",
DEVICE_CLASS_MONETARY, DEVICE_CLASS_MONETARY,
@ -330,6 +336,7 @@ class TibberSensorRT(TibberSensor):
"accumulated consumption", "accumulated consumption",
"accumulated production", "accumulated production",
"accumulated cost", "accumulated cost",
"accumulated reward",
]: ]:
self._attr_last_reset = dt_util.as_utc( self._attr_last_reset = dt_util.as_utc(
dt_util.now().replace(hour=0, minute=0, second=0, microsecond=0) dt_util.now().replace(hour=0, minute=0, second=0, microsecond=0)
@ -366,6 +373,7 @@ class TibberSensorRT(TibberSensor):
"accumulated consumption", "accumulated consumption",
"accumulated production", "accumulated production",
"accumulated cost", "accumulated cost",
"accumulated reward",
]: ]:
self._attr_last_reset = dt_util.as_utc( self._attr_last_reset = dt_util.as_utc(
timestamp.replace(hour=0, minute=0, second=0, microsecond=0) timestamp.replace(hour=0, minute=0, second=0, microsecond=0)
@ -422,7 +430,7 @@ class TibberRtDataHandler:
sensor_name, device_class, unit, state_class = RT_SENSOR_MAP[ sensor_name, device_class, unit, state_class = RT_SENSOR_MAP[
sensor_type sensor_type
] ]
if sensor_type == "accumulatedCost": if sensor_type in ["accumulatedCost", "accumulatedReward"]:
unit = self._tibber_home.currency unit = self._tibber_home.currency
entity = TibberSensorRT( entity = TibberSensorRT(
self._tibber_home, self._tibber_home,

View File

@ -1271,7 +1271,7 @@ pyRFXtrx==0.27.0
# pySwitchmate==0.4.6 # pySwitchmate==0.4.6
# homeassistant.components.tibber # homeassistant.components.tibber
pyTibber==0.18.0 pyTibber==0.19.0
# homeassistant.components.dlink # homeassistant.components.dlink
pyW215==0.7.0 pyW215==0.7.0

View File

@ -714,7 +714,7 @@ pyMetno==0.8.3
pyRFXtrx==0.27.0 pyRFXtrx==0.27.0
# homeassistant.components.tibber # homeassistant.components.tibber
pyTibber==0.18.0 pyTibber==0.19.0
# homeassistant.components.nextbus # homeassistant.components.nextbus
py_nextbusnext==0.1.4 py_nextbusnext==0.1.4