Please add the last command sent to the roomba as an attribute.
This would be extremely helpful when automating a roomba. The other methods of using dorita980 or rest980 is very cumbersome.
I was able to accomplish this with the following modification to HA 2022.8.6
In irobot_base.py near top with other imports add:
import json
In the function:
def extra_state_attributes(self):
after:
# Set legacy status to avoid break changes
state_attrs[ATTR_STATUS] = self.vacuum.current_state
add:
lastCommand = state.get("lastCommand")
if lastCommand is not None:
state_attrs['lastCommand'] = json.dumps(lastCommand)
The result is that the vacuum entity will now have a lastCommand attribute.
example:
lastCommand: {"command": "start", "initiator": "localApp", "time": 1660932134, "pmap_id": "cyWPBobyTj-3J8YtjeZg-g", "regions": [{"region_id": "21", "type": "rid"}], "ordered": 1, "user_pmapv_id": null, "params": null}