@@ -33,8 +33,8 @@ async def async_setup_entry(
33
33
conf_host = entry .data .get (CONF_HOST )
34
34
if conf_host is None :
35
35
_LOGGER .error ("Device has no address" )
36
-
37
36
# Generate device info
37
+
38
38
device_info = DeviceInfo (
39
39
identifiers = {(DOMAIN , entry .data .get (CONF_HOST ))},
40
40
name = entry .data .get (CONF_NAME ),
@@ -43,12 +43,13 @@ async def async_setup_entry(
43
43
)
44
44
45
45
# Add sensors
46
+
46
47
sensors_to_add = []
47
48
48
49
for register in REGISTERS :
49
50
if register .edit :
50
51
continue
51
- if register .address in (2818 ):
52
+ if register .address in (2818 , ):
52
53
continue
53
54
sensors_to_add .append (
54
55
SolvisSensor (
@@ -63,7 +64,6 @@ async def async_setup_entry(
63
64
register .enabled_by_default ,
64
65
)
65
66
)
66
-
67
67
async_add_entities (sensors_to_add )
68
68
69
69
@@ -104,18 +104,15 @@ def _handle_coordinator_update(self) -> None:
104
104
if self .coordinator .data is None :
105
105
_LOGGER .warning ("Data from coordinator is None. Skipping update" )
106
106
return
107
-
108
107
if not isinstance (self .coordinator .data , dict ):
109
108
_LOGGER .warning ("Invalid data from coordinator" )
110
109
self ._attr_available = False
111
110
return
112
-
113
111
response_data = self .coordinator .data .get (self ._response_key )
114
112
if response_data is None :
115
113
_LOGGER .warning ("No data for available for (%s)" , self ._response_key )
116
114
self ._attr_available = False
117
115
return
118
-
119
116
if (
120
117
not isinstance (response_data , int )
121
118
and not isinstance (response_data , float )
@@ -129,7 +126,6 @@ def _handle_coordinator_update(self) -> None:
129
126
)
130
127
self ._attr_available = False
131
128
return
132
-
133
129
self ._attr_available = True
134
130
self ._attr_native_value = response_data
135
131
self .async_write_ha_state ()
0 commit comments