hasscc / petkit

🐱 Petkit feeder components for HomeAssistant
Apache License 2.0
120 stars 16 forks source link

Pura Max "Maintenance Mode" #20

Open rethamazur opened 2 years ago

rethamazur commented 2 years ago

thanks again for this component. Is there a way to add the new "maintenance mode" in the Pura Max actions list?

itschrisg commented 2 years ago

I managed to enable after a bit of investigation using the mobile app.

@al-one : You're welcome to incorporate this if it's suitable. Let me know if I'm off base.

There are two properties in the __init__.py file (approx. lines 743-758) for the actions shown in the select control. I've added one entry to each to reference the maintenance mode (displayed as "maintain"), with an action id of 9.

@property
def action(self):
    return {
        0: 'cleanup',
        2: 'deodorize',
        9: 'maintain',
    }.get(self.work_mode, None)

@property
def actions(self):
    return {
        'cleanup':   ['start', 0],
        'pause':     ['stop', self.work_mode],
        'end':       ['end', self.work_mode],
        'continue':  ['continue', self.work_mode],
        'deodorize': ['start', 2],
        'maintain': ['start', 9],
    }
Devstored commented 2 years ago

26

@itschrisg was faster than me :) But I added some extra features.

rethamazur commented 2 years ago

@itschrisg that worked just fine, thanks!