2525
2626SENSE_FEATURES : Final = (
2727 NodeFeature .INFO ,
28- NodeFeature .TEMPERATURE ,
29- NodeFeature .HUMIDITY ,
28+ NodeFeature .SENSE ,
3029)
3130
3231
@@ -61,7 +60,7 @@ async def load(self) -> bool:
6160 self ._loaded = True
6261 self ._setup_protocol (
6362 SENSE_FIRMWARE_SUPPORT ,
64- (NodeFeature .INFO , NodeFeature .TEMPERATURE , NodeFeature . HUMIDITY ),
63+ (NodeFeature .INFO , NodeFeature .SENSE ),
6564 )
6665 if await self .initialize ():
6766 await self ._loaded_callback (NodeEvent .LOADED , self .mac )
@@ -114,29 +113,26 @@ async def _sense_report(self, response: PlugwiseResponse) -> bool:
114113 raise MessageError (
115114 f"Invalid response message type ({ response .__class__ .__name__ } ) received, expected SenseReportResponse"
116115 )
117- report_received = False
116+ report_received_1 = report_received_2 = False
118117 await self ._available_update_state (True , response .timestamp )
119118 if response .temperature .value != 65535 :
120119 self ._sense_statistics .temperature = float (
121120 SENSE_TEMPERATURE_MULTIPLIER * (response .temperature .value / 65536 )
122121 - SENSE_TEMPERATURE_OFFSET
123122 )
124- await self .publish_feature_update_to_subscribers (
125- NodeFeature .TEMPERATURE , self ._sense_statistics
126- )
127- report_received = True
123+ report_received_1 = True
128124
129125 if response .humidity .value != 65535 :
130126 self ._sense_statistics .humidity = float (
131127 SENSE_HUMIDITY_MULTIPLIER * (response .humidity .value / 65536 )
132128 - SENSE_HUMIDITY_OFFSET
133129 )
134130 await self .publish_feature_update_to_subscribers (
135- NodeFeature .HUMIDITY , self ._sense_statistics
131+ NodeFeature .SENSE , self ._sense_statistics
136132 )
137- report_received = True
133+ report_received_2 = True
138134
139- return report_received
135+ return report_received_1 and report_received_2
140136
141137 @raise_not_loaded
142138 async def get_state (self , features : tuple [NodeFeature ]) -> dict [NodeFeature , Any ]:
@@ -154,12 +150,10 @@ async def get_state(self, features: tuple[NodeFeature]) -> dict[NodeFeature, Any
154150 )
155151
156152 match feature :
157- case NodeFeature .TEMPERATURE :
158- states [NodeFeature .TEMPERATURE ] = self ._sense_statistics
159- case NodeFeature .HUMIDITY :
160- states [NodeFeature .HUMIDITY ] = self ._sense_statistics
161153 case NodeFeature .PING :
162154 states [NodeFeature .PING ] = await self .ping_update ()
155+ case NodeFeature .SENSE :
156+ states [NodeFeature .TEMPERATURE ] = self ._sense_statistics
163157 case _:
164158 state_result = await super ().get_state ((feature ,))
165159 states [feature ] = state_result [feature ]
0 commit comments