OH3 Floorplan: Marker based on several items sending different commands for garage door

  • Platform information:
    • Hardware: RPi4
    • OS: linux
    • Java Runtime Environment: zulu 11
    • openHAB version: 3.1.0

In the process of migrating from OH2.5 to OH3.1 I have migrated a homemade .svg floorplan to the new OH3.1 floorplan. All devices has been moved, except my garage door.

The garage door is hard because it uses a Fibaro smart implant Z-Wave device to detect the state and send the commands.

I have two switches to detect end positions (both being OFF is moving up or down):
Door_Garage_IsClosed (ON/OFF)
Door_Garage_IsOpen (ON/OFF)

And two Switches I can send commands to:
Door_Garage_Open, send ON to open
Door_Garage_Close, send ON to close

Using the .svg I have set .class and sent the correct command like this:
ng-class="{“port-open”: itemState(‘Door_Garage_IsClosed’) != ‘ON’ }"
ng-click=“sendCmd((itemState(‘Door_Garage_IsClosed’) == ‘ON’) ? ‘Door_Garage_Open’ : ‘Door_Garage_Close’, ‘ON’)” />

Is it possible to get a Marker in a floorplan to display the correct oh:garagedoor icon based on two different states and send different commands based on the state?

Or is it possible to create a rollershutter item that I can using profiles and the existing items?

I am able to create a widget for it, but I am not able to place the widget on the floorplan.

uid: garagedoor
tags:
  - garagedoor
  - garage
props:
  parameters:
    - description: Garage door name
      label: Name
      name: name
      required: false
      type: TEXT
    - context: item
      description: Control that closes the port
      label: Control Item to Close the garage
      name: control_item_close
      required: true
      type: TEXT
    - context: item
      description: Control that opens the port
      label: Control Item to Open the garage
      name: control_item_open
      required: true
      type: TEXT
    - context: item
      description: Sensor Item Is Closed
      label: Sensor Item that shows the garage is Closed
      name: sensor_item_closed
      required: true
      type: TEXT
    - context: item
      description: Sensor Item Is Open
      label: Sensor Item that shows the garage is Open
      name: sensor_item_open
      required: true
      type: TEXT
  parameterGroups: []
timestamp: Oct 3, 2021, 5:24:10 PM
component: oh-list-item
config:
  icon: '=(items[props.sensor_item_closed].state == "ON") ? "oh:garagedoor-down" : (items[props.sensor_item_open].state == "ON") ? "oh:garagedoor-up" : "oh:garagedoor-50"'
  title: =props.name
  action: command
  actionItem: '=(items[props.sensor_item_closed].state == "ON") ? props.control_item_open : props.control_item_close'
  actionCommand: ON
  badgeColor: '=(items[props.sensor_item_closed].state != "ON") ? "red" : "green"'
  badge: '=(items[props.sensor_item_closed].state != "ON") ? "open" : "closed"'

Based on garagedoor_list from Example Custom List Widgets - Add-ons / UIs - openHAB Community

With some experience from the widgets it was possible to solve it in the floor plan as well:

  icon: '=(Door_Garage_IsClosed == ON) ? "oh:garagedoor-down" : (Door_Garage_IsOpen == ON) ? "oh:garagedoor-up" : "oh:garagedoor-50"'
  actionItem: '=(Door_Garage_IsClosed == ON) ? "Door_Garage_Open" : "Door_Garage_Close"'
  iconUseState: true
  tooltip: '=(Door_Garage_IsClosed == ON) ? "Closed" : (Door_Garage_IsOpen == ON) ? "Open" : "Moving"'
  tooltipPermanent: true
'''