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

 找回密码
 立即注册
楼主: MX10085

[UI界面] 抄作业完成,HA彩平图UI

  [复制链接]

22

主题

319

帖子

3999

积分

论坛元老

Rank: 8Rank: 8

积分
3999
金钱
3675
HASS币
30
 楼主| 发表于 2024-9-10 09:33:16 | 显示全部楼层
hzdw11 发表于 2024-9-10 09:30
请问切换楼层是怎么实现的?

swipe card
回复

使用道具 举报

0

主题

35

帖子

172

积分

注册会员

Rank: 2

积分
172
金钱
137
HASS币
0
发表于 2024-9-10 09:35:19 | 显示全部楼层
太漂亮了。。。
回复

使用道具 举报

1

主题

36

帖子

383

积分

中级会员

Rank: 3Rank: 3

积分
383
金钱
347
HASS币
0
发表于 2024-9-10 11:04:55 | 显示全部楼层
好看啊,可惜不会写
回复

使用道具 举报

0

主题

8

帖子

62

积分

注册会员

Rank: 2

积分
62
金钱
54
HASS币
0
发表于 2024-9-10 23:18:40 | 显示全部楼层
本帖最后由 hzdw11 于 2024-9-11 08:22 编辑

我无法显示弹出卡片,出现一个灰色的框,是不是少了什么hacs插件?
回复

使用道具 举报

0

主题

20

帖子

85

积分

注册会员

Rank: 2

积分
85
金钱
65
HASS币
0
发表于 2024-9-11 22:58:54 | 显示全部楼层
真好看!!
回复

使用道具 举报

0

主题

8

帖子

62

积分

注册会员

Rank: 2

积分
62
金钱
54
HASS币
0
发表于 2024-9-12 14:49:00 | 显示全部楼层
大佬,能看一下你的template.yaml文件吗?有些自定传感器不会写
回复

使用道具 举报

22

主题

319

帖子

3999

积分

论坛元老

Rank: 8Rank: 8

积分
3999
金钱
3675
HASS币
30
 楼主| 发表于 2024-9-12 16:35:13 | 显示全部楼层
hzdw11 发表于 2024-9-12 14:49
大佬,能看一下你的template.yaml文件吗?有些自定传感器不会写

