@@ -367,9 +367,9 @@ class mp1s(mp1):
367367
368368 TYPE = "MP1S"
369369
370- def get_status (self ) -> dict :
371- """
372- Return the power state of the device.
370+ def get_state (self ) -> dict :
371+ """Return the power state of the device.
372+
373373 voltage in V.
374374 current in A.
375375 power in W.
@@ -392,15 +392,15 @@ def get_status(self) -> dict:
392392 payload_str = payload .hex ()[4 :- 6 ]
393393
394394 def get_value (start , end , factors ):
395- value = sum (int (payload_str [i - 2 :i ]) * factor for i ,
396- factor in zip (range (start , end , - 2 ), factors ))
395+ value = sum (
396+ int (payload_str [i - 2 : i ]) * factor
397+ for i , factor in zip (range (start , end , - 2 ), factors )
398+ )
397399 return value
398-
400+
399401 return {
400- 'voltage' : get_value (34 , 30 , [10 , 0.1 ]),
401- ' current' : get_value (40 , 34 , [1 , 0.01 , 0.0001 ]),
402- ' power' : get_value (46 , 40 , [100 , 1 , 0.01 ]),
403- 'power_consumption' : get_value (54 , 46 , [10000 , 100 , 1 , 0.01 ])
402+ "volt" : get_value (34 , 30 , [10 , 0.1 ]),
403+ " current" : get_value (40 , 34 , [1 , 0.01 , 0.0001 ]),
404+ " power" : get_value (46 , 40 , [100 , 1 , 0.01 ]),
405+ "totalconsum" : get_value (54 , 46 , [10000 , 100 , 1 , 0.01 ]),
404406 }
405-
406-
0 commit comments