- 积分
- 281
- 金钱
- 195
- 威望
- 0
- 贡献
- 0
- HASS币
- 0
中级会员
- 积分
- 281
- 金钱
- 195
- HASS币
- 0
|
代码如下:
#灯光分区
sensor:
- platform: template
sensors:
0louceng_light_on: #一楼区域
value_template: >-
{% set light = [
states.light.0ke_ting_yi_lou_fan_ting_diao_deng,
states.light.0ke_ting_yi_lou_fan_ting_tong_deng,
states.light.0ke_ting_yi_lou_ke_ting_deng_dai,
states.light.0ke_ting_yi_lou_ke_ting_tong_deng,
states.light.0ke_ting_yi_lou_ke_ting_xi_ding_deng,
states.light.0ke_ting_yi_lou_lou_ti_deng_dai,
states.light.0ke_ting_yi_lou_lou_ti_tong_deng,
states.light.0ke_ting_yi_lou_xuan_guan_tong_deng,
states.light.0ke_ting_yi_lou_xuan_guan_yi_ju_tong_deng,
states.light.0zhu_wo_yi_lou_zhu_wo_deng_dai,
states.light.0zhu_wo_yi_lou_zhu_wo_tong_deng,
states.light.0zhu_wo_yi_lou_zhu_wo_xi_ding_deng,
states.light.0zhu_wo_yi_lou_zhu_wo_you_bi_deng,
states.light.0zhu_wo_yi_lou_zhu_wo_zuo_bi_deng,
states.light.0ci_wo_yi_lou_ci_wo_deng_dai,
states.light.0ci_wo_yi_lou_ci_wo_tong_deng,
states.light.0ci_wo_yi_lou_ci_wo_xi_ding_deng,
states.light.0yi_mao_jian_yi_lou_yi_mao_jian_tong_deng,
states.light.0yi_mao_jian_yi_lou_yi_mao_jian_xi_ding_deng,
states.light.0wei_sheng_jian_yi_lou_wei_sheng_jian_men_kou_tong_deng,
states.light.0wei_sheng_jian_yi_lou_wei_sheng_jian_shu_zhuang_deng,
states.light.0wei_sheng_jian_yi_lou_wei_sheng_jian_xi_ding_deng,
] %}
{% set light_on = light | selectattr('state','eq','on') | list %}
{{light_on | length}}
0keting_light_on:
value_template: >-
{% set light = [
states.light.0ke_ting_yi_lou_fan_ting_diao_deng,
states.light.0ke_ting_yi_lou_fan_ting_tong_deng,
states.light.0ke_ting_yi_lou_ke_ting_deng_dai,
states.light.0ke_ting_yi_lou_ke_ting_tong_deng,
states.light.0ke_ting_yi_lou_ke_ting_xi_ding_deng,
states.light.0ke_ting_yi_lou_lou_ti_deng_dai,
states.light.0ke_ting_yi_lou_lou_ti_tong_deng,
states.light.0ke_ting_yi_lou_xuan_guan_tong_deng,
states.light.0ke_ting_yi_lou_xuan_guan_yi_ju_tong_deng,
] %}
{% set light_on = light | selectattr('state','eq','on') | list %}
{{light_on | length}}
0zhuwo_light_on:
value_template: >-
{% set light = [
states.light.0zhu_wo_yi_lou_zhu_wo_deng_dai,
states.light.0zhu_wo_yi_lou_zhu_wo_tong_deng,
states.light.0zhu_wo_yi_lou_zhu_wo_xi_ding_deng,
states.light.0zhu_wo_yi_lou_zhu_wo_you_bi_deng,
states.light.0zhu_wo_yi_lou_zhu_wo_zuo_bi_deng,
] %}
{% set light_on = light | selectattr('state','eq','on') | list %}
{{light_on | length}}
0ciwo_light_on:
value_template: >-
{% set light = [
states.light.0ci_wo_yi_lou_ci_wo_deng_dai,
states.light.0ci_wo_yi_lou_ci_wo_tong_deng,
states.light.0ci_wo_yi_lou_ci_wo_xi_ding_deng,
] %}
{% set light_on = light | selectattr('state','eq','on') | list %}
{{light_on | length}}
0yimaojian_light_on:
value_template: >-
{% set light = [
states.light.0yi_mao_jian_yi_lou_yi_mao_jian_tong_deng,
states.light.0yi_mao_jian_yi_lou_yi_mao_jian_xi_ding_deng,
] %}
{% set light_on = light | selectattr('state','eq','on') | list %}
{{light_on | length}}
0weishengjian_light_on:
value_template: >-
{% set light = [
states.light.0wei_sheng_jian_yi_lou_wei_sheng_jian_men_kou_tong_deng,
states.light.0wei_sheng_jian_yi_lou_wei_sheng_jian_shu_zhuang_deng,
states.light.0wei_sheng_jian_yi_lou_wei_sheng_jian_xi_ding_deng,
] %}
{% set light_on = light | selectattr('state','eq','on') | list %}
{{light_on | length}}
1louceng_light_on: #负一区域
value_template: >-
{% set light = [
states.light.1ke_ting_fu_yi_chu_fang_deng_dai,
states.light.1ke_ting_fu_yi_chu_fang_tong_deng,
states.light.1ke_ting_fu_yi_chu_wu_jian_xi_ding_deng,
states.light.1ke_ting_fu_yi_ke_ting_deng_dai,
states.light.1ke_ting_fu_yi_ke_ting_tong_deng,
states.light.1ke_ting_fu_yi_ke_ting_xi_ding_deng,
states.light.1ke_ting_fu_yi_yuan_cha_zuo_jia_liang_ting,
states.light.1ke_ting_fu_yi_yuan_men_kou_deng,
states.light.1zhu_wo_fu_yi_zhu_wo_deng_dai,
states.light.1zhu_wo_fu_yi_zhu_wo_tong_deng,
states.light.1zhu_wo_fu_yi_zhu_wo_xi_ding_deng,
states.light.1zhu_wo_fu_yi_zhu_wo_you_bi_deng,
states.light.1zhu_wo_fu_yi_zhu_wo_zuo_bi_deng,
states.light.1ci_wo_fu_yi_ci_wo_deng_dai,
states.light.1ci_wo_fu_yi_ci_wo_tong_deng,
states.light.1ci_wo_fu_yi_ci_wo_xi_ding_deng,
states.light.1shu_fang_fu_yi_shu_fang_deng_dai,
states.light.1shu_fang_fu_yi_shu_fang_tong_deng,
states.light.1shu_fang_fu_yi_shu_fang_xi_ding_deng,
states.light.1wei_sheng_jian_fu_yi_wei_sheng_jian_lin_yu_deng,
states.light.1wei_sheng_jian_fu_yi_wei_sheng_jian_men_kou_tong_deng,
states.light.1wei_sheng_jian_fu_yi_wei_sheng_jian_zhu_deng,
] %}
{% set light_on = light | selectattr('state','eq','on') | list %}
{{light_on | length}}
1keting_light_on:
value_template: >-
{% set light = [
states.light.1ke_ting_fu_yi_chu_fang_deng_dai,
states.light.1ke_ting_fu_yi_chu_fang_tong_deng,
states.light.1ke_ting_fu_yi_chu_wu_jian_xi_ding_deng,
states.light.1ke_ting_fu_yi_ke_ting_deng_dai,
states.light.1ke_ting_fu_yi_ke_ting_tong_deng,
states.light.1ke_ting_fu_yi_ke_ting_xi_ding_deng,
states.light.1ke_ting_fu_yi_yuan_cha_zuo_jia_liang_ting,
states.light.1ke_ting_fu_yi_yuan_men_kou_deng,
] %}
{% set light_on = light | selectattr('state','eq','on') | list %}
{{light_on | length}}
1zhuwo_light_on:
value_template: >-
{% set light = [
states.light.1zhu_wo_fu_yi_zhu_wo_deng_dai,
states.light.1zhu_wo_fu_yi_zhu_wo_tong_deng,
states.light.1zhu_wo_fu_yi_zhu_wo_xi_ding_deng,
states.light.1zhu_wo_fu_yi_zhu_wo_you_bi_deng,
states.light.1zhu_wo_fu_yi_zhu_wo_zuo_bi_deng,
] %}
{% set light_on = light | selectattr('state','eq','on') | list %}
{{light_on | length}}
1ciwo_light_on:
value_template: >-
{% set light = [
states.light.1ci_wo_fu_yi_ci_wo_deng_dai,
states.light.1ci_wo_fu_yi_ci_wo_tong_deng,
states.light.1ci_wo_fu_yi_ci_wo_xi_ding_deng,
] %}
{% set light_on = light | selectattr('state','eq','on') | list %}
{{light_on | length}}
1shufang_light_on:
value_template: >-
{% set light = [
states.light.1shu_fang_fu_yi_shu_fang_deng_dai,
states.light.1shu_fang_fu_yi_shu_fang_tong_deng,
states.light.1shu_fang_fu_yi_shu_fang_xi_ding_deng,
] %}
{% set light_on = light | selectattr('state','eq','on') | list %}
{{light_on | length}}
1weishengjian_light_on:
value_template: >-
{% set light = [
states.light.1wei_sheng_jian_fu_yi_wei_sheng_jian_lin_yu_deng,
states.light.1wei_sheng_jian_fu_yi_wei_sheng_jian_men_kou_tong_deng,
states.light.1wei_sheng_jian_fu_yi_wei_sheng_jian_zhu_deng,
] %}
{% set light_on = light | selectattr('state','eq','on') | list %}
{{light_on | length}}
2louceng_light_on: #负二区域
value_template: >-
{% set light = [
states.light.2ke_ting_fu_er_ju_ti_deng_dai,
states.light.2ke_ting_fu_er_jiu_ju_deng_dai,
states.light.2ke_ting_fu_er_ke_ting_bian_tong_deng,
states.light.2ke_ting_fu_er_ke_ting_ding_deng_dai,
states.light.2ke_ting_fu_er_ke_ting_zhong_jian_tong_deng,
states.light.2ke_ting_fu_er_lou_ti_xi_ding_deng,
states.light.2yu_le_jian_fu_er_yu_le_jian_deng_dai,
states.light.2yu_le_jian_fu_er_yu_le_jian_tong_deng,
states.light.2yu_le_jian_fu_er_yu_le_jian_xi_ding_deng,
states.light.2ke_ting_fu_er_jian_shen_qu_deng_dai,
states.light.2ke_ting_fu_er_jian_shen_qu_tong_deng,
states.light.2ke_ting_fu_er_ta_ta_mi_tong_deng,
states.light.2chu_wu_jian_fu_er_chu_wu_jian_tong_deng,
states.light.2wei_sheng_jian_fu_er_wei_sheng_jian_nei_deng_dai,
states.light.2wei_sheng_jian_fu_er_wei_sheng_jian_wai_tong_deng,
] %}
{% set light_on = light | selectattr('state','eq','on') | list %}
{{light_on | length}}
2keting_light_on:
value_template: >-
{% set light = [
states.light.2ke_ting_fu_er_ju_ti_deng_dai,
states.light.2ke_ting_fu_er_jiu_ju_deng_dai,
states.light.2ke_ting_fu_er_ke_ting_bian_tong_deng,
states.light.2ke_ting_fu_er_ke_ting_ding_deng_dai,
states.light.2ke_ting_fu_er_ke_ting_zhong_jian_tong_deng,
states.light.2ke_ting_fu_er_lou_ti_xi_ding_deng,
] %}
{% set light_on = light | selectattr('state','eq','on') | list %}
{{light_on | length}}
2yulejian_light_on:
value_template: >-
{% set light = [
states.light.2yu_le_jian_fu_er_yu_le_jian_deng_dai,
states.light.2yu_le_jian_fu_er_yu_le_jian_tong_deng,
states.light.2yu_le_jian_fu_er_yu_le_jian_xi_ding_deng,
] %}
{% set light_on = light | selectattr('state','eq','on') | list %}
{{light_on | length}}
2jianshenqu_light_on:
value_template: >-
{% set light = [
states.light.2ke_ting_fu_er_jian_shen_qu_deng_dai,
states.light.2ke_ting_fu_er_jian_shen_qu_tong_deng,
states.light.2ke_ting_fu_er_ta_ta_mi_tong_deng,
] %}
{% set light_on = light | selectattr('state','eq','on') | list %}
{{light_on | length}}
2chuwujian_light_on:
value_template: >-
{% set light = [
states.light.2chu_wu_jian_fu_er_chu_wu_jian_tong_deng,
] %}
{% set light_on = light | selectattr('state','eq','on') | list %}
{{light_on | length}}
2weishengjian_light_on:
value_template: >-
{% set light = [
states.light.2wei_sheng_jian_fu_er_wei_sheng_jian_nei_deng_dai,
states.light.2wei_sheng_jian_fu_er_wei_sheng_jian_wai_tong_deng,
] %}
{% set light_on = light | selectattr('state','eq','on') | list %}
{{light_on | length}}
|
|