1uv_can 发表于 2024-4-2 23:27:29

插眼,待后续实验一番,666

明明洋洋 发表于 2024-4-3 09:12:00

benlky 发表于 2024-4-2 22:54
你发的图片吗? 一直无法加载出来

我用附件你看看这样呢,选择卡片有了,仪表盘里面的代码有哪里需要改吗

creazycar 发表于 2024-4-3 09:13:12

- type: custom:button-card
    name: |
      [[[
      if (states['switch.isa_kg_middle_switch_service'].state === 'on' && states['switch.isa_kg_right_switch_service'].state === 'on') {
          return `<div style='overflow: hidden; white-space: nowrap; width: 100%; color: #C0C0C0; font-weight: bold; font-size: 9px;'><marquee>滚动消息</marquee></div>`;
      } else {
          return '';
      }
      ]]]
    style:
      top: 38%
      left: 64%
      width: 10%
      opacity: 100
      background-color: transparent
      '--ha-card-background': transparent
      '--ha-card-border-color': transparent

benlky 发表于 2024-4-3 10:26:25

明明洋洋 发表于 2024-4-3 09:12
我用附件你看看这样呢,选择卡片有了,仪表盘里面的代码有哪里需要改吗 ...

是报什么错吗?

明明洋洋 发表于 2024-4-3 10:28:26

benlky 发表于 2024-4-3 10:26
是报什么错吗?

没有明显的报错,但是js页面这种应该是不对的吧,显示代码了。而且怎么用起来呢,你可以放一下你的效果图看看吗

benlky 发表于 2024-4-3 10:39:37

creazycar 发表于 2024-4-3 09:13
- type: custom:button-card
    name: |
      [[[


这样不能动态提示如: “家里几盏灯开着”之类的吧。你这是当某个开关被打开了,固定显示“滚动消息” 几个字吧

benlky 发表于 2024-4-3 10:42:54

明明洋洋 发表于 2024-4-3 10:28
没有明显的报错,但是js页面这种应该是不对的吧,显示代码了。而且怎么用起来呢,你可以放一下你的效果图 ...



我的效果是这样的,可以实时显示开了几盏灯

明明洋洋 发表于 2024-4-3 10:53:34

benlky 发表于 2024-4-3 10:42
我的效果是这样的,可以实时显示开了几盏灯

那你看我这是哪里没整对呢

benlky 发表于 2024-4-3 10:58:48

明明洋洋 发表于 2024-4-3 10:53
那你看我这是哪里没整对呢

请确认以下:
1.*.js 放在www 文件下
2. 在资源里面添加了相应的路劲
3. 在configuration.yaml 里面定义了实体

使用方法是:

- type: custom:scrolling-test-card
entity: input_text.scrolling_text

creazycar 发表于 2024-4-3 11:18:16

benlky 发表于 2024-4-3 10:39
这样不能动态提示如: “家里几盏灯开着”之类的吧。你这是当某个开关被打开了,固定显示“滚动消息” 几 ...

- type: custom:button-card
name: >
    [[[ return `<div style='overflow: hidden; white-space: nowrap; width: 300%; color: red; font-weight: bold;'><marquee>${states['sensor.xxxxx'].state}</marquee></div>` ]]]
style:
    top: 8%
    left: 18%
    width: 16%
    opacity: 100
    background-color: transparent
    '--ha-card-background': transparent
    '--ha-card-border-color': transparent
页: 1 [2] 3
查看完整版本: 滚动栏消息