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

 找回密码
 立即注册
查看: 10984|回复: 21

[UI界面] FLOORPLAN 3D控制求助

[复制链接]

3

主题

117

帖子

772

积分

高级会员

Rank: 4

积分
772
金钱
655
HASS币
0
发表于 2020-12-28 15:22:58 | 显示全部楼层 |阅读模式
大家好,初学者,做了个FLOORPLAN 3D用来控件灯,插座等,但有个问题,控制灯时图片的状态马上就可以反映灯的状态,但控制插座时,却不能同时反映状态,必须点击其他灯后才能反映出插座的状态,用罗技HARMONY模拟的灯也是这个问题。由于这些东西都是东拼西凑的,实在不知问题出在哪?

另外再问一个问题,FLOORPLAN 3d上怎么实现控制窗帘的3D效果?
以下就相关代码:
图片控制插座:
            ##一楼大门

            - type: image
              entity: switch.unit_door_2
              tap_action:
                action: toggle
              state_image:
                "on": /local/ui/floorplan/double-door-open.svg
                "off": /local/ui/floorplan/double-door-closed.svg
                "unavailable": /local/ui/floorplan/double-door-closed.svg
              style:
                top: 20%
                left: 63%               
                width: 5%

HARMONY模拟灯:
  - platform: template
    lights:
      livingroom_light:
        friendly_name: "livingroom light"
        turn_on:
          service: remote.send_command
          data:
            entity_id: remote.livingroom
            command:
              - PowerOn
            device: 65186473
            delay_secs: 0.6
        turn_off:
          service: remote.send_command
          data:
            entity_id: remote.livingroom
            command:
              - PowerOff
            device: 65186473
            delay_secs: 0.6
屏幕截图 2020-12-28 145752.png

屏幕截图 2020-12-28 145308.png
回复

使用道具 举报

0

主题

22

帖子

179

积分

注册会员

Rank: 2

积分
179
金钱
157
HASS币
0
发表于 2020-12-28 15:39:36 | 显示全部楼层
请教这个3d用什么画出来的?
回复

使用道具 举报

3

主题

117

帖子

772

积分

高级会员

Rank: 4

积分
772
金钱
655
HASS币
0
 楼主| 发表于 2020-12-28 17:05:39 | 显示全部楼层
tt123511 发表于 2020-12-28 15:39
请教这个3d用什么画出来的?

SWEETHOME 3D,很方便,又有灯光效果
回复

使用道具 举报

2

主题

24

帖子

360

积分

中级会员

Rank: 3Rank: 3

积分
360
金钱
336
HASS币
0
发表于 2020-12-29 02:32:57 | 显示全部楼层
为啥你用sweet home画出来比我的好看那么多?
回复

使用道具 举报

2

主题

344

帖子

2340

积分

金牌会员

Rank: 6Rank: 6

积分
2340
金钱
1991
HASS币
30
发表于 2020-12-29 12:39:36 | 显示全部楼层
本帖最后由 fung1006 于 2020-12-30 21:46 编辑

用 input boolean 顯示圖像的狀態就可以解決
 - entity: input_boolean.home_living_lux
                    state_filter:
                      'on': opacity(100%)
                    state_image:
                      'off': /local/floorplan/img/trans.png
                      unavailable: /local/floorplan/img/trans.png
                      'on': /local/floorplan/img/img/living_lux_on.png
                    style:
                      left: 50%
                      top: 50%
                      width: 100%
                    type: image


窗帘的3D效果用gif就可以

ezgif-5-23e11fea9c4e.gif



回复

使用道具 举报

3

主题

117

帖子

772

积分

高级会员

Rank: 4

积分
772
金钱
655
HASS币
0
 楼主| 发表于 2020-12-30 23:02:14 | 显示全部楼层
fung1006 发表于 2020-12-29 12:39
用 input boolean 顯示圖像的狀態就可以解決

救星,折腾了很久还是没有搞定,外网上很多提到INPUT_BOOLEAN,一直不理解,灯的实体ID,怎么和input_boolean连在一起,灯的ID和INPUT_BOOLEAN关联的代码能帮忙贴一个吗?

意思自己做个GIF?怎么实现百分比的状态?做多个GIF?
回复

使用道具 举报

3

主题

117

帖子

772

积分

高级会员

Rank: 4

积分
772
金钱
655
HASS币
0
 楼主| 发表于 2020-12-30 23:03:26 | 显示全部楼层
feng4417 发表于 2020-12-29 02:32
为啥你用sweet home画出来比我的好看那么多?

导出来就好看很多
回复

使用道具 举报

2

主题

344

帖子

2340

积分

金牌会员

Rank: 6Rank: 6

积分
2340
金钱
1991
HASS币
30
发表于 2021-1-2 00:23:45 | 显示全部楼层
本帖最后由 fung1006 于 2021-1-2 00:25 编辑
mmygo 发表于 2020-12-30 23:02
救星,折腾了很久还是没有搞定,外网上很多提到INPUT_BOOLEAN,一直不理解,灯的实体ID,怎么和input_boole ...
開關連動到input_boolean
input_boolean:

  switch_unit_door_2:

    name: "ib switch unit door 2"



automation:

  - alias: "switch unit door 2 ON"

    trigger:

      - platform: state

        entity_id: switch.unit_door_2

        to: 'on'



    action:

      - service: input_boolean.turn_on

        entity_id: input_boolean.switch_unit_door_2



  - alias: "switch unit door 2 OFF"

    trigger:

      - platform: state

        entity_id: switch.unit_door_2

        to: 'off'



    action:

      - service: input_boolean.turn_off

        entity_id: input_boolean.switch_unit_door_2
