device id
This commit is contained in:
1 parent
8a90b56ac3
commit
f1b24ec783
17 files changed
+438
-65
No files matched your search
@@ -1,3 +1,4 @@
|
||||
import { InputDevice } from "components/Inputs/InputDevice";
|
||||
import { InputEntity } from "components/Inputs/InputEntities";
|
||||
import InputText from "components/Inputs/InputText";
|
||||
import { DeviceAction } from "types/automations/actions";
|
||||
@@ -7,16 +8,16 @@ import { OptionManager, updateActionData } from './OptionManager';
|
||||
export const ActionDeviceState: OptionManager<DeviceAction> = {
|
||||
defaultState: () => ({
|
||||
alias: "",
|
||||
device_id: ""
|
||||
}),
|
||||
isReady: () => true,
|
||||
renderOptionList: (state, setState) => {
|
||||
renderOptionList: (state, setState, entities) => {
|
||||
console.log(entities.collection?.state)
|
||||
const update = updateActionData(state, setState);
|
||||
return <>
|
||||
<InputText
|
||||
textBoxFor="device_id"
|
||||
label="Device"
|
||||
<InputDevice
|
||||
value={state.device_id ?? ""}
|
||||
onChange={device_id => update({ device_id })}
|
||||
onChange={device_id => update({ device_id: device_id ?? "" })}
|
||||
/>
|
||||
<InputText
|
||||
textBoxFor="type"
|
||||
|
||||
@@ -3,6 +3,7 @@ import { AutomationTriggerDevice } from 'types/automations/triggers';
|
||||
import InputText from 'components/Inputs/InputText';
|
||||
import { InputEntity } from 'components/Inputs/InputEntities';
|
||||
import InputTextBubble from 'components/Inputs/InputTextBubble';
|
||||
import { InputDevice } from 'components/Inputs/InputDevice';
|
||||
|
||||
|
||||
export const TriggerDevice: OptionManager<AutomationTriggerDevice> = {
|
||||
@@ -24,9 +25,9 @@ export const TriggerDevice: OptionManager<AutomationTriggerDevice> = {
|
||||
...state,
|
||||
subtype
|
||||
})} />
|
||||
<InputText label="Device" value={state.device_id ?? ""} onChange={device_id => setState({
|
||||
<InputDevice value={state.device_id ?? ""} onChange={device_id => setState({
|
||||
...state,
|
||||
device_id
|
||||
device_id: device_id ?? "",
|
||||
})} />
|
||||
<InputEntity restrictToDomain={state.domain ? [state.domain] : undefined} value={state.entity_id ?? ""} multiple onChange={entity_id => setState({
|
||||
...state,
|
||||
|
||||
Reference in new issue
Block a user