Change state values for Worx Landroid sensor (#27453)

The obj["state"] contains already several named return states as
following: "grass cutting", "trapped recovery", "searching wire",
           "following wire", "searching home", "home", "idle"
And with the batteryChargerState also the "charging"

Fixes #455
This commit is contained in:
Gerald Hansen 2019-12-08 22:27:18 +01:00 committed by Martin Hjelmare
parent 55559f3e30
commit 3d25ed7994

View file

@ -141,16 +141,9 @@ class WorxLandroidSensor(Entity):
state = self.get_error(obj)
if state is None:
state_obj = obj["settaggi"]
if obj["batteryChargerState"] == "charging":
return obj["batteryChargerState"]
if state_obj[14] == 1:
return "manual-stop"
if state_obj[5] == 1 and state_obj[13] == 0:
return "charging"
if state_obj[5] == 1 and state_obj[13] == 1:
return "charging-complete"
if state_obj[15] == 1:
return "going-home"
return "mowing"
return obj["state"]
return state