@@ -231,6 +231,36 @@ def __str__(self):
231231 else :
232232 return str (self .data [0 ])
233233
234+ def __eq__ (self , other ):
235+ if SingleRegister == type (other ):
236+ return self .value == other .value
237+ elif type (other ) == int :
238+ return self .value == other
239+ else :
240+ raise ValueError ("Can't compare SingleRegister value with non-integer values or registers" )
241+
242+ def __le__ (self , other ):
243+ if SingleRegister == type (other ):
244+ return self .value <= other .value
245+ elif type (other ) == int :
246+ return self .value <= other
247+ else :
248+ raise ValueError ("Can't compare SingleRegister value with non-integer values or registers" )
249+
250+ def __lt__ (self , other ):
251+ if SingleRegister == type (other ):
252+ return self .value < other .value
253+ elif type (other ) == int :
254+ return self .value < other
255+ else :
256+ raise ValueError ("Can't compare SingleRegister value with non-integer values or registers" )
257+
258+ def __gt__ (self , other ):
259+ return not self .__le__ (other )
260+
261+ def __ge__ (self , other ):
262+ return not self .__lt__ (other )
263+
234264
235265class SingleSensorValue (ByteStructure ):
236266 """
0 commit comments