透過Home Assistant實做魚缸的監控與輔助管理之四:操作介面

因篇幅關係,拆成以下幾篇易於閱讀。

我在Home Assistant中整整開了一頁,滿滿四大欄,這是一開始沒意料到的。

魚缸的右側有一支監視器可以看缸內的狀況,魚缸上方也有一支看背濾的狀況,另一支是本來就有的,剛好會拍到魚缸的位置。

type: vertical-stack
title: 攝影機
cards:
  - type: picture-glance
    camera_view: auto
    title: 魚缸
    entities:
      - entity: binary_sensor.tapo_c110_aquatank_all_occupancy
        icon: mdi:fish
    camera_image: camera.tapo_c110_aquatank
  - type: picture-glance
    camera_view: auto
    title: 過濾
    entities:
      - entity: binary_sensor.tapo_c110_aquafilter_all_occupancy
        icon: mdi:fish
    camera_image: camera.tapo_c110_aquafilter
  - type: picture-glance
    camera_view: auto
    title: 全景
    entities:
      - entity: binary_sensor.foscam_c2m_restaurant_motion
        icon: mdi:fish
    camera_image: camera.foscam_c2m_restaurant

這裡放的是感應器的數值及圖表

  • ESP32佔很大篇幅,但重點在看線上狀態以及最後更新時間,如果ESP32是活著的話,每60秒會拋出一個heartbeat的訊號。
  • 主缸水溫趨勢圖,左邊的數字是當下的水溫,右邊是一小時溫差。
  • 補水桶水溫趨勢圖,左邊的數字是當下的水溫,右邊是補水桶與主缸的溫差。
  • TDS與pH趨勢圖,左邊都是數值,右邊是一小時平均。
  • 水位高度只要不正常就是用粉紅色標示,因為截圖當下正在換水所以不太正常。
