mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 13:17:32 +00:00
Fix Neurio Sensor by making the sensor ID required (#42728)
This commit is contained in:
parent
30b94892c4
commit
354058f020
@ -33,7 +33,7 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
|
|||||||
{
|
{
|
||||||
vol.Required(CONF_API_KEY): cv.string,
|
vol.Required(CONF_API_KEY): cv.string,
|
||||||
vol.Required(CONF_API_SECRET): cv.string,
|
vol.Required(CONF_API_SECRET): cv.string,
|
||||||
vol.Optional(CONF_SENSOR_ID): cv.string,
|
vol.Required(CONF_SENSOR_ID): cv.string,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -82,14 +82,6 @@ class NeurioData:
|
|||||||
neurio_tp = neurio.TokenProvider(key=api_key, secret=api_secret)
|
neurio_tp = neurio.TokenProvider(key=api_key, secret=api_secret)
|
||||||
self.neurio_client = neurio.Client(token_provider=neurio_tp)
|
self.neurio_client = neurio.Client(token_provider=neurio_tp)
|
||||||
|
|
||||||
if not self.sensor_id:
|
|
||||||
user_info = self.neurio_client.get_user_information()
|
|
||||||
_LOGGER.warning(
|
|
||||||
"Sensor ID auto-detected: %s",
|
|
||||||
user_info["locations"][0]["sensors"][0]["sensorId"],
|
|
||||||
)
|
|
||||||
self.sensor_id = user_info["locations"][0]["sensors"][0]["sensorId"]
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def daily_usage(self):
|
def daily_usage(self):
|
||||||
"""Return latest daily usage value."""
|
"""Return latest daily usage value."""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user