『瀚思彼岸』» 智能家居技术论坛

 找回密码
 立即注册
查看: 5193|回复: 2

[技术探讨] 倒计时packages检查配置报错

[复制链接]

31

主题

531

帖子

2463

积分

金牌会员

Rank: 6Rank: 6

积分
2463
金钱
1927
HASS币
20
发表于 2018-12-12 22:24:55 | 显示全部楼层 |阅读模式
本帖最后由 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"

回复

使用道具 举报

0

主题

39

帖子

130

积分

注册会员

Rank: 2

积分
130
金钱
91
HASS币
0
发表于 2019-4-22 16:42:32 | 显示全部楼层
请问你最后怎么解决的这个问题?
回复

使用道具 举报

31

主题

531

帖子

2463

积分

金牌会员

Rank: 6Rank: 6

积分
2463
金钱
1927
HASS币
20
 楼主| 发表于 2019-4-22 17:00:51 | 显示全部楼层
xiatian 发表于 2019-4-22 16:42
请问你最后怎么解决的这个问题?

include 语句的位置有问题
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|Hassbian

GMT+8, 2024-11-24 23:00 , Processed in 0.067370 second(s), 24 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表