diff --git a/backend/lib/mqtt/status/BatteryStateMqttHandle.js b/backend/lib/mqtt/status/BatteryStateMqttHandle.js index 741350e8d7e..0c51d48947a 100644 --- a/backend/lib/mqtt/status/BatteryStateMqttHandle.js +++ b/backend/lib/mqtt/status/BatteryStateMqttHandle.js @@ -1,5 +1,8 @@ +const ComponentType = require("../homeassistant/ComponentType"); const DataType = require("../homie/DataType"); +const EntityCategory = require("../homeassistant/EntityCategory"); const HassAnchor = require("../homeassistant/HassAnchor"); +const InLineHassComponent = require("../homeassistant/components/InLineHassComponent"); const Logger = require("../../Logger"); const PropertyMqttHandle = require("../handles/PropertyMqttHandle"); const RobotStateNodeMqttHandle = require("../handles/RobotStateNodeMqttHandle"); @@ -41,6 +44,24 @@ class BatteryStateMqttHandle extends RobotStateNodeMqttHandle { return batteryState.level; } + }).also((prop) => { + this.controller.withHass((hass => { + prop.attachHomeAssistantComponent( + new InLineHassComponent({ + hass: hass, + robot: this.robot, + name: "battery_level", + friendlyName: "Battery level", + componentType: ComponentType.SENSOR, + autoconf: { + state_topic: prop.getBaseTopic(), + icon: "mdi:battery", + entity_category: EntityCategory.DIAGNOSTIC, + unit_of_measurement: Unit.PERCENT + } + }) + ); + })); })); this.registerChild(new PropertyMqttHandle({ diff --git a/backend/lib/mqtt/status/StatusStateMqttHandle.js b/backend/lib/mqtt/status/StatusStateMqttHandle.js index 3b23e4af799..6ff97d429fc 100644 --- a/backend/lib/mqtt/status/StatusStateMqttHandle.js +++ b/backend/lib/mqtt/status/StatusStateMqttHandle.js @@ -58,6 +58,23 @@ class StatusStateMqttHandle extends RobotStateNodeMqttHandle { } return statusState.flag; } + }).also((prop) => { + this.controller.withHass((hass => { + prop.attachHomeAssistantComponent( + new InLineHassComponent({ + hass: hass, + robot: this.robot, + name: "status_flag", + friendlyName: "Status Flag", + componentType: ComponentType.SENSOR, + autoconf: { + state_topic: prop.getBaseTopic(), + icon: "mdi:flag", + entity_category: EntityCategory.DIAGNOSTIC + } + }) + ); + })); })); this.registerChild(new PropertyMqttHandle({ diff --git a/frontend/src/robot/RobotOptions.tsx b/frontend/src/robot/RobotOptions.tsx index 8a73256b1f2..2ee943e1f6b 100644 --- a/frontend/src/robot/RobotOptions.tsx +++ b/frontend/src/robot/RobotOptions.tsx @@ -105,7 +105,7 @@ const CarpetModeControlCapabilitySwitchListMenuItem = () => { }} disabled={disabled} loadError={isError} - primaryLabel={"Carpet mode"} + primaryLabel={"Carpet Mode"} secondaryLabel={"When enabled, the vacuum will recognize carpets automatically and increase the suction."} icon={} /> @@ -186,7 +186,7 @@ const CarpetSensorModeControlCapabilitySelectListMenuItem = () => { disabled={disabled} loadingOptions={carpetSensorModePropertiesLoading || isLoading} loadError={carpetSensorModePropertiesError} - primaryLabel="Carpet Sensor Mode" + primaryLabel="Carpet Sensor" secondaryLabel="Select what action the robot should take if it detects carpet while mopping." icon={} />