最後直接用 input_boolean.switch_unit_door_2 顯示插座狀態

回复

使用道具 举报

2

主题

344

帖子

2340

积分

金牌会员

Rank: 6Rank: 6

积分
2340
金钱
1991
HASS币
30
发表于 2021-1-2 00:37:04 | 显示全部楼层
mmygo 发表于 2020-12-30 23:02
救星,折腾了很久还是没有搞定,外网上很多提到INPUT_BOOLEAN,一直不理解,灯的实体ID,怎么和input_boole ...

先做一個template sensor獲取窗帘現在的打開數值狀況 (假設0-100%)
再按數值做圖...
回复

使用道具 举报

3

主题

117

帖子

772

积分

高级会员

Rank: 4

积分
772
金钱
655
HASS币
0
 楼主| 发表于 2021-1-2 17:49:08 | 显示全部楼层
本帖最后由 mmygo 于 2021-1-2 17:54 编辑
fung1006 发表于 2021-1-2 00:23
開關連動到input_boolean
最後直接用 input_boolean.switch_unit_door_2 顯示插座狀態

还是没理解,看自动化是通过实体按钮触发的,如果用input_boolean.switch_unit_door_2,点了图片完全没反应



            ##一楼大门
               
            - type: image
              entity:  input_boolean.switch_unit_door_2
              image: /local/ui/floorplan/double-door-closed.svg
              tap_action:
                action: toggle
              state_image:
                "on": /local/ui/floorplan/double-door-open.svg
                "off": /local/ui/floorplan/double-door-closed.svg
                "unavailable": /local/ui/floorplan/double-door-closed.svg
              style:
                top: 20%
                left: 63%               
                width: 5%               
  

以下代码是抄老外的,如果是智能灯效果很好,但如果是TEMPLATE LIGHT,状态要刷新一下才会出现。可能是TEMPLATE LIGHT 的状态不能及时触发?
            - type: image
              action: none
              entity: light.master_bedroom
              hold_action:
               action: none
              image: /local/ui/floorplan/light/materroomlight.png
              style:
                filter: >-
                  ${ "hue-rotate(" + (states['light.master_bedroom'].attributes.hs_color
                  ? states['light.yeelink_bhf_light'].attributes.hs_color[0] : 0) + "deg)"}
                left: 50%
                mix-blend-mode: lighten
                opacity: "${states['light.master_bedroom'].state === 'on' ? (states['light.master_bedroom'].attributes.brightness / 255) : '0'}"
                top: 50%
                width: 100%
                height: 100%
              tap_action:
                action: none               

以下是按上面的模板修改的 用于显示灯的状态,灯开关后,这个状态要刷新一下页面才会显示,或者其他灯的状态变化了,
            - type: image
              action: none
              entity: input_boolean.livingroom_light
              hold_action:
               action: none
              image: /local/ui/floorplan/light/livingroomlight.png
              style:
                # filter:
                # >-
                  # ${ "hue-rotate(" + (0) + "deg)"}
                left: 50%
                mix-blend-mode: lighten
                opacity: "${states['input_boolean.livingroom_light'].state === 'on' ? '1' : '0'}"
                top: 50%
                width: 100%
                height: 100%
              tap_action:
                action: none  

以下是使用罗技HARMONY控制的灯
  - platform: template
    lights:
      livingroom_light:
        friendly_name: "livingroom light"              
         
        turn_on:
          service: remote.send_command
          data:
            entity_id: remote.livingroom
            command:
              - PowerOn
            device: 65186473
            delay_secs: 1
        turn_off:
          service: remote.send_command
          data:
            entity_id: remote.livingroom
            command:
              - PowerOff
            device: 65186473
            delay_secs: 1

以下是用于在FLOORPLAN上实际控制灯的,实际灯的开关没问题,只是前面灯的状态不能刷新,如果ENTITY:input_boolean.livingroom_light ,完全没反应

           - entity: light.livingroom_light
              hold_action:
                action: none
              icon: 'mdi:ceiling-light'
              style:
                '--iron-icon-height': 2vw
                '--iron-icon-width': 2vw
                '--paper-item-icon-active-color': '#CCCCCC'
                '--paper-item-icon-color': '#CCCCCC'
                align-items: center
                background-color: "rgba(255, 255, 255, 0.2)"
                border-radius: 100%
                box-shadow: '0px 0px 28px 0px rgba(0,0,0,0.39)'
                display: flex
                height: 3vw
                justify-content: center
                left: 58%
                margin-left: '-1.5vw'
                margin-top: '-1.5vw'
                top: 60%
                width: 3vw
              tap_action:
                action: toggle
              type: state-icon

相关自动化,如果FLOORPPLAN中使用input_boolean.livingroom_light ,完全没反应

- alias: "livingroom light 2 ON"
  trigger:
    - platform: state
      entity_id: light.livingroom_light
      to: 'on'
  action:
    - service: input_boolean.turn_on
      entity_id: input_boolean.livingroom_light

- alias: "livingroom light 2 OFF"
  trigger:
    - platform: state
      entity_id: light.livingroom_light
      to: 'off'
  action:
    - service: input_boolean.turn_off
      entity_id: input_boolean.livingroom_light

回复

使用道具 举报

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

本版积分规则

Archiver|手机版|小黑屋|Hassbian

GMT+8, 2024-5-10 03:30 , Processed in 0.097769 second(s), 34 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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