|
1 | 1 | """sensor.py""" |
2 | 2 |
|
3 | 3 | import logging |
4 | | -from datetime import datetime |
5 | 4 |
|
6 | 5 | from homeassistant.components.sensor import SensorEntity |
7 | 6 | from homeassistant.components.binary_sensor import BinarySensorEntity |
|
27 | 26 |
|
28 | 27 |
|
29 | 28 | from homeassistant.core import callback |
30 | | -from homeassistant.util import dt as dt_util |
31 | 29 |
|
32 | 30 | from .const import ( |
33 | 31 | DOMAIN, |
@@ -403,9 +401,8 @@ def is_on(self): |
403 | 401 | def extra_state_attributes(self): |
404 | 402 | """Return the extra state attributes.""" |
405 | 403 | return { |
406 | | - "Timezone": self._ecu.ecu.timezone, |
407 | | - "Last data update": self._ecu.ecu.last_update, |
408 | | - "Last UI update": dt_util.now().isoformat(), |
| 404 | + "timezone": self._ecu.ecu.timezone, |
| 405 | + "last_data_update": self._ecu.ecu.last_update, |
409 | 406 | } |
410 | 407 |
|
411 | 408 | @callback |
@@ -501,12 +498,10 @@ def native_unit_of_measurement(self): |
501 | 498 |
|
502 | 499 | @property |
503 | 500 | def extra_state_attributes(self): |
504 | | - attrs = { |
505 | | - "Timezone": self._ecu.ecu.timezone, |
506 | | - "Last data update": self._ecu.ecu.last_update, |
507 | | - "Last UI update": dt_util.now().isoformat(), |
| 501 | + return { |
| 502 | + "timezone": self._ecu.ecu.timezone, |
| 503 | + "last_data_update": self._ecu.ecu.last_update, |
508 | 504 | } |
509 | | - return attrs |
510 | 505 |
|
511 | 506 | @property |
512 | 507 | def state_class(self): |
@@ -605,9 +600,8 @@ def native_unit_of_measurement(self): |
605 | 600 | @property |
606 | 601 | def extra_state_attributes(self): |
607 | 602 | return { |
608 | | - "Timezone": self._ecu.ecu.timezone, |
609 | | - "Last data update": self._ecu.ecu.last_update, |
610 | | - "Last UI update": dt_util.now().isoformat(), |
| 603 | + "timezone": self._ecu.ecu.timezone, |
| 604 | + "last_data_update": self._ecu.ecu.last_update, |
611 | 605 | } |
612 | 606 |
|
613 | 607 | @property |
@@ -687,10 +681,9 @@ def icon(self): |
687 | 681 | def extra_state_attributes(self): |
688 | 682 | """Return the state attributes of the entity.""" |
689 | 683 | return { |
690 | | - "IP-Address": self._ecu.ipaddr, |
691 | | - "Timezone": self._ecu.ecu.timezone, |
692 | | - "Last data update": self._ecu.ecu.last_update, |
693 | | - "Last UI update": dt_util.now().isoformat(), |
| 684 | + "ip_address": self._ecu.ipaddr, |
| 685 | + "timezone": self._ecu.ecu.timezone, |
| 686 | + "last_data_update": self._ecu.ecu.last_update, |
694 | 687 | } |
695 | 688 |
|
696 | 689 | @property |
|
0 commit comments