@@ -74,7 +74,7 @@ def _body(self) -> bytearray:
74
74
75
75
76
76
class MessageNewProtocolSet (MessageE2Base ):
77
- """E2 message new protocol set."""
77
+ """E2 message new protocol set(T_0000_E2_24.lua:flag == false: else) ."""
78
78
79
79
def __init__ (self , protocol_version : int ) -> None :
80
80
"""Initialize E2 message new protocol set."""
@@ -85,26 +85,79 @@ def __init__(self, protocol_version: int) -> None:
85
85
)
86
86
self .target_temperature : float | None = None
87
87
self .variable_heating : bool | None = None
88
+ self .sterilization : bool | None = None
88
89
self .whole_tank_heating : bool | None = None
90
+ self .protect : bool | None = None
91
+ self .sleep : bool | None = None
92
+ self .big_water : bool | None = None
93
+ self .auto_off : bool | None = None
94
+ self .safe : bool | None = None
95
+ self .screen_off : bool | None = None
96
+ self .wash_temperature : float | None = None
97
+ self .always_fell : bool | None = None
98
+ self .smart_sterilize : bool | None = None
99
+ self .uv_sterilize : bool | None = None
89
100
90
101
@property
91
102
def _body (self ) -> bytearray :
92
- byte1 = 0x00
93
- byte2 = 0x00
103
+ byte12 = 0x00
104
+ byte13 = 0x00
94
105
if self .target_temperature is not None :
95
- byte1 = 0x07
96
- byte2 = int (self .target_temperature ) & 0xFF
106
+ byte12 = 0x07
107
+ byte13 = int (self .target_temperature ) & 0xFF
97
108
elif self .whole_tank_heating is not None :
98
- byte1 = 0x04
99
- byte2 = 0x02 if self .whole_tank_heating else 0x01
109
+ byte12 = 0x04
110
+ # byte2 0x02/whole_heat 0x01/half_heat
111
+ byte13 = 0x02 if self .whole_tank_heating else 0x01
112
+ # frequency_hot
100
113
elif self .variable_heating is not None :
101
- byte1 = 0x10
102
- byte2 = 0x01 if self .variable_heating else 0x00
103
- return bytearray ([byte1 , byte2 ])
114
+ byte12 = 0x10
115
+ byte13 = 0x01 if self .variable_heating else 0x00
116
+ # sterilization
117
+ elif self .sterilization is not None :
118
+ byte12 = 0x0D
119
+ byte13 = 0x01 if self .sterilization else 0x00
120
+ # protect
121
+ elif self .protect is not None :
122
+ byte12 = 0x05
123
+ byte13 = 0x01 if self .protect else 0x00
124
+ # sleep
125
+ elif self .sleep is not None :
126
+ byte12 = 0x0E
127
+ byte13 = 0x01 if self .sleep else 0x00
128
+ # big_water
129
+ elif self .big_water is not None :
130
+ byte12 = 0x11
131
+ byte13 = 0x01 if self .big_water else 0x00
132
+ # auto_off
133
+ elif self .auto_off is not None :
134
+ byte12 = 0x14
135
+ byte13 = 0x01 if self .auto_off else 0x00
136
+ # safe
137
+ elif self .safe is not None :
138
+ byte12 = 0x06
139
+ byte13 = 0x01 if self .safe else 0x00
140
+ # screen_off
141
+ elif self .screen_off is not None :
142
+ byte12 = 0x0F
143
+ byte13 = 0x01 if self .screen_off else 0x00
144
+ # wash_temperature
145
+ elif self .wash_temperature is not None :
146
+ byte12 = 0x16
147
+ byte13 = int (self .wash_temperature ) & 0xFF
148
+ # smart_sterilize
149
+ elif self .smart_sterilize is not None :
150
+ byte12 = 0x1B
151
+ byte13 = 0x01 if self .smart_sterilize else 0x00
152
+ # uv_sterilize
153
+ elif self .uv_sterilize is not None :
154
+ byte12 = 0x1D
155
+ byte13 = 0x01 if self .uv_sterilize else 0x00
156
+ return bytearray ([byte12 , byte13 ])
104
157
105
158
106
159
class MessageSet (MessageE2Base ):
107
- """E2 message set."""
160
+ """E2 message set(T_0000_E2_24.lua: else) ."""
108
161
109
162
def __init__ (self , protocol_version : int ) -> None :
110
163
"""Initialize E2 message set."""
@@ -129,15 +182,15 @@ def _body(self) -> bytearray:
129
182
variable_heating = 0x10 if self .variable_heating else 0x00
130
183
return bytearray (
131
184
[
132
- 0x01 ,
133
- 0x00 ,
134
- 0x80 ,
135
- whole_tank_heating | protection ,
136
- target_temperature ,
137
- 0x00 ,
138
- 0x00 ,
139
- 0x00 ,
140
- variable_heating ,
185
+ 0x01 , # byte12
186
+ 0x00 , # byte13
187
+ 0x80 , # byte14
188
+ whole_tank_heating | protection , # byte15
189
+ target_temperature , # byte16
190
+ 0x00 , # byte17
191
+ 0x00 , # byte18
192
+ 0x00 , # byte19
193
+ variable_heating , # byte20
141
194
0x00 ,
142
195
0x00 ,
143
196
0x00 ,
@@ -152,24 +205,64 @@ def _body(self) -> bytearray:
152
205
153
206
154
207
class E2GeneralMessageBody (MessageBody ):
155
- """E2 message general body."""
208
+ """E2 message general body(T_0000_E2_24.lua) ."""
156
209
157
210
def __init__ (self , body : bytearray ) -> None :
158
211
"""Initialize E2 message general body."""
159
212
super ().__init__ (body )
160
213
self .power = (body [2 ] & 0x01 ) > 0
161
- self .heating = (body [2 ] & 0x04 ) > 0
162
- self .keep_warm = (body [2 ] & 0x08 ) > 0
163
- self .variable_heating = (body [2 ] & 0x80 ) > 0
164
- self .current_temperature = body [4 ]
165
- self .whole_tank_heating = (body [7 ] & 0x08 ) > 0
214
+ self .fast_hot_power = (body [2 ] & 0x02 ) > 0 # fast_hot_power
215
+ self .heating = (body [2 ] & 0x04 ) > 0 # hot_power
216
+ self .keep_warm = (body [2 ] & 0x08 ) > 0 # warm_power
217
+ self .water_flow = (body [2 ] & 0x10 ) > 0 # water_flow
218
+ self .sterilization = (body [2 ] & 0x40 ) > 0 # sterilization
219
+ self .variable_heating = (body [2 ] & 0x80 ) > 0 # frequency_hot
220
+ self .current_temperature = float (body [4 ])
221
+ self .heat_water_level = body [5 ] # heat_water_level
222
+ self .eplus = (body [7 ] & 0x01 ) > 0 # eplus
223
+ self .fast_wash = (body [7 ] & 0x02 ) > 0 # fast_wash
224
+ self .half_heat = (body [7 ] & 0x04 ) > 0 # half_heat
225
+ self .whole_tank_heating = (body [7 ] & 0x08 ) > 0 # whole_heat
226
+ self .summer = (body [7 ] & 0x10 ) > 0
227
+ self .winter = (body [7 ] & 0x20 ) > 0
228
+ self .efficient = (body [7 ] & 0x40 ) > 0
229
+ self .night = (body [7 ] & 0x80 ) > 0
230
+ self .screen_off = (body [8 ] & 0x08 ) > 0
231
+ self .sleep = (body [8 ] & 0x10 ) > 0
232
+ self .cloud = (body [8 ] & 0x20 ) > 0
233
+ self .appoint_wash = (body [8 ] & 0x40 ) > 0
234
+ self .now_wash = (body [8 ] & 0x80 ) > 0
235
+ # end_time_hour/end_time_minute
166
236
self .heating_time_remaining = body [9 ] * 60 + body [10 ]
167
- self .target_temperature = body [11 ]
237
+ self .target_temperature = float (body [11 ])
238
+ self .smart_sterilize = (body [12 ] & 0x20 ) > 0
239
+ self .sterilize_high_temp = (body [12 ] & 0x40 ) > 0
240
+ self .uv_sterilize = (body [12 ] & 0x80 ) > 0
241
+ self .discharge_status = body [13 ]
242
+ self .top_temp = body [14 ]
243
+ self .bottom_heat = (body [15 ] & 0x01 ) > 0
244
+ self .top_heat = (body [15 ] & 0x02 ) > 0
245
+ self .water_cyclic = (body [15 ] & 0x80 ) > 0
246
+ self .water_system = body [16 ]
247
+ # in_temperature
248
+ self .in_temperature = float (body [18 ]) if len (body ) > PROTECTION_BYTE else None
249
+ # protect
168
250
self .protection = (
169
251
((body [22 ] & 0x02 ) > 0 ) if len (body ) > PROTECTION_BYTE else False
170
252
)
253
+ # waterday_lowbyte/waterday_highbyte
254
+ if len (body ) > WATER_CONSUMPTION_BYTE :
255
+ self .day_water_consumption = body [20 ] + (body [21 ] << 8 )
256
+ # passwater_lowbyte/passwater_highbyte
171
257
if len (body ) > WATER_CONSUMPTION_BYTE :
172
258
self .water_consumption = body [24 ] + (body [25 ] << 8 )
259
+ # volume
260
+ if len (body ) > HEATING_POWER_BYTE :
261
+ self .volume = body [27 ]
262
+ # rate
263
+ if len (body ) > HEATING_POWER_BYTE :
264
+ self .rate = body [28 ] * 100
265
+ # cur_rate
173
266
if len (body ) > HEATING_POWER_BYTE :
174
267
self .heating_power = body [34 ] * 100
175
268
0 commit comments