type: vertical-stack
title: 環境監控
cards:
  - type: entities
    entities:
      - type: custom:button-card
        card_mod:
          style: |
            ha-card {             
              border-radius: 0;
            }
        entity: device_tracker.093_a340
        aspect_ratio: 2.5/1
        show_entity_picture: true
        entity_picture: /local/image/esp32.png
        name: ESP32 Main
        styles:
          card:
            - font-size: 14px
            - padding: 0% 3% 3% 3%
          grid:
            - grid-template-areas: "\"n track\" \"i uptime\" \"i heartbeat\" \"i ip\" \"i mac\""
            - grid-template-columns: 2fr 3fr
            - grid-template-rows: 2fr 1fr 1fr 1fr 1fr
          img_cell:
            - justify-content: middle
          icon:
            - width: 110%
          name:
            - font-weight: bold
            - color: blue
            - justify-self: start
            - font-size: 18px
          custom_fields:
            track:
              - font-weight: bold
              - color: red
              - justify-self: end
              - font-size: 18px
            uptime:
              - justify-self: end
            heartbeat:
              - justify-self: end
            ip:
              - justify-self: end
            mac:
              - justify-self: end
        custom_fields:
          track: |
            [[[
              if (entity.state == 'home') return '線上';
              else return '離線';
            ]]]
          uptime: |
            [[[ 
              return '已運作 ' + Math.round(states['sensor.aquarium_esp32_heartbeat_main'].state*100/60)/100 + ' 小時';
            ]]]
          heartbeat: |
            [[[
              var last_update = new Date(states['sensor.aquarium_esp32_heartbeat_main'].last_updated);
              var current_time = new Date();
              var diff = Math.round((current_time - last_update) / 1000);
              return '最後更新 ' + diff + ' 秒前';
            ]]]
          ip: |
            [[[ 
              return 'LAN ' + entity.attributes.ip;
            ]]]
          mac: |
            [[[ 
              return 'MAC ' + entity.attributes.mac.toUpperCase();;
            ]]]
      - type: custom:button-card
        card_mod:
          style: |
            ha-card {             
              border-radius: 0;
            }
        entity: device_tracker.094_ebdc
        aspect_ratio: 2.5/1
        show_entity_picture: true
        entity_picture: /local/image/esp32.png
        name: ESP32 Sub
        styles:
          card:
            - font-size: 14px
            - padding: 0% 3% 3% 3%
          grid:
            - grid-template-areas: "\"n track\" \"i uptime\" \"i heartbeat\" \"i ip\" \"i mac\""
            - grid-template-columns: 2fr 3fr
            - grid-template-rows: 2fr 1fr 1fr 1fr 1fr
          img_cell:
            - justify-content: middle
          icon:
            - width: 110%
          name:
            - font-weight: bold
            - color: blue
            - justify-self: start
            - font-size: 18px
          custom_fields:
            track:
              - font-weight: bold
              - color: red
              - justify-self: end
              - font-size: 18px
            uptime:
              - justify-self: end
            heartbeat:
              - justify-self: end
            ip:
              - justify-self: end
            mac:
              - justify-self: end
        custom_fields:
          track: |
            [[[
              if (entity.state == 'home') return '線上';
              else return '離線';
            ]]]
          uptime: |
            [[[ 
              return '已運作 ' + Math.round(states['sensor.aquarium_esp32_heartbeat_sub'].state*100/60)/100 + ' 小時';
            ]]]
          heartbeat: |
            [[[
              var last_update = new Date(states['sensor.aquarium_esp32_heartbeat_sub'].last_updated);
              var current_time = new Date();
              var diff = Math.round((current_time - last_update) / 1000);
              return '最後更新 ' + diff + ' 秒前';
            ]]]
          ip: |
            [[[ 
              return 'LAN ' + entity.attributes.ip;
            ]]]
          mac: |
            [[[ 
              return 'MAC ' + entity.attributes.mac.toUpperCase();;
            ]]]
      - type: section
        label: 水質監測
      - type: custom:vertical-stack-in-card
        card_mod:
          style: |
            ha-card {             
              border: 0;
              border-radius: 0;
            }
        cards:
          - type: custom:vertical-stack-in-card
            horizontal: true
            card_mod:
              style: |
                ha-card {             
                  border-radius: 0;
                }
            cards:
              - type: custom:mini-graph-card
                entities:
                  - entity: sensor.aquarium_maintank_watertemperature_rendering
                    name: 主缸水溫
                    color: lightsalmon
                  - entity: sensor.aquarium_maintank_watertemperature_1hr_range
                    color: brown
                    show_state: true
                    show_fill: false
                    y_axis: secondary
                font_size_header: 12
                font_size: 50
                hours_to_show: 24
                points_per_hour: 6
                line_width: 1
                height: 150
                show:
                  icon: false
                  legend: false
              - type: custom:mini-graph-card
                entities:
                  - entity: sensor.aquarium_bucket_watertemperature_rendering
                    name: 補水桶水溫
                    color: dodgerblue
                  - entity: sensor.aquarium_watertemperature_gap
                    color: brown
                    show_state: true
                    show_fill: false
                    y_axis: secondary
                font_size_header: 12
                font_size: 50
                hours_to_show: 24
                points_per_hour: 6
                line_width: 1
                height: 150
                show:
                  icon: false
                  legend: false
          - type: custom:vertical-stack-in-card
            horizontal: true
            card_mod:
              style: |
                ha-card {             
                  border-radius: 0;
                }
            cards:
              - type: custom:mini-graph-card
                entities:
                  - entity: sensor.aquarium_maintank_tds_rendering
                    name: TDS
                    color: lightsalmon
                  - entity: sensor.aquarium_tds_average_1hr
                    color: brown
                    show_state: true
                    show_fill: false
                font_size_header: 12
                font_size: 50
                hours_to_show: 24
                points_per_hour: 6
                line_width: 1
                height: 150
                show:
                  icon: false
                  legend: false
              - type: custom:mini-graph-card
                entities:
                  - entity: sensor.aquarium_maintank_ph_rendering
                    name: pH
                    color: dodgerblue
                  - entity: sensor.aquarium_ph_average_1hr
                    color: brown
                    show_state: true
                    show_fill: false
                font_size_header: 12
                font_size: 50
                hours_to_show: 24
                points_per_hour: 6
                line_width: 1
                height: 150
                show:
                  icon: false
                  legend: false
      - type: section
        label: 水位偵測
      - type: custom:vertical-stack-in-card
        card_mod:
          style: |
            ha-card {             
              border: 0;
              border-radius: 0;
            }
        cards:
          - type: custom:vertical-stack-in-card
            horizontal: true
            card_mod:
              style: |
                ha-card {             
                  border-radius: 0;
                }
            cards:
              - type: custom:bar-card
                name: 主缸
                entity: input_number.aquarium_maintank_waterlevel
                positions:
                  icon: "off"
                  indicator: "off"
                  name: outside
                direction: up
                height: 75px
                width: 50%
                max: 2
                min: -1
                color: Pink
                severity:
                  - color: lightblue
                    from: -0.1
                    to: 0.1
                card_mod:
                  style: |
                    bar-card-backgroundbar {
                              background: rgba(255,255,255,0.4);
                            }
              - type: custom:bar-card
                name: 濾材
                entity: input_number.aquarium_filtertank_waterlevel
                positions:
                  icon: "off"
                  indicator: "off"
                  name: outside
                direction: up
                height: 75px
                width: 50%
                max: 2
                min: -1
                color: Pink
                severity:
                  - color: lightblue
                    from: 1.9
                    to: 2.1
                card_mod:
                  style: |
                    bar-card-backgroundbar {
                              background: rgba(255,255,255,0.4);
                            }
              - type: custom:bar-card
                name: 馬達
                entity: input_number.aquarium_pumptank_waterlevel
                positions:
                  icon: "off"
                  indicator: "off"
                  name: outside
                direction: up
                height: 75px
                width: 50%
                max: 2
                min: -1
                color: Pink
                severity:
                  - color: lightblue
                    from: 0.9
                    to: 1.1
                card_mod:
                  style: |
                    bar-card-backgroundbar {
                              background: rgba(255,255,255,0.4);
                            }
              - type: custom:bar-card
                name: 補水
                entity: input_number.aquarium_bucket_waterlevel
                positions:
                  icon: "off"
                  indicator: "off"
                  name: outside
                direction: up
                height: 75px
                width: 50%
                max: 2
                min: -1
                color: Pink
                severity:
                  - color: lightblue
                    from: 1.9
                    to: 2.1
                card_mod:
                  style: |
                    bar-card-backgroundbar {
                              background: rgba(255,255,255,0.4);
                            }
      - type: section
        label: 設備監測
      - type: custom:vertical-stack-in-card
        card_mod:
          style: |
            ha-card {             
              border: 0;
              border-radius: 0;
            }
        cards:
          - type: custom:vertical-stack-in-card
            horizontal: true
            card_mod:
              style: |
                ha-card {             
                  border-radius: 0;
                }
            cards:
              - type: custom:mini-graph-card
                entities:
                  - entity: sensor.gosund_powerstrip_aquarium_power
                    name: 設備功耗
                    color: lightsalmon
                font_size_header: 12
                font_size: 50
                hours_to_show: 24
                points_per_hour: 6
                line_width: 1
                height: 75
                show:
                  icon: false

