Update version to 0.1.40 and add OpenClaw Gateway tools endpoint integration with new service and event support

This commit is contained in:
techartdev
2026-02-20 23:18:37 +02:00
parent 367541044c
commit faa962d8bc
16 changed files with 526 additions and 18 deletions
+39
View File
@@ -17,6 +17,12 @@ from homeassistant.helpers.update_coordinator import CoordinatorEntity
from .const import (
DATA_GATEWAY_VERSION,
DATA_LAST_TOOL_DURATION_MS,
DATA_LAST_TOOL_ERROR,
DATA_LAST_TOOL_INVOKED_AT,
DATA_LAST_TOOL_NAME,
DATA_LAST_TOOL_RESULT_PREVIEW,
DATA_LAST_TOOL_STATUS,
DATA_LAST_ACTIVITY,
DATA_MODEL,
DATA_PROVIDER,
@@ -55,6 +61,32 @@ SENSOR_DESCRIPTIONS: tuple[SensorEntityDescription, ...] = (
name="OpenClaw Model",
icon="mdi:brain",
),
SensorEntityDescription(
key=DATA_LAST_TOOL_NAME,
translation_key="last_tool_name",
name="OpenClaw Last Tool",
icon="mdi:tools",
),
SensorEntityDescription(
key=DATA_LAST_TOOL_STATUS,
translation_key="last_tool_status",
name="OpenClaw Last Tool Status",
icon="mdi:check-decagram",
),
SensorEntityDescription(
key=DATA_LAST_TOOL_DURATION_MS,
translation_key="last_tool_duration_ms",
name="OpenClaw Last Tool Duration",
icon="mdi:speedometer",
native_unit_of_measurement="ms",
),
SensorEntityDescription(
key=DATA_LAST_TOOL_INVOKED_AT,
translation_key="last_tool_invoked_at",
name="OpenClaw Last Tool Invoked",
device_class=SensorDeviceClass.TIMESTAMP,
icon="mdi:clock-outline",
),
)
@@ -135,4 +167,11 @@ class OpenClawSensor(CoordinatorEntity[OpenClawCoordinator], SensorEntity):
"last_message_preview": None, # TODO: populate from last message
}
if key in {DATA_LAST_TOOL_NAME, DATA_LAST_TOOL_STATUS, DATA_LAST_TOOL_DURATION_MS}:
return {
"error": data.get(DATA_LAST_TOOL_ERROR),
"result_preview": data.get(DATA_LAST_TOOL_RESULT_PREVIEW),
"invoked_at": data.get(DATA_LAST_TOOL_INVOKED_AT),
}
return None