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

 找回密码
 立即注册
查看: 5625|回复: 10

[已解决] 想通过Custom UI改一下Icon 颜色,无效,求助。

[复制链接]

17

主题

163

帖子

523

积分

高级会员

Rank: 4

积分
523
金钱
360
HASS币
0
发表于 2019-1-25 09:40:43 | 显示全部楼层 |阅读模式
本帖最后由 kenken 于 2019-1-25 12:29 编辑

根据大神的教程更改Icon,更改无效。rgb color或者 HS color的属性都设置上去了。但是Icon的颜色就是改不了不知道哪里出错了?HA的版本是0.85.1
https://bbs.hassbian.com/thread-2540-1-1.html

customize_glob:
    "*.*":
      custom_ui_state_card: state-card-custom-ui

    sensor.*:
      templates:
        rgb_color: if (state === 'home') return [50, 205, 50]; else return [255, 0, 0];
      custom_ui_state_card: state-card-custom-ui
    device_tracker.*:
      templates:
        hs_color: if (state === 'home') return '#EE1B2E'; else return '#ff1B2E';
      custom_ui_state_card: state-card-custom-ui
    switch.*:
      templates:
        hs_color: if (state === 'on') return [50, 205, 50]; else return [255, 0, 0];
      custom_ui_state_card: state-card-custom-ui
    automation.*:
      extra_data_template: >
        var t = attributes.last_triggered;
        if (t === null) {
          return '尚未触发' ;
        }else {
          var tt = new Date(t);
          var time = (tt.getMonth()+1) +'月'+tt.getDate()+'日 '+tt.getHours()+':'+(tt.getMinutes()<10?('0'+tt.getMinutes()):tt.getMinutes());
          return '上次触发:'+ time;
        }
      custom_ui_state_card: state-card-custom-ui


customizer:
  custom_ui: local
frontend:
  extra_html_url:
    - /local/custom_ui/state-card-custom-ui.html
  extra_html_url_es5:
    - /local/custom_ui/state-card-custom-ui-es5.html






捕获.PNG
回复

使用道具 举报

0

主题

140

帖子

418

积分

中级会员

Rank: 3Rank: 3

积分
418
金钱
278
HASS币
0
发表于 2019-1-25 11:19:28 | 显示全部楼层
我是新手路过,给你顶一下
回复

使用道具 举报

7

主题

1977

帖子

5675

积分

论坛元老

流水无味

Rank: 8Rank: 8

积分
5675
金钱
3698
HASS币
145

灌水之王

发表于 2019-1-25 11:22:30 | 显示全部楼层
应该是版本关系, HA升的太快了!  
custom_ui记得好想更新过一次
回复

使用道具 举报

17

主题

163

帖子

523

积分

高级会员

Rank: 4

积分
523
金钱
360
HASS币
0
 楼主| 发表于 2019-1-25 11:54:14 | 显示全部楼层
xieahui 发表于 2019-1-25 11:22
应该是版本关系, HA升的太快了!  
custom_ui记得好想更新过一次

那更新说明文档,或者像这种Custom UI的设置文档 再哪里可以查到伐? 很多东西都在猜。
回复

使用道具 举报

17

主题

163

帖子

523

积分

高级会员

Rank: 4

积分
523
金钱
360
HASS币
0
 楼主| 发表于 2019-1-25 12:28:40 | 显示全部楼层
自己解决了,我去看他的源代码,最后被我找到了 icon_color WeChat Screenshot_20190125122626.png

WeChat Screenshot_20190125122808.png
回复

使用道具 举报

17

主题

163

帖子

523

积分

高级会员

Rank: 4

积分
523
金钱
360
HASS币
0
 楼主| 发表于 2019-1-25 12:34:58 | 显示全部楼层
xieahui 发表于 2019-1-25 11:22
应该是版本关系, HA升的太快了!  
custom_ui记得好想更新过一次

找到参考的地方了,这么大的字没看到,自己填坑填了半天。

WeChat Screenshot_20190125123421.png
回复

使用道具 举报

7

主题

1977

帖子

5675

积分

论坛元老

流水无味

Rank: 8Rank: 8

积分
5675
金钱
3698
HASS币
145

灌水之王

发表于 2019-1-25 13:08:25 | 显示全部楼层
kenken 发表于 2019-1-25 12:34
找到参考的地方了,这么大的字没看到,自己填坑填了半天。


我没怎么弄Custom UI 说实话我也不会
回复

使用道具 举报

14

主题

659

帖子

3868

积分

论坛元老

Rank: 8Rank: 8

积分
3868
金钱
3204
HASS币
10
发表于 2019-1-25 22:25:41 | 显示全部楼层
建议转入 lovelace 更多的特性
回复

使用道具 举报

11

主题

324

帖子

1334

积分

金牌会员

Rank: 6Rank: 6

积分
1334
金钱
1010
HASS币
0
发表于 2019-2-5 23:23:43 | 显示全部楼层
哦哦 老大 具体讲一讲怎么弄的
回复

使用道具 举报

17

主题

163

帖子

523

积分

高级会员

Rank: 4

积分
523
金钱
360
HASS币
0
 楼主| 发表于 2019-2-11 08:34:12 | 显示全部楼层
wangyiyuan 发表于 2019-2-5 23:23
哦哦 老大 具体讲一讲怎么弄的

设置方法还是和 https://bbs.hassbian.com/thread-2540-1-1.html 一致, 只是把rgb_color 改为 icon_color 就好了
回复

使用道具 举报

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

本版积分规则

Archiver|手机版|小黑屋|Hassbian

GMT+8, 2024-5-19 22:42 , Processed in 1.084954 second(s), 35 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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