diff --git a/custom_components/petkit/button.py b/custom_components/petkit/button.py index 8ffa315..561aa3d 100644 --- a/custom_components/petkit/button.py +++ b/custom_components/petkit/button.py @@ -8,7 +8,7 @@ from typing import TYPE_CHECKING from pypetkitapi.command import FeederCommand, LBAction, LBCommand, LitterCommand -from pypetkitapi.const import D3, D4H, D4S, D4SH, DEVICES_FEEDER, DEVICES_LITTER_BOX, T4 +from pypetkitapi.const import D3, D4H, D4S, D4SH, DEVICES_FEEDER, DEVICES_LITTER_BOX, T4, T3, T6 from pypetkitapi.feeder_container import Feeder from pypetkitapi.litter_container import Litter from pypetkitapi.water_fountain_container import WaterFountain @@ -155,6 +155,36 @@ class PetKitButtonDesc(PetKitDescSensorBase, ButtonEntityDescription): only_for_types=DEVICES_LITTER_BOX, is_available=lambda device: device.state.work_state is not None, ), + PetKitButtonDesc( + key="Deodorize", + translation_key="deodorize", + action=lambda api, device: api.send_api_request( + device.id, + LitterCommand.CONTROL_DEVICE, + {LBAction.START: LBCommand.ODOR_REMOVAL}, + ), + only_for_types=DEVICES_LITTER_BOX, + ), + PetKitButtonDesc( + key="Reset odor eliminator", + translation_key="reset_odor_eliminator", + action=lambda api, device: api.send_api_request( + device.id, + LitterCommand.CONTROL_DEVICE, + {LBAction.START: LBCommand.RESET_DEODOR}, + ), + only_for_types=[T3], + ), + PetKitButtonDesc( + key="Reset odor eliminator", + translation_key="reset_odor_eliminator", + action=lambda api, device: api.send_api_request( + device.id, + LitterCommand.CONTROL_DEVICE, + {LBAction.START: LBCommand.RESET_MAX_DEODOR}, + ), + only_for_types=[T4, T6], + ), ], WaterFountain: [ # PetKitButtonDesc( diff --git a/custom_components/petkit/icons.json b/custom_components/petkit/icons.json index 1aa9b14..c42b093 100644 --- a/custom_components/petkit/icons.json +++ b/custom_components/petkit/icons.json @@ -148,6 +148,12 @@ }, "start_scoop": { "default": "mdi:broom" + }, + "deodorize": { + "default": "mdi:spray" + }, + "reset_odor_eliminator": { + "default": "mdi:scent" } }, "number": { diff --git a/custom_components/petkit/translations/en.json b/custom_components/petkit/translations/en.json index 68d009f..7de21cd 100644 --- a/custom_components/petkit/translations/en.json +++ b/custom_components/petkit/translations/en.json @@ -122,6 +122,12 @@ }, "start_scoop": { "name": "Scoop" + }, + "deodorize": { + "name": "Deodorize" + }, + "reset_odor_eliminator": { + "name": "Reset odor eliminator" } }, "number": {