template:
    - sensor:
  ####################################################
  #                     灯光状态                      #
  ####################################################
        - unique_id: light_state
          state: >
              {% set lights = [
                states.light.yi_lou_ke_ting,
                states.light.yi_lou_fang_jian,
                states.light.yi_lou_fan_ting,
                states.light.ru_hu_zhao_ming,
                states.light.yi_lou_chu_fang,
                states.light.yi_lou_gong_wei,
                states.light.yi_lou_ti_jian,
                states.light.yi_lou_lou_ti,
                states.light.da_men_zhao_ming,
                states.light.er_lou_ti_tai,
                states.light.er_lou_ke_ting,
                states.light.er_lou_nan_fang,
                states.light.er_lou_bei_fang,
                states.light.er_lou_gong_wei,
                states.light.er_lou_lou_ti,
                states.light.er_lou_bei_yong,
                states.light.san_lou_ti_tai,
                states.light.san_lou_fang_jian,
                states.light.san_lou_gong_wei,
                states.light.san_lou_yang_tai,
                states.light.lumi_acn01_71fb_light
              ] %}

              {% set lights_on = lights | selectattr('state','eq','on') | list %}
              {% set lights_name = lights | selectattr('state','eq','on') | map(attribute='name') | join(', ') %}

              {% if (lights_on | length == 1) %}{{ lights_name }}点亮
              {% elif (lights_on | length > 1) %}{{ lights_on | length }}盏灯点亮
              {% else %} 全部关闭
              {% endif %}
          attributes:
            friendly_name: "灯光状态"

  ####################################################
  #                     树莓派                       #
  ####################################################
        - unique_id: pi01_temperature
          state: "{{ state_attr('sensor.rpi_monitor_raspberrypi_01', 'temp_cpu_c') }}"
          attributes:
            friendly_name: "CPU 温度"
            unit_of_measurement: "°C"
  
        - unique_id: pi02_temperature
          state: "{{ state_attr('sensor.rpi_monitor_raspberrypi_02', 'temp_cpu_c') }}"
          attributes:
            friendly_name: "CPU 温度"
            unit_of_measurement: "°C"
  
        - unique_id: pi03_temperature
          state: "{{ state_attr('sensor.rpi_monitor_raspberrypi_03', 'temp_cpu_c') }}"
          attributes:
            friendly_name: "CPU 温度"
            unit_of_measurement: "°C"
  
        - unique_id: pi04_temperature
          state: "{{ state_attr('sensor.rpi_monitor_raspberrypi_04', 'temp_cpu_c') }}"
          attributes:
            friendly_name: "CPU 温度"
            unit_of_measurement: "°C"

  ####################################################
  #                    涂鸦电表                       #
  ####################################################
        - unique_id: tuya01_dang_qian_dian_ya
          state: "{{ state_attr('switch.zong_biao_kai_guan', 'voltage') }}"
          attributes:
            friendly_name: "当前电压"
            unit_of_measurement: 'V'
  
        - unique_id: tuya01_dang_qian_dian_liu
          state: "{{ state_attr('switch.zong_biao_kai_guan', 'current') | float / 1000 | int(default='NaN') }}"
          availability: "{{ state_attr('switch.zong_biao_kai_guan', 'current') not in ['unavailable', 'unknown', 'none'] }}"
          attributes:
            friendly_name: "当前电流"
            unit_of_measurement: 'A'

        - unique_id: tuya01_dang_qian_gong_lu
          state: "{{ state_attr('switch.zong_biao_kai_guan', 'current_consumption') }}"
          attributes:
            friendly_name: "当前功率"
            unit_of_measurement: 'W'

        - unique_id: tuya01_zong_yong_dian_liang
          state: "{{ states('sensor.zong_biao_dian_liang') | float / 100 | int(default='NaN') }}"
          availability: "{{ states('sensor.zong_biao_dian_liang') not in ['unavailable', 'unknown', 'none'] }}"
          attributes:
            friendly_name: "总用电量"
            unit_of_measurement: 'kWh'

  ####################################################
  #                    米家设备                       #
  ####################################################
        - unique_id: vacuum_model
          state: "{{ state_attr('vacuum.viomi_v17_7e3e_robot_cleaner', 'model') }}"
          attributes:
            friendly_name: "机器型号"
  
        - unique_id: vacuum_sweep_type
          state: "{{ state_attr('vacuum.viomi_v17_7e3e_robot_cleaner', 'vacuum.sweep_type') }}"
          attributes:
            friendly_name: "扫地模式"
  
        - unique_id: vacuum_fan_speed
          state: "{{ state_attr('vacuum.viomi_v17_7e3e_robot_cleaner', 'fan_speed') }}"
          attributes:
            friendly_name: "风扇转速"
  
        - unique_id: mijia_dang_qian_dian_ya
          state: "{{ states('sensor.lxzn_cbcsmj_de47_voltage') | float / 10 | int(default='NaN') }}"
          availability: "{{ states('sensor.lxzn_cbcsmj_de47_voltage') not in ['unavailable', 'unknown', 'none'] }}"
          attributes:
            friendly_name: "当前电压"
            unit_of_measurement: 'V'
  
        - unique_id: mijia_dang_qian_dian_liu
          state: "{{ states('sensor.lxzn_cbcsmj_de47_electric_current') | float / 1000 | int(default='NaN') }}"
          availability: "{{ states('sensor.lxzn_cbcsmj_de47_electric_current') not in ['unavailable', 'unknown', 'none'] }}"
          attributes:
            friendly_name: "当前电流"
            unit_of_measurement: 'A'

        - unique_id: mijia_dang_qian_gong_lu
          state: >
            {% if states('sensor.lxzn_cbcsmj_de47_voltage')|is_number and
                  states('sensor.lxzn_cbcsmj_de47_electric_current')|is_number
            %}
              {{( states('sensor.lxzn_cbcsmj_de47_voltage') | float(0) * states('sensor.lxzn_cbcsmj_de47_electric_current') | float /10000) | round(2) }}
            {% else %}       
              {{ this.state }}
            {% endif %}
          attributes:
            friendly_name: "当前功率"
            unit_of_measurement: 'W'

  ####################################################
  #                    彩云天气                       #
  ####################################################
        - unique_id: weather_jia_forecast_hourly
          state: "{{ state_attr('weather.jia', 'forecast_hourly') }}"
          attributes:
            friendly_name: "彩云天气实况"
  
        - unique_id: weather_jia_forecast_minutely
          state: "{{ state_attr('weather.jia', 'forecast_minutely') }}"
          attributes:
            friendly_name: "彩云天气预测"
  
        - unique_id: weather_jia_hourly_cloudrate
          state: "{{ state_attr('weather.jia', 'hourly_cloudrate')[0]['value'] }}"
          attributes:
            friendly_name: "彩云天气云量"
  
        - unique_id: weather_jia_hourly_precipitation
          state: "{{ state_attr('weather.jia', 'hourly_precipitation')[0]['value'] }}"
          attributes:
            friendly_name: "彩云天气降水"
  
  ####################################################
  #                    和风天气                       #
  ####################################################
        - unique_id: weather_tianqi_condition_cn
          state: "{{ state_attr('weather.tian_qi', 'condition_cn') }}"
          attributes:
            friendly_name: "和风天气"

        - unique_id: weather_tianqi_temperature
          state: "{{ state_attr('weather.tian_qi', 'temperature') }}"
          attributes:
            friendly_name: "和风天气温度"

        - unique_id: weather_tianqi_humidity
          state: "{{ state_attr('weather.tian_qi', 'humidity') }}"
          attributes:
            friendly_name: "和风天气湿度"

        - unique_id: weather_tianqi_forecast_minutely
          state: "{{ state_attr('weather.tian_qi', 'forecast_minutely') }}"
          attributes:
            friendly_name: "和风天气实况"

        - unique_id: weather_tianqi_forecast_hourly
          state: "{{ state_attr('weather.tian_qi', 'forecast_hourly') }}"
          attributes:
            friendly_name: "和风天气预测"
  
        - unique_id: weather_tianqi_hourly_forecast_cloudy
          state: "{{ state_attr('weather.tian_qi', 'hourly_forecast')[0]['cloudy'] }}"
          attributes:
            friendly_name: "和风天气云量"
  
        - unique_id: weather_tianqi_hourly_forecast_precipitation
          state: "{{ state_attr('weather.tian_qi', 'hourly_forecast')[0]['precipitation'] }}"
          attributes:
            friendly_name: "和风天气降水"

        - name: 一小时天气预警
          state: '{% if ("雨" in states.weather.tian_qi.attributes.hourly_forecast[0].text) %}{{states.weather.tian_qi.attributes.hourly_forecast[0].datetime}}降雨概率为:{{states.weather.tian_qi.attributes.hourly_forecast[0].probable_precipitation}}%,可能{{states.weather.tian_qi.attributes.hourly_forecast[0].text}},请多加注意!{% else %}未来一小时无不良天气{% endif %}'
        - name: 自然灾害预警最新一条
          state: '{% if (states.weather.tian_qi.attributes.warning) %}{{ states.weather.tian_qi.attributes.warning[0].pubTime}}{% else %}当前无自然灾害预警信息{% endif %}'
          attributes:
            title: "{% if (states.weather.tian_qi.attributes.warning) %}{{ states.weather.tian_qi.attributes.warning[0].title}} {% else %}null{% endif %}"
            text: "{% if (states.weather.tian_qi.attributes.warning) %}{{ states.weather.tian_qi.attributes.warning[0].text }} {% else %}null{% endif %}"
            pubTime: "{% if (states.weather.tian_qi.attributes.warning) %}{{ states.weather.tian_qi.attributes.warning[0].pubTime}} {% else %}null{% endif %}"
            startTime: "{% if (states.weather.tian_qi.attributes.warning) %}{{ states.weather.tian_qi.attributes.warning[0].startTime}} {% else %}null{% endif %}"
            endTime: "{% if (states.weather.tian_qi.attributes.warning) %}{{ states.weather.tian_qi.attributes.warning[0].endTime}} {% else %}null{% endif %}"
            sender: "{% if (states.weather.tian_qi.attributes.warning) %}{{ states.weather.tian_qi.attributes.warning[0].sender}} {% else %}null{% endif %}"
            severity: "{% if (states.weather.tian_qi.attributes.warning) %}{{ states.weather.tian_qi.attributes.warning[0].severity}} {% else %}null{% endif %}"
            severityColor: "{% if (states.weather.tian_qi.attributes.warning) %}{{ states.weather.tian_qi.attributes.warning[0].severityColor}} {% else %}null{% endif %}"
            level: "{% if (states.weather.tian_qi.attributes.warning) %}{{ states.weather.tian_qi.attributes.warning[0].level}} {% else %}null{% endif %}"
            typeName: "{% if (states.weather.tian_qi.attributes.warning) %}{{ states.weather.tian_qi.attributes.warning[0].typeName}} {% else %}null{% endif %}"
            all: "{% if (states.weather.tian_qi.attributes.warning) %}{{ states.weather.tian_qi.attributes.warning}} {% else %}null{% endif %}"

 
回复

使用道具 举报

7

主题

41

帖子

321

积分

中级会员

Rank: 3Rank: 3

积分
321
金钱
280
HASS币
0
发表于 2024-9-20 21:56:28 | 显示全部楼层
楼主,你做的真好看。能不能分享一下人在传感器和窗帘的图标?
回复

使用道具 举报

22

主题

319

帖子

3999

积分

论坛元老

Rank: 8Rank: 8

积分
3999
金钱
3675
HASS币
30
 楼主| 发表于 2024-9-20 22:31:22 | 显示全部楼层
kuki 发表于 2024-9-20 21:56
楼主,你做的真好看。能不能分享一下人在传感器和窗帘的图标?

已上传到一楼
回复

使用道具 举报

7

主题

41

帖子

321

积分

中级会员

Rank: 3Rank: 3

积分
321
金钱
280
HASS币
0
发表于 2024-9-20 23:15:58 | 显示全部楼层

感谢,大佬
回复

使用道具 举报

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

本版积分规则

Archiver|手机版|小黑屋|Hassbian

GMT+8, 2025-1-1 21:56 , Processed in 0.056589 second(s), 30 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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