fixed tsc
This commit is contained in:
1 parent
7d111c853b
commit
8a90b56ac3
3 files changed
+11
-24
No files matched your search
@@ -7,42 +7,29 @@ import { OptionManager, updateActionData } from './OptionManager';
|
|||||||
export const ActionDeviceState: OptionManager<DeviceAction> = {
|
export const ActionDeviceState: OptionManager<DeviceAction> = {
|
||||||
defaultState: () => ({
|
defaultState: () => ({
|
||||||
alias: "",
|
alias: "",
|
||||||
type: "",
|
|
||||||
entity_id: "",
|
|
||||||
device_id: "",
|
|
||||||
domain: "",
|
|
||||||
}),
|
}),
|
||||||
isReady: ({
|
isReady: () => true,
|
||||||
alias,
|
|
||||||
type,
|
|
||||||
entity_id,
|
|
||||||
device_id,
|
|
||||||
domain,
|
|
||||||
}) => (
|
|
||||||
alias !== '' &&
|
|
||||||
type !== "" &&
|
|
||||||
entity_id !== "" &&
|
|
||||||
device_id !== "" &&
|
|
||||||
domain !== ""
|
|
||||||
),
|
|
||||||
renderOptionList: (state, setState) => {
|
renderOptionList: (state, setState) => {
|
||||||
const update = updateActionData(state, setState);
|
const update = updateActionData(state, setState);
|
||||||
return <>
|
return <>
|
||||||
<InputText
|
<InputText
|
||||||
textBoxFor="device_id"
|
textBoxFor="device_id"
|
||||||
label="Device"
|
label="Device"
|
||||||
value={state.device_id}
|
value={state.device_id ?? ""}
|
||||||
onChange={device_id => update({ device_id })}
|
onChange={device_id => update({ device_id })}
|
||||||
/>
|
/>
|
||||||
<InputText
|
<InputText
|
||||||
textBoxFor="type"
|
textBoxFor="type"
|
||||||
label="Action"
|
label="Action"
|
||||||
value={state.type}
|
value={state.type ?? ""}
|
||||||
onChange={type => update({ type })}
|
onChange={type => update({ type })}
|
||||||
/>
|
/>
|
||||||
<InputEntity
|
<InputEntity
|
||||||
value={state.entity_id ?? ""}
|
value={state.entity_id ?? ""}
|
||||||
onChange={entity_id => update({ entity_id, domain: entity_id.split('.')[0] })}
|
onChange={entity_id => update({
|
||||||
|
entity_id: entity_id ? entity_id : undefined,
|
||||||
|
domain: entity_id ? entity_id.split('.')[0] : ""
|
||||||
|
})}
|
||||||
/>
|
/>
|
||||||
</>
|
</>
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ async function startHAConnection() {
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
haConnection = {
|
haConnection = {
|
||||||
status: 'error',
|
status: 'error',
|
||||||
error: translateErrorCodes(error),
|
error: translateErrorCodes(error as any),
|
||||||
}
|
}
|
||||||
throw error
|
throw error
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,10 +46,10 @@ export const FireEventAction = st.intersection([
|
|||||||
export const DeviceAction = st.intersection([
|
export const DeviceAction = st.intersection([
|
||||||
AutomationActionNodeBase,
|
AutomationActionNodeBase,
|
||||||
st.type({
|
st.type({
|
||||||
type: st.string(),
|
type: st.optional(st.string()),
|
||||||
device_id: st.string(),
|
device_id: st.optional(st.string()),
|
||||||
entity_id: st.optional(st.string()),
|
entity_id: st.optional(st.string()),
|
||||||
domain: st.string(),
|
domain: st.optional(st.string()),
|
||||||
})
|
})
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user