@@ -120,9 +120,6 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
120
120
management_point_type ,
121
121
mode ,
122
122
)
123
- icon = "mdi:fire"
124
- if mode == "cooling" :
125
- icon = "mdi:snowflake"
126
123
for period in cdve [mode ]:
127
124
_LOGGER .info (
128
125
"Device '%s:%s' provides mode %s %s supports period %s" ,
@@ -135,17 +132,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
135
132
periodName = SENSOR_PERIODS [period ]
136
133
sensor = f"{ device .name } { management_point_type } { mode } { periodName } "
137
134
_LOGGER .info ("Proposing sensor '%s'" , sensor )
138
- sensors .append (
139
- DaikinEnergySensor (
140
- device ,
141
- coordinator ,
142
- embedded_id ,
143
- management_point_type ,
144
- mode ,
145
- period ,
146
- icon ,
147
- )
148
- )
135
+ sensors .append (DaikinEnergySensor (device , coordinator , embedded_id , management_point_type , mode , period ))
149
136
else :
150
137
_LOGGER .info (
151
138
"Ignoring consumption data '%s', not a supported operation_mode" ,
@@ -166,7 +153,6 @@ def __init__(
166
153
management_point_type ,
167
154
operation_mode ,
168
155
period ,
169
- icon ,
170
156
) -> None :
171
157
super ().__init__ (coordinator )
172
158
self ._device = device
@@ -179,7 +165,9 @@ def __init__(
179
165
self ._attr_name = f"{ mpt } { operation_mode .capitalize ()} { periodName } Electrical Consumption"
180
166
self ._attr_unique_id = f"{ self ._device .getId ()} _{ self ._management_point_type } _electrical_{ self ._operation_mode } _{ self ._period } "
181
167
self ._attr_entity_category = None
182
- self ._attr_icon = icon
168
+ self ._attr_icon = "mdi:fire"
169
+ if operation_mode == "cooling" :
170
+ self ._attr_icon = "mdi:snowflake"
183
171
self ._attr_has_entity_name = True
184
172
self ._attr_device_class = SensorDeviceClass .ENERGY
185
173
self ._attr_state_class = SensorStateClass .TOTAL_INCREASING
0 commit comments