本帖最后由 dinglifeng 于 2018-12-12 22:26 编辑
如下packages 放入后 检查报错内容:
Invalid config for [automation]: required key not provided @ data['action']. Got Nonerequired key not provided @ data['trigger']. Got None. (See ?, line ?). Please check the docs at https://home-assistant.io/components/automation/
请问各位高人这是啥原因啊?
## 倒计时通用面板
homeassistant:
customize:
sensor.timer_setting:
friendly_name: 设置延迟时间
icon: mdi:timer
input_number.timer_hour:
friendly_name: 时
icon: mdi:timer
input_number.timer_min:
friendly_name: 分
icon: mdi:timer
input_number.timer_sec:
friendly_name: 秒
icon: mdi:timer
# hidden: true
timer.timer:
friendly_name: 延迟倒计时
icon: mdi:timer
script.timer_start:
friendly_name: 开始倒计时
icon: mdi:timer
script.timer_cancel:
friendly_name: 取消倒计时
icon: mdi:timer-off
input_select:
timer_climate:
name: 延时关闭空调
options:
- Select Input
- 未定义1
- 未定义2
- 未定义3
- 未定义4
- 未定义5
initial: 'Select Input'
icon: mdi:format-list-checkbox #select-all #toggle-switch-off
timer_switch:
name: 延时关闭设备
options:
- Select Input
- 米家插座
- 未定义7
- 未定义8
- 未定义9
- 未定义0
initial: 'Select Input'
icon: mdi:format-list-checkbox #select-all #toggle-switch-off
timer_state:
name: 操作
options:
- 开
- 关
initial: '关'
icon: mdi:light-switch #nintendo-switch
sensor:
- platform: template
sensors:
timer_setting:
friendly_name: 'Time'
value_template: '{{ "%0.02d:%0.02d:%0.02d" | format(states("input_number.timer_hour") | int, states("input_number.timer_min") | int, states("input_number.timer_sec") | int) }}'
input_number:
timer_hour:
name: TimerHour
# icon: mdi:timer
# initial: 00
min: 0
max: 23
step: 1
timer_min:
name: TimerMinute
# icon: mdi:timer
# initial: 00
min: 0
max: 59
step: 1
timer_sec:
name: TimerSecond
# icon: mdi:timer
initial: 00
min: 0
max: 59
step: 1
timer:
timer:
duration: '00:00:00'
script:
timer_start:
sequence:
service: timer.start
data_template:
entity_id: timer.timer
duration: >
{{ states("sensor.timer_setting") }}
timer_cancel:
sequence:
service: timer.cancel
entity_id: timer.timer
group:
timer_switch:
control: hidden
name: 通用延时器
entities:
- input_select.timer_climate
- input_select.timer_switch
- input_select.timer_state
- sensor.timer_setting
- input_number.timer_hour
- input_number.timer_min
- input_number.timer_sec
- timer.timer
- script.timer_start
- script.timer_cancel
# binary_sensor:
# - platform: platform: state
# name: timer_climate
# entity_id: input_select.timer_climate
# payload_on: "Select Input"
# - platform: platform: state
# name: timer_switch
# entity_id: input_select.timer_switch
# payload_on: "Select Input"
automation:
- alias: number_timer
hide_entity: true
trigger:
- platform: state
entity_id: sensor.timer_setting
action:
service: timer.start
data_template:
entity_id: timer.timer
duration: >
{{ states("sensor.timer_setting") }}
- alias: empty_timer
hide_entity: true
trigger:
- platform: state
entity_id: input_select.timer_climate
- platform: state
entity_id: input_select.timer_switch
- platform: state
entity_id: input_select.timer_state
action:
- service: timer.cancel
entity_id: timer.timer
# - service: timer.start
# data_template:
# entity_id: timer.timer
# duration: >
# {{ states("sensor.timer_setting") }}
- alias: timer_climate_delay
hide_entity: true
trigger:
platform: event
event_type: timer.finished
event_data:
entity_id: timer.timer
action:
- service: climate.set_operation_mode
data_template:
entity_id: >-
{% if is_state("input_select.timer_climate", "未定义1") %}
climate.entity_id1
{% elif is_state("input_select.timer_climate", "未定义2") %}
climate.entity_id2
{% elif is_state("input_select.timer_climate", "未定义3") %}
climate.entity_id3
{% elif is_state("input_select.timer_climate", "未定义4") %}
climate.entity_id4
{% elif is_state("input_select.timer_climate", "未定义5") %}
climate.entity_id5
{% endif %}
operation_mode: '关闭'
- service: input_select.select_option
data:
entity_id: input_select.timer_climate
option: "Select Input"
- alias: timer_switch_turnon
hide_entity: true
trigger:
platform: event
event_type: timer.finished
event_data:
entity_id: timer.timer
condition:
condition: state
entity_id: input_select.timer_state
state: '开'
action:
- service: homeassistant.turn_on
data_template:
entity_id: >-
{% if is_state("input_select.timer_switch", "米家插座") %}
switch.mi_smart_wifi_socket
{% elif is_state("input_select.timer_switch", "未定义7") %}
switch.entity_id7
{% elif is_state("input_select.timer_switch", "未定义8") %}
switch.entity_id8
{% elif is_state("input_select.timer_switch", "未定义9") %}
switch.entity_id9
{% elif is_state("input_select.timer_switch", "未定义0") %}
switch.entity_id0
{% endif %}
- service: input_select.select_option
data:
entity_id: input_select.timer_switch
option: "Select Input"
- alias: timer_switch_turnoff
hide_entity: true
trigger:
platform: event
event_type: timer.finished
event_data:
entity_id: timer.timer
condition:
condition: state
entity_id: input_select.timer_state
state: '关'
action:
- service: homeassistant.turn_off
data_template:
entity_id: >-
{% if is_state("input_select.timer_switch", "米家插座") %}
switch.mi_smart_wifi_socket
{% elif is_state("input_select.timer_switch", "未定义7") %}
switch.entity_id7
{% elif is_state("input_select.timer_switch", "未定义8") %}
switch.entity_id8
{% elif is_state("input_select.timer_switch", "未定义9") %}
switch.entity_id9
{% elif is_state("input_select.timer_switch", "未定义0") %}
switch.entity_id0
{% endif %}
- service: input_select.select_option
data:
entity_id: input_select.timer_switch
option: "Select Input"
复制代码