fixed up trigger issues
This commit is contained in:
1 parent
4509a224a9
commit
cce2e03053
5 files changed
+206
-3
No files matched your search
@@ -1,5 +1,9 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## [0.1.9] - Fixed up invalid types for various triggers
|
||||||
|
|
||||||
|
- Some triggers had invalid types and were causing a false-positive validation
|
||||||
|
|
||||||
## [0.1.8] - Support for Malformed Automations
|
## [0.1.8] - Support for Malformed Automations
|
||||||
|
|
||||||
- API will no longer error out on missing values or invalid lists
|
- API will no longer error out on missing values or invalid lists
|
||||||
|
|||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
name: Shortumation
|
name: Shortumation
|
||||||
version: 0.1.8
|
version: 0.1.9
|
||||||
slug: shortumation
|
slug: shortumation
|
||||||
image: asosnovsky/shortumation-{arch}
|
image: asosnovsky/shortumation-{arch}
|
||||||
url: "https://github.com/asosnovsky/Shortumation"
|
url: "https://github.com/asosnovsky/Shortumation"
|
||||||
|
|||||||
@@ -62,6 +62,198 @@ FewAutos.args = {
|
|||||||
createMockAuto({ "Room": "Office", "Type": "Lights" }),
|
createMockAuto({ "Room": "Office", "Type": "Lights" }),
|
||||||
createMockAuto({ "Room": "Office" }),
|
createMockAuto({ "Room": "Office" }),
|
||||||
createMockAuto(),
|
createMockAuto(),
|
||||||
|
{
|
||||||
|
"metadata": {
|
||||||
|
"id": "1649947692702",
|
||||||
|
"alias": "Bed Remote",
|
||||||
|
"description": "",
|
||||||
|
"trigger_variables": null,
|
||||||
|
"mode": "single"
|
||||||
|
},
|
||||||
|
"trigger": [
|
||||||
|
{
|
||||||
|
"device_id": "asdasdasdas",
|
||||||
|
"domain": "zha",
|
||||||
|
"platform": "device",
|
||||||
|
"type": "remote_button_short_press",
|
||||||
|
"subtype": "turn_on",
|
||||||
|
"id": "turn_on"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"device_id": "asdasdasdas",
|
||||||
|
"domain": "zha",
|
||||||
|
"platform": "device",
|
||||||
|
"type": "remote_button_short_press",
|
||||||
|
"subtype": "turn_off",
|
||||||
|
"id": "turn_off"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"device_id": "asdasdasdas",
|
||||||
|
"domain": "zha",
|
||||||
|
"platform": "device",
|
||||||
|
"type": "remote_button_short_press",
|
||||||
|
"subtype": "dim_up",
|
||||||
|
"id": "dim_up"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"device_id": "asdasdasdas",
|
||||||
|
"domain": "zha",
|
||||||
|
"platform": "device",
|
||||||
|
"type": "remote_button_short_press",
|
||||||
|
"subtype": "dim_down",
|
||||||
|
"id": "dim_down"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"device_id": "asdasdasdas",
|
||||||
|
"domain": "zha",
|
||||||
|
"platform": "device",
|
||||||
|
"type": "remote_button_double_press",
|
||||||
|
"subtype": "turn_on",
|
||||||
|
"id": "up_dbclk"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"condition": [],
|
||||||
|
"sequence": [
|
||||||
|
{
|
||||||
|
"choose": [
|
||||||
|
{
|
||||||
|
"conditions": [
|
||||||
|
{
|
||||||
|
"condition": "trigger",
|
||||||
|
"id": "turn_off"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"sequence": [
|
||||||
|
{
|
||||||
|
"type": "turn_off",
|
||||||
|
"device_id": "asdasdasdasdas",
|
||||||
|
"entity_id": "light.bulb_ari_lamp",
|
||||||
|
"domain": "light"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"conditions": [
|
||||||
|
{
|
||||||
|
"condition": "trigger",
|
||||||
|
"id": "turn_on"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"sequence": [
|
||||||
|
{
|
||||||
|
"service": "light.turn_on",
|
||||||
|
"data": {
|
||||||
|
"color_temp": 153,
|
||||||
|
"brightness_pct": 100
|
||||||
|
},
|
||||||
|
"target": {
|
||||||
|
"device_id": "asdasdasdasdas"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"conditions": [
|
||||||
|
{
|
||||||
|
"condition": "trigger",
|
||||||
|
"id": "dim_up"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"sequence": [
|
||||||
|
{
|
||||||
|
"device_id": "asdasdasdasdas",
|
||||||
|
"domain": "light",
|
||||||
|
"entity_id": "light.bulb_ari_lamp",
|
||||||
|
"type": "brightness_increase"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"conditions": [
|
||||||
|
{
|
||||||
|
"condition": "trigger",
|
||||||
|
"id": "dim_down"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"sequence": [
|
||||||
|
{
|
||||||
|
"device_id": "asdasdasdasdas",
|
||||||
|
"domain": "light",
|
||||||
|
"entity_id": "light.bulb_ari_lamp",
|
||||||
|
"type": "brightness_decrease"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"conditions": [
|
||||||
|
{
|
||||||
|
"condition": "trigger",
|
||||||
|
"id": "up_dbclk"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"sequence": [
|
||||||
|
{
|
||||||
|
"service": "light.turn_on",
|
||||||
|
"data": {
|
||||||
|
"color_temp": 500,
|
||||||
|
"brightness_pct": 100
|
||||||
|
},
|
||||||
|
"target": {
|
||||||
|
"device_id": "asdasdasdasdas"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"default": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"tags": {
|
||||||
|
"Type": "Remote",
|
||||||
|
"Room": "Bedroom"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"metadata": {
|
||||||
|
"id": "1641617168123",
|
||||||
|
"alias": "Ensure On",
|
||||||
|
"description": "",
|
||||||
|
"trigger_variables": null,
|
||||||
|
"mode": "single"
|
||||||
|
},
|
||||||
|
"trigger": [
|
||||||
|
{
|
||||||
|
"platform": "device",
|
||||||
|
"type": "turned_off",
|
||||||
|
"device_id": "tasdasdasdasdasdasda",
|
||||||
|
"entity_id": "switch.power_washer",
|
||||||
|
"domain": "switch"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"platform": "device",
|
||||||
|
"type": "turned_off",
|
||||||
|
"device_id": "dasdasdasdasdas",
|
||||||
|
"entity_id": "switch.plug_living_room_tv",
|
||||||
|
"domain": "switch"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"condition": [],
|
||||||
|
"sequence": [
|
||||||
|
{
|
||||||
|
"type": "turn_on",
|
||||||
|
"device_id": "tasdasdasdasdasdasda",
|
||||||
|
"entity_id": "switch.power_washer",
|
||||||
|
"domain": "switch"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "turn_on",
|
||||||
|
"device_id": "dasdasdasdasdas",
|
||||||
|
"entity_id": "switch.plug_living_room_tv",
|
||||||
|
"domain": "switch"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"tags": {}
|
||||||
|
}
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ export const TriggerDevice: OptionManager<AutomationTriggerDevice> = {
|
|||||||
"type": "",
|
"type": "",
|
||||||
"subtype": "",
|
"subtype": "",
|
||||||
"device_id": "",
|
"device_id": "",
|
||||||
|
"entity_id": "",
|
||||||
}),
|
}),
|
||||||
isReady: ({ alias }) => {
|
isReady: ({ alias }) => {
|
||||||
return (alias !== '')
|
return (alias !== '')
|
||||||
@@ -33,6 +34,10 @@ export const TriggerDevice: OptionManager<AutomationTriggerDevice> = {
|
|||||||
...state,
|
...state,
|
||||||
device_id
|
device_id
|
||||||
})} />
|
})} />
|
||||||
|
<InputText label="Entity" value={state.entity_id ?? ""} onChange={entity_id => setState({
|
||||||
|
...state,
|
||||||
|
entity_id
|
||||||
|
})} />
|
||||||
</>
|
</>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3,7 +3,8 @@ import { AutomationTime } from './common'
|
|||||||
|
|
||||||
|
|
||||||
const AutomationTriggerBase = {
|
const AutomationTriggerBase = {
|
||||||
alias: st.optional(st.string())
|
alias: st.optional(st.string()),
|
||||||
|
id: st.optional(st.string()),
|
||||||
}
|
}
|
||||||
|
|
||||||
export const AutomationTriggerEvent = st.object({
|
export const AutomationTriggerEvent = st.object({
|
||||||
@@ -94,10 +95,11 @@ export const AutomationTriggerZone = st.object({
|
|||||||
export const AutomationTriggerDevice = st.object({
|
export const AutomationTriggerDevice = st.object({
|
||||||
...AutomationTriggerBase,
|
...AutomationTriggerBase,
|
||||||
platform: st.literal('device'),
|
platform: st.literal('device'),
|
||||||
|
entity_id: st.string(),
|
||||||
device_id: st.string(),
|
device_id: st.string(),
|
||||||
domain: st.string(),
|
domain: st.string(),
|
||||||
type: st.string(),
|
type: st.string(),
|
||||||
subtype: st.string(),
|
subtype: st.optional(st.string()),
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user