added condition editor for device
This commit is contained in:
1 parent
1ce934fd54
commit
618a62affe
9 files changed
+387
-256
No files matched your search
@@ -3,6 +3,7 @@ import { MessageBase } from "home-assistant-js-websocket";
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
import { prettyName } from "utils/formatting";
|
||||
import {
|
||||
DeviceConditionType,
|
||||
DeviceTriggerType,
|
||||
DeviceTypeAction,
|
||||
DeviceTypeCapability,
|
||||
@@ -114,5 +115,29 @@ export const getDeviceExtraWsCalls = (callHA: HASendMessage) => {
|
||||
reduceDeviceThings,
|
||||
{}
|
||||
),
|
||||
useDeviceConditionCapalities: createUseThing<
|
||||
DeviceTypeAction,
|
||||
DeviceTypeCapability,
|
||||
Partial<DeviceTypeCapability>
|
||||
>(
|
||||
(condition) => ({
|
||||
type: "device_automation/condition/capabilities",
|
||||
condition,
|
||||
}),
|
||||
(data) => data,
|
||||
{}
|
||||
),
|
||||
useDeviceConditions: createUseThing<
|
||||
{ deviceId: string },
|
||||
DeviceConditionType[],
|
||||
Record<string, BaseOption<{ data: DeviceConditionType[] }>>
|
||||
>(
|
||||
({ deviceId }) => ({
|
||||
type: "device_automation/condition/list",
|
||||
device_id: deviceId,
|
||||
}),
|
||||
reduceDeviceThings,
|
||||
{}
|
||||
),
|
||||
};
|
||||
};
|
||||
Reference in new issue
Block a user