日誌除了會傳到手機上之外,也另外做了一個txt檔來放,詳情見Home Assistant中利用iframe card將文字檔內容嵌入lovelace的方法。警報裡的數值雖然與第二欄重複,但這裡是當出現異常時會反紅,正常時為藍色,所以如果要快速看一下狀態,只要看顏色就行。

type: vertical-stack
title: 日誌與警報
cards:
  - type: entities
    entities:
      - type: custom:vertical-stack-in-card
        card_mod:
          style: |
            ha-card {             
              border: 0;
              border-radius: 0;
            }
        cards:
          - type: iframe
            url: https://tzungshiun.com:8123/local/aquarium/aquarium.html
            aspect_ratio: 80%
      - type: section
        label: 各項警報
      - type: custom:template-entity-row
        entity: sensor.aquarium_maintank_ph_rendering
        name: pH
        icon: mdi:ph
        state: |
          {% if states('binary_sensor.aquarium_ph_alarm') == "off" %}
            {{ states('sensor.aquarium_maintank_ph_rendering') }} / 安全
          {% else %}
            {{ states('sensor.aquarium_maintank_ph_rendering') }} / 異常
          {% endif %}
        color: |
          {% if states('binary_sensor.aquarium_ph_alarm') == "on" %}
            indianred
          {% endif %}
      - type: custom:template-entity-row
        entity: sensor.aquarium_maintank_tds_rendering
        name: TDS
        icon: mdi:beer
        state: |
          {% if states('binary_sensor.aquarium_tds_alarm') == "off" %}
            {{ states('sensor.aquarium_maintank_tds_rendering') | round(0) }} / 安全
          {% else %}
            {{ states('sensor.aquarium_maintank_tds_rendering') | round(0) }} / 異常
          {% endif %}
        color: |
          {% if states('binary_sensor.aquarium_tds_alarm') == "on" %}
            indianred
          {% endif %}
      - type: custom:template-entity-row
        entity: sensor.aquarium_maintank_watertemperature_rendering
        name: 水溫
        icon: mdi:thermometer
        state: >
          {% if states('binary_sensor.aquarium_watertemperature_alarm') == "off"
          %}
            {{ states('sensor.aquarium_maintank_watertemperature_rendering') }} / 安全
          {% else %}
            {{ states('sensor.aquarium_maintank_watertemperature_rendering') }} / 異常
          {% endif %}
        color: >
          {% if states('binary_sensor.aquarium_watertemperature_alarm') == "on"
          %}
            indianred
          {% endif %}
      - type: custom:template-entity-row
        entity: sensor.aquarium_maintank_watertemperature_1hr_range
        name: 主缸一小時溫差
        icon: mdi:thermometer
        state: >
          {% if
          states('binary_sensor.aquarium_maintank_watertemperature_1hr_range_alarm')
          == "off" %}
            {{ states('sensor.aquarium_maintank_watertemperature_1hr_range') }} / 安全
          {% else %}
            {{ states('sensor.aquarium_maintank_watertemperature_1hr_range') }} / 異常
          {% endif %}
        color: >
          {% if
          states('binary_sensor.aquarium_maintank_watertemperature_1hr_range_alarm')
          == "on" %}
            indianred
          {% endif %}
      - type: custom:template-entity-row
        entity: sensor.aquarium_watertemperature_gap
        name: 主缸與補水桶溫差
        icon: mdi:thermometer
        state: >
          {% if states('binary_sensor.aquarium_watertemperature_gap_alarm') ==
          "off" %}
            {{ states('sensor.aquarium_watertemperature_gap') }} / 安全
          {% else %}
            {{ states('sensor.aquarium_watertemperature_gap') }} / 異常
          {% endif %}
        color: >
          {% if states('binary_sensor.aquarium_watertemperature_gap_alarm') ==
          "on" %}
            indianred
          {% endif %}
      - type: custom:template-entity-row
        entity: binary_sensor.aquarium_backside_leaksensor_moisture
        name: 漏水
        icon: mdi:water-outline
        state: >
          {% if states('binary_sensor.aquarium_backside_leaksensor_moisture') ==
          "off" %}
            安全
          {% else %}
            偵測到漏水
          {% endif %}
        color: >
          {% if states('binary_sensor.aquarium_backside_leaksensor_moisture') ==
          "on" %}
            indianred
          {% endif %}
      - type: custom:template-entity-row
        entity: binary_sensor.aquarium_tankcover_contactsensor_contact
        name: 上蓋
        icon: mdi:electric-switch-closed
        state: >
          {% if states('binary_sensor.aquarium_tankcover_contactsensor_contact')
          == "off" %}
            關閉
          {% else %}
            開啟
          {% endif %}
        color: >
          {% if states('binary_sensor.aquarium_tankcover_contactsensor_contact')
          == "on" %}
            indianred
          {% endif %}
      - type: custom:template-entity-row
        entity: sensor.aquarium_waterlevel_check
        name: 水位
        icon: mdi:alert-circle-check-outline
        color: |
          {% if states('sensor.aquarium_waterlevel_check') != "安全" %}
            indianred
          {% endif %}
      - type: custom:template-entity-row
        entity: sensor.gosund_powerstrip_aquarium_power
        name: 設備功耗
        icon: mdi:power-plug-outline
        state: |
          {% if states('binary_sensor.aquarium_power_check') == "off" %}
            正常
          {% else %}
            異常
          {% endif %}
        color: |
          {% if states('binary_sensor.aquarium_power_check') == "on" %}
            indianred
          {% endif %}
      - type: custom:restriction-card
        duration: 20
        restrictions:
          confirm:
            text: 請確認要警報上下限!
        card:
          type: custom:vertical-stack-in-card
          card_mod:
            style: |
              ha-card {             
                border: 0;
                border-radius: 0;
              }
          cards:
            - type: custom:vertical-stack-in-card
              horizontal: true
              card_mod:
                style: |
                  ha-card {             
                    border-radius: 0;
                  }
              cards:
                - type: custom:numberbox-card
                  entity: input_number.aquarium_ph_min
                  border: true
                  name: false
                  card_mod:
                    style: >
                      .body{display:block!important}
                      .body::after{text-align:center;font-size:14px;content:"pH下限";display:block!important}
                - type: custom:numberbox-card
                  entity: input_number.aquarium_ph_max
                  border: true
                  name: false
                  card_mod:
                    style: >
                      .body{display:block!important}
                      .body::after{text-align:center;font-size:14px;content:"pH上限";display:block!important}
            - type: custom:vertical-stack-in-card
              horizontal: true
              card_mod:
                style: |
                  ha-card {             
                    border-radius: 0;
                  }
              cards:
                - type: custom:numberbox-card
                  entity: input_number.aquarium_tds_min
                  border: true
                  name: false
                  card_mod:
                    style: >
                      .body{display:block!important}
                      .body::after{text-align:center;font-size:14px;content:"TDS下限";display:block!important}
                - type: custom:numberbox-card
                  entity: input_number.aquarium_tds_max
                  border: true
                  name: false
                  card_mod:
                    style: >
                      .body{display:block!important}
                      .body::after{text-align:center;font-size:14px;content:"TDS上限";display:block!important}
            - type: custom:vertical-stack-in-card
              horizontal: true
              card_mod:
                style: |
                  ha-card {             
                    border-radius: 0;
                  }
              cards:
                - type: custom:numberbox-card
                  entity: input_number.aquarium_maintank_watertemperature_min
                  border: true
                  name: false
                  card_mod:
                    style: >
                      .body{display:block!important}
                      .body::after{text-align:center;font-size:14px;content:"水溫下限";display:block!important}
                - type: custom:numberbox-card
                  entity: input_number.aquarium_maintank_watertemperature_max
                  border: true
                  name: false
                  card_mod:
                    style: >
                      .body{display:block!important}
                      .body::after{text-align:center;font-size:14px;content:"水溫上限";display:block!important}
            - type: custom:vertical-stack-in-card
              horizontal: true
              card_mod:
                style: |
                  ha-card {             
                    border-radius: 0;
                  }
              cards:
                - type: custom:numberbox-card
                  entity: >-
                    input_number.aquarium_maintank_watertemperature_1hr_range_max
                  border: true
                  name: false
                  card_mod:
                    style: >
                      .body{display:block!important}
                      .body::after{text-align:center;font-size:14px;content:"主缸一小時溫差";display:block!important}
                - type: custom:numberbox-card
                  entity: input_number.aquarium_watertemperature_gap_max
                  border: true
                  name: false
                  card_mod:
                    style: >
                      .body{display:block!important}
                      .body::after{text-align:center;font-size:14px;content:"主缸與補水桶溫差";display:block!important}
      - type: section
        label: 補水次數
      - type: custom:template-entity-row
        entity: sensor.aquarium_maintank_refill_count_12
        name: 12小時
        icon: mdi:hours-12
        color: >
          {% if states('sensor.aquarium_maintank_refill_count_12') | float > 0
          %}
            indianred
          {% endif %}
      - type: custom:template-entity-row
        entity: sensor.aquarium_maintank_refill_count_24
        name: 24小時
        icon: mdi:hours-24
        color: >
          {% if states('sensor.aquarium_maintank_refill_count_24') | float > 1
          %}
            indianred
          {% endif %}

