"last_update": self._lastupdate,
})
-# @property
-# def unit_of_measurement(self):
-# """Return the unit of measurement."""
-# return TEMP_CELSIUS
-
class MercedesMeResources:
########################
print (f"\tvalid: {res._valid}")
print (f"\tstate: {res._state}")
print (f"\ttimestamp: {res._timestamp}")
+ print (f"\tlast_update: {res._lastupdate}")
########################
# Update Resources State
self._lastupdate = datetime.fromtimestamp(self._timestamp/1000)
self._valid = True
+ def unique_id(self):
+ """Return the unique id of the sensor."""
+ return f"{self._vin}-{self._name}"
+
def name(self):
"""Return the name of the sensor."""
return f"{self._vin}_{self.name}"
"last_update": self._lastupdate,
})
- def update(self):
- """Fetch new state data for the sensor."""
- result = GetResource(URL_RES_PREFIX + self._href, self._config)
- if not "reason" in result:
- self._state = result[self._name]["value"]
- self._timestamp = result[self._name]["timestamp"]
- self._lastupdate = datetime.fromtimestamp(self._timestamp/1000)
- self._valid = True
-
class MercedesMeResources:
########################