Skip to content

Commit

Permalink
Removed services.py file
Browse files Browse the repository at this point in the history
  • Loading branch information
kgn3400 committed Aug 10, 2024
1 parent 221d4bd commit 98515bb
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 21 deletions.
3 changes: 0 additions & 3 deletions custom_components/docker_status/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

from .component_api import ComponentApi
from .const import DOMAIN, LOGGER
from .services import async_setup_services

PLATFORMS: list[Platform] = [Platform.SENSOR]

Expand Down Expand Up @@ -47,8 +46,6 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:

await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)

await async_setup_services(hass, component_api)

return True


Expand Down
14 changes: 14 additions & 0 deletions custom_components/docker_status/component_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
CONF_DOCKER_ENGINE_URL,
CONF_DOCKER_ENV_SENSOR_NAME,
CONF_SENSORS,
DOMAIN,
LOGGER,
SENSOR_CONTAINERS_CPU_PERCENT,
SENSOR_CONTAINERS_MEMORY_USAGE,
Expand Down Expand Up @@ -67,6 +68,19 @@ def __init__(self, hass: HomeAssistant, entry: ConfigEntry) -> None:
self.first_time: bool = True
self.env_sensors: dict[str, DockerData] = {}

"""Setup the actions for the docker integration."""
hass.services.async_register(
DOMAIN,
"update",
self.async_update_service,
)

hass.services.async_register(
DOMAIN,
"prune_images",
self.async_prune_images_service,
)

# -------------------------------------------------------------------
async def async_update_service(self, call: ServiceCall) -> None:
"""Update via service."""
Expand Down
2 changes: 1 addition & 1 deletion custom_components/docker_status/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@
"docker==7.1.0"
],
"ssdp": [],
"version": "1.0.8",
"version": "1.0.9",
"zeroconf": []
}
16 changes: 0 additions & 16 deletions custom_components/docker_status/services.py

This file was deleted.

2 changes: 1 addition & 1 deletion custom_components/docker_status/translations/da.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
},
"services": {
"update": {
"description": "Update docker status information.",
"description": "Opdater docker status information.",
"name": "Opdater"
},
"prune_images": {
Expand Down

0 comments on commit 98515bb

Please sign in to comment.