自動化建立完成後,一些手動的操作就比較少用到,所以擺在最後面。

type: vertical-stack
title: 操作
cards:
  - type: entities
    entities:
      - type: custom:vertical-stack-in-card
        card_mod:
          style: |
            ha-card {             
              border: 0;
              border-radius: 0;
            }
        cards:
          - type: custom:vertical-stack-in-card
            horizontal: true
            card_mod:
              style: |
                ha-card {             
                  border-radius: 0;
                }
            cards:
              - type: custom:button-card
                entity: sensor.aquarium_tank_refill_condition
                icon: mdi:water-outline
                name: 手動補水
                aspect_ratio: 2/1
                show_state: true
                layout: icon_name_state2nd
                styles:
                  card:
                    - padding: 3%
                    - font-size: 12px
                    - outline: Gainsboro solid 1px
                    - background: |
                        [[[
                          if (entity.state == '補水桶溫差過大' || entity.state == '水位異常') return 'LightPink';
                          if (entity.state == '補水中') return 'AntiqueWhite';
                          if (entity.state == '待命中' || entity.state == '維護模式') return 'White';
                        ]]]
                  name:
                    - justify-self: end
                    - padding-right: 5%
                    - filter: |
                        [[[
                          if (entity.state == '補水桶溫差過大' || entity.state == '水位異常') return 'opacity(100%)';
                          if (entity.state == '補水中') return 'opacity(100%)';
                          if (entity.state == '待命中' || entity.state == '維護模式') return 'opacity(100%)';
                        ]]]
                  state:
                    - justify-self: end
                    - padding-right: 5%
                    - color: |
                        [[[
                          if (entity.state == '補水桶溫差過大' || entity.state == '水位異常') return 'FireBrick';
                          if (entity.state == '補水中') return 'rgb(0,100,255)';
                          if (entity.state == '待命中' || entity.state == '維護模式') return 'Black';
                        ]]]
                    - filter: |
                        [[[
                          if (entity.state == '補水桶溫差過大' || entity.state == '水位異常') return 'opacity(100%)';
                          if (entity.state == '補水中') return 'opacity(100%)';
                          if (entity.state == '待命中' || entity.state == '維護模式') return 'opacity(100%)';
                        ]]]
                  icon:
                    - width: 60%
                    - filter: |
                        [[[
                          if (entity.state == '補水桶溫差過大' || entity.state == '水位異常') return 'opacity(100%)';
                          if (entity.state == '補水中') return 'opacity(100%)';
                          if (entity.state == '待命中' || entity.state == '維護模式') return 'opacity(100%)';
                        ]]]
                color_type: card
                tap_action:
                  action: call-service
                  service: script.turn_on
                  service_data:
                    entity_id: script.aquarium_maintank_manually_refill
                  confirmation:
                    text: 請確認要進行補水
              - type: custom:button-card
                entity: automation.aquarium_auto_refill
                icon: mdi:water-outline
                name: 自動補水
                template: tool_button
                color_type: card
              - type: custom:button-card
                entity: input_boolean.aquarium_maintenance
                icon: mdi:tools
                name: 例行維護
                template: tool_button
                color_type: card
                tap_action:
                  action: call-service
                  service: input_boolean.toggle
                  service_data:
                    entity_id: input_boolean.aquarium_maintenance
                  confirmation:
                    text: 請確認要進行維護
                hold_action:
                  action: more-info
      - type: section
        label: 馬達延遲啟動
      - entity: timer.submersible_pump_duration
        name: 狀態
        icon: mdi:water-pump
        tap_action:
          action: call-service
          service: script.turn_on
          service_data:
            entity_id: script.aquarium_pump_delay
          confirmation:
            text: 請確認要延時啟動
      - type: custom:numberbox-card
        entity: input_number.submersible_pump_duration
        icon: mdi:timer-check-outline
        name: 延時設定
      - type: section
        label: 風扇設定
      - type: custom:restriction-card
        duration: 20
        restrictions:
          confirm:
            text: 請確認要更改風扇設定!
        card:
          type: custom:vertical-stack-in-card
          card_mod:
            style: |
              ha-card {             
                border: 0;
                border-radius: 0;
              }
          cards:
            - type: custom:vertical-stack-in-card
              horizontal: true
              card_mod:
                style: |
                  ha-card {             
                    border-radius: 0;
                  }
              cards:
                - type: custom:numberbox-card
                  entity: input_number.aquarium_fan_on_threshold
                  border: true
                  name: false
                  card_mod:
                    style: >
                      .body{display:block!important}
                      .body::after{text-align:center;font-size:14px;content:"啟動溫度";display:block!important}
                - type: custom:numberbox-card
                  entity: input_number.aquarium_fan_off_threshold
                  border: true
                  name: false
                  card_mod:
                    style: >
                      .body{display:block!important}
                      .body::after{text-align:center;font-size:14px;content:"關閉溫度";display:block!important}
      - type: section
        label: 加溫棒設定
      - type: custom:restriction-card
        duration: 20
        restrictions:
          confirm:
            text: 請確認要更改加溫棒設定!
        card:
          type: custom:vertical-stack-in-card
          card_mod:
            style: |
              ha-card {             
                border: 0;
                border-radius: 0;
              }
          cards:
            - type: custom:vertical-stack-in-card
              horizontal: true
              card_mod:
                style: |
                  ha-card {             
                    border-radius: 0;
                  }
              cards:
                - type: custom:numberbox-card
                  entity: input_number.aquarium_heater_on_threshold
                  border: true
                  name: false
                  card_mod:
                    style: >
                      .body{display:block!important}
                      .body::after{text-align:center;font-size:14px;content:"啟動溫度";display:block!important}
                - type: custom:numberbox-card
                  entity: input_number.aquarium_heater_off_threshold
                  border: true
                  name: false
                  card_mod:
                    style: >
                      .body{display:block!important}
                      .body::after{text-align:center;font-size:14px;content:"關閉溫度";display:block!important}
      - type: section
        label: 補水設定
      - type: custom:restriction-card
        duration: 20
        restrictions:
          confirm:
            text: 請確認要更改補水設定!
        card:
          type: custom:vertical-stack-in-card
          card_mod:
            style: |
              ha-card {             
                border: 0;
                border-radius: 0;
              }
          cards:
            - type: custom:vertical-stack-in-card
              horizontal: true
              card_mod:
                style: |
                  ha-card {             
                    border-radius: 0;
                  }
              cards:
                - type: custom:numberbox-card
                  entity: input_number.aquarium_water_refill_duration
                  border: true
                  name: false
                  card_mod:
                    style: >
                      .body{display:block!important}
                      .body::after{text-align:center;font-size:14px;content:"補水時間";display:block!important}
                - type: custom:numberbox-card
                  entity: input_number.aquarium_water_refill_temperature_gap
                  border: true
                  name: false
                  card_mod:
                    style: >
                      .body{display:block!important}
                      .body::after{text-align:center;font-size:14px;content:"補水溫差";display:block!important}
      - type: section
        label: pH校正電壓
      - type: custom:restriction-card
        duration: 20
        restrictions:
          confirm:
            text: 請確認要更改pH校正電壓!
        card:
          type: custom:vertical-stack-in-card
          card_mod:
            style: |
              ha-card {             
                border: 0;
                border-radius: 0;
              }
          cards:
            - type: custom:vertical-stack-in-card
              horizontal: true
              card_mod:
                style: |
                  ha-card {             
                    border-radius: 0;
                  }
              cards:
                - type: custom:numberbox-card
                  entity: input_number.aquarium_ph_slope
                  border: true
                  name: false
                  card_mod:
                    style: >
                      .body{display:block!important}
                      .body::after{text-align:center;font-size:14px;content:"校正斜率";display:block!important}
                - type: custom:numberbox-card
                  entity: input_number.aquarium_ph_intercept
                  border: true
                  name: false
                  card_mod:
                    style: >
                      .body{display:block!important}
                      .body::after{text-align:center;font-size:14px;content:"校正截距";display:block!important}
      - type: section
        label: 設備開關
      - type: custom:vertical-stack-in-card
        card_mod:
          style: |
            ha-card {             
              border: 0;
              border-radius: 0;
            }
        cards:
          - type: custom:vertical-stack-in-card
            horizontal: true
            card_mod:
              style: |
                ha-card {             
                  border-radius: 0;
                }
            cards:
              - type: custom:button-card
                entity: switch.gosund_powerstrip_aquarium_switch1
                icon: mdi:globe-light-outline
                name: 燈光
                template: tool_button
                color_type: card
                tap_action:
                  action: call-service
                  service: switch.toggle
                  service_data:
                    entity_id: switch.gosund_powerstrip_aquarium_switch1
                  confirmation:
                    text: 請確認要開啟或關閉電源
                hold_action:
                  action: more-info
              - type: custom:button-card
                entity: switch.gosund_powerstrip_aquarium_switch2
                icon: mdi:water-outline
                name: 補水馬達
                template: tool_button
                color_type: card
                tap_action:
                  action: call-service
                  service: switch.toggle
                  service_data:
                    entity_id: switch.gosund_powerstrip_aquarium_switch2
                  confirmation:
                    text: 請確認要開啟或關閉電源
                hold_action:
                  action: more-info
              - type: custom:button-card
                entity: switch.gosund_powerstrip_aquarium_switch3
                icon: mdi:water-pump
                name: 沉水馬達
                template: tool_button
                color_type: card
                tap_action:
                  action: call-service
                  service: switch.toggle
                  service_data:
                    entity_id: switch.gosund_powerstrip_aquarium_switch3
                  confirmation:
                    text: 請確認要開啟或關閉電源
                hold_action:
                  action: more-info
          - type: custom:vertical-stack-in-card
            horizontal: true
            card_mod:
              style: |
                ha-card {             
                  border-radius: 0;
                }
            cards:
              - type: custom:button-card
                entity: switch.gosund_powerstrip_aquarium_switch4
                icon: mdi:heat-wave
                name: 加溫棒
                template: tool_button
                color_type: card
                tap_action:
                  action: call-service
                  service: switch.toggle
                  service_data:
                    entity_id: switch.gosund_powerstrip_aquarium_switch4
                  confirmation:
                    text: 請確認要開啟或關閉電源
                hold_action:
                  action: more-info
              - type: custom:button-card
                entity: switch.gosund_powerstrip_aquarium_switch5
                icon: mdi:pump
                name: 打氣機
                template: tool_button
                color_type: card
                tap_action:
                  action: call-service
                  service: switch.toggle
                  service_data:
                    entity_id: switch.gosund_powerstrip_aquarium_switch5
                  confirmation:
                    text: 請確認要開啟或關閉電源
                hold_action:
                  action: more-info
              - type: custom:button-card
                entity: switch.gosund_powerstrip_aquarium_switch6
                icon: mdi:fan
                name: 風扇
                template: tool_button
                color_type: card
                tap_action:
                  action: call-service
                  service: switch.toggle
                  service_data:
                    entity_id: switch.gosund_powerstrip_aquarium_switch6
                  confirmation:
                    text: 請確認要開啟或關閉電源
                hold_action:
                  action: more-info

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *

返回頂端