Skip to content

Commit

Permalink
feat: Add Coordinator Debug action
Browse files Browse the repository at this point in the history
  • Loading branch information
GuyKh committed Oct 29, 2024
1 parent 2eee26e commit adca680
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 1 deletion.
13 changes: 12 additions & 1 deletion custom_components/ims_envista/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

from ims_envista import IMSEnvista

from .const import CONF_STATION_CONDITIONS, CONF_STATION_ID
from .const import CONF_STATION_CONDITIONS, CONF_STATION_ID, DOMAIN, LOGGER
from .coordinator import ImsEnvistaUpdateCoordinator
from .data import ImsEnvistaData

Expand Down Expand Up @@ -57,6 +57,17 @@ async def async_setup_entry(
await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
entry.async_on_unload(entry.add_update_listener(async_reload_entry))

# Register the debug service
async def handle_debug_get_coordinator_data(call) -> None: # noqa: ANN001 ARG001
# Log or return coordinator data
data = coordinator.data
LOGGER.info("Coordinator data: %s", data)
hass.bus.async_fire("custom_component_debug_event", {"data": data})

hass.services.async_register(
DOMAIN, "debug_get_coordinator_data", handle_debug_get_coordinator_data
)

return True


Expand Down
3 changes: 3 additions & 0 deletions custom_components/ims_envista/services.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
debug_get_coordinator_data:
description: "Fetch and return the coordinator data for debugging purposes."
fields: {}
6 changes: 6 additions & 0 deletions custom_components/ims_envista/translations/ar.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@
"unknown": "خطأ غير معروف."
}
},
"services": {
"debug_get_coordinator_data": {
"name": "الحصول على بيانات منسق IMS Envista",
"description": "طباعة البيانات لأغراض تصحيح الأخطاء."
}
},
"entity": {
"weather": {
"ims_envista_weather": {
Expand Down
6 changes: 6 additions & 0 deletions custom_components/ims_envista/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@
"unknown": "Unknown error occurred."
}
},
"services": {
"debug_get_coordinator_data": {
"name": "Get Bezeq Energy Coordinator Data",
"description": "Fetch and return the coordinator data for debugging purposes."
}
},
"entity": {
"weather": {
"ims_envista_weather": {
Expand Down
6 changes: 6 additions & 0 deletions custom_components/ims_envista/translations/he.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@
"unknown": "שגיאה לא מוכרת."
}
},
"services": {
"debug_get_coordinator_data": {
"name": "קבל מידע מקורדינטור של IMS Envista",
"description": "הדפס מידע לצורך ניפוי שגיאות."
}
},
"entity": {
"weather": {
"ims_envista_weather": {
Expand Down

0 comments on commit adca680

Please sign in to comment.