diff --git a/README.md b/README.md index ed6165e..a680254 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,8 @@ ## Supported Devices -* Granary Feeder (PLAF103) +* Granary Smart Feeder (PLAF103) +* Granary Smart Camera Feeder (PLAF203) ## Installation @@ -31,4 +32,4 @@ Get the folder `custom_components/petlibro` in your HA `config/custom_components - Enter your credentials. > Only one device can be login at the same time > - > If you to wan to keep your phone connected, create another account for this integration and share your device to it \ No newline at end of file + > If you to wan to keep your phone connected, create another account for this integration and share your device to it diff --git a/custom_components/petlibro/__init__.py b/custom_components/petlibro/__init__.py index 003c443..7179e14 100644 --- a/custom_components/petlibro/__init__.py +++ b/custom_components/petlibro/__init__.py @@ -7,7 +7,7 @@ from custom_components.petlibro.devices.feeders.feeder import Feeder from .devices import Device -from .devices.feeders.granary_feeder import GranaryFeeder +from .devices.feeders.granary_smart_feeder import GranarySmartFeeder from .const import DOMAIN from .hub import PetLibroHub @@ -17,7 +17,7 @@ Feeder: ( Platform.SWITCH, ), - GranaryFeeder: ( + GranarySmartFeeder: ( Platform.SENSOR, ), } diff --git a/custom_components/petlibro/devices/__init__.py b/custom_components/petlibro/devices/__init__.py index 8c2f312..6e70e91 100644 --- a/custom_components/petlibro/devices/__init__.py +++ b/custom_components/petlibro/devices/__init__.py @@ -1,9 +1,9 @@ from typing import Dict, Type from .device import Device -from .feeders.granary_feeder import GranaryFeeder -from .feeders.granary_camera_feeder import GranaryCameraFeeder +from .feeders.granary_smart_feeder import GranarySmartFeeder +from .feeders.granary_smart_camera_feeder import GranarySmartCameraFeeder product_name_map : Dict[str, Type[Device]] = { - "Granary Feeder": GranaryFeeder, - "Granary Camera Feeder": GranaryCameraFeeder + "Granary Smart Feeder": GranarySmartFeeder, + "Granary Smart Camera Feeder": GranarySmartCameraFeeder } diff --git a/custom_components/petlibro/devices/feeders/granary_camera_feeder.py b/custom_components/petlibro/devices/feeders/granary_camera_feeder.py deleted file mode 100644 index 5ad2840..0000000 --- a/custom_components/petlibro/devices/feeders/granary_camera_feeder.py +++ /dev/null @@ -1,4 +0,0 @@ -from .granary_feeder import GranaryFeeder - -class GranaryCameraFeeder(GranaryFeeder): - pass diff --git a/custom_components/petlibro/devices/feeders/granary_smart_camera_feeder.py b/custom_components/petlibro/devices/feeders/granary_smart_camera_feeder.py new file mode 100644 index 0000000..f9371a9 --- /dev/null +++ b/custom_components/petlibro/devices/feeders/granary_smart_camera_feeder.py @@ -0,0 +1,4 @@ +from .granary_smart_feeder import GranarySmartFeeder + +class GranarySmartCameraFeeder(GranarySmartFeeder): + pass diff --git a/custom_components/petlibro/devices/feeders/granary_feeder.py b/custom_components/petlibro/devices/feeders/granary_smart_feeder.py similarity index 95% rename from custom_components/petlibro/devices/feeders/granary_feeder.py rename to custom_components/petlibro/devices/feeders/granary_smart_feeder.py index dd9af5b..f2fc081 100644 --- a/custom_components/petlibro/devices/feeders/granary_feeder.py +++ b/custom_components/petlibro/devices/feeders/granary_smart_feeder.py @@ -3,7 +3,7 @@ from .feeder import Feeder -class GranaryFeeder(Feeder): +class GranarySmartFeeder(Feeder): async def refresh(self): await super().refresh() self.update_data({ diff --git a/custom_components/petlibro/sensor.py b/custom_components/petlibro/sensor.py index 6f9058b..e81dde3 100644 --- a/custom_components/petlibro/sensor.py +++ b/custom_components/petlibro/sensor.py @@ -18,7 +18,7 @@ from .devices import Device from .devices.feeders.feeder import Feeder -from .devices.feeders.granary_feeder import GranaryFeeder +from .devices.feeders.granary_smart_feeder import GranarySmartFeeder from . import PetLibroHubConfigEntry from .entity import PetLibroEntity, _DeviceT, PetLibroEntityDescription @@ -95,13 +95,13 @@ def device_class(self) -> SensorDeviceClass | None: DEVICE_SENSOR_MAP: dict[type[Device], list[PetLibroSensorEntityDescription]] = { - GranaryFeeder: [ - PetLibroSensorEntityDescription[GranaryFeeder]( + GranarySmartFeeder: [ + PetLibroSensorEntityDescription[GranarySmartFeeder]( key="remaining_desiccant", translation_key="remaining_desiccant", icon="mdi:package" ), - PetLibroSensorEntityDescription[GranaryFeeder]( + PetLibroSensorEntityDescription[GranarySmartFeeder]( key="today_feeding_quantity", translation_key="today_feeding_quantity", icon="mdi:scale", @@ -109,7 +109,7 @@ def device_class(self) -> SensorDeviceClass | None: device_class_fn=device_class_feeder, state_class=SensorStateClass.TOTAL_INCREASING ), - PetLibroSensorEntityDescription[GranaryFeeder]( + PetLibroSensorEntityDescription[GranarySmartFeeder]( key="today_feeding_times", translation_key="today_feeding_times", icon="mdi:history",