本帖最后由 jyz_0501 于 2022-12-1 15:22 编辑
一个小玩意,解决选择困难症,可以提前把你的日常饮食清单放入相应的列表(input_select)中,然后会随机在表中提取食品供你选择
后期可以通过 restapi 从某些网站生成而不需要自己自备清单,那就是真正随机了,不过可要考虑好自己口袋里的money是不是充足,
也可以,组合生成,不分早中晚,直接把所有菜品放在一个 列表里,然后随机选择N个进行通知,这样随机出来的菜单就丰富了.
alias: 今天吃什么?
description: ""
trigger: #三个时间点,分别标记了早餐,午餐,晚餐的触发id
- platform: time
at: "7:30:00"
id: zaocan
- platform: time
at: "11:12:00"
id: wucan
- platform: time
id: wancan
at: "17:20:12"
condition: []
action:
- choose:
- conditions:
- condition: trigger #到了早餐时间点的时候,触发早餐动作
id: zaocan
sequence:
- service: input_select.select_option #调用此服务更改早餐种类的值
target:
entity_id: input_select.zao_can_zhong_lei
data:
option: >-
{{ state_attr('input_select.zao_can_zhong_lei',
'options')|reject('in',
[states('input_select.zao_can_zhong_lei'), 'zaocan']) | list |
random }} #给早餐种类的值进行随机化
- service: notify.mobile_app_iphone14pro #
data: #将上面随机后的值进行通知提醒
message: 今天早上吃 {{ (states.input_select.zao_can_zhong_lei.state) }}怎么样?
- conditions:
- condition: trigger
id: wucan
sequence:
- service: input_select.select_option
target:
entity_id: input_select.wu_can_zhong_lei
data:
option: >-
{{ state_attr('input_select.wu_can_zhong_lei',
'options')|reject('in',
[states('input_select.wu_can_zhong_lei'), 'wucan']) | list |
random }}
- service: notify.mobile_app_iphone14pro
data:
message: 今天中午吃 {{ (states.input_select.wu_can_zhong_lei.state) }}怎么样?
- conditions:
- condition: trigger
id: wancan
sequence:
- service: input_select.select_option
target:
entity_id: input_select.wan_can_zhong_lei
data_template:
option: >-
{{ state_attr('input_select.wan_can_zhong_lei',
'options')|reject('in',
[states('input_select.wan_can_zhong_lei'), 'wancan']) | list |
random }}
- service: notify.mobile_app_iphone14pro
data:
message: 今天晚餐吃 {{ (states.input_select.wan_can_zhong_lei.state) }}怎么样?
mode: single
|