Mitsubishi Heat Pump

Using custom widget for ACs (based on [SOLVED] UI Widget: Intesis aircon controller; No commands send to items, thx to @hmerk and others) :

ezgif-4-3699f4add539

widget yaml:

uid: air_conditioner
tags: []
props:
  parameters:
    - description: Title
      label: Title
      name: title
      required: false
      type: TEXT
    - context: prefix
      description: The name prefix of widget items
      label: Prefix
      name: prefix
      required: false
      type: TEXT
  parameterGroups: []
timestamp: Jan 8, 2021, 1:40:45 PM
component: f7-block
config:
  class:
    - no-padding
slots:
  default:
    - component: Label
      config:
        text: =props.title
        style:
          text-align: center
          font-size: 16px
    - component: f7-row
      config:
        class:
          - margin
          - align-items-center
      slots:
        default:
          - component: oh-link
            config:
              action: toggle
              actionItem: =props.prefix + "_Power"
              actionCommand: ON
              actionCommandAlt: OFF
              class:
                - display-flex
                - flex-direction-column
            slots:
              default:
                - component: f7-icon
                  config:
                    f7: power
                    size: 28
                    color: '=items[props.prefix + "_Power"].state === "OFF" ? "red" : "green"'
                - component: Label
                  config:
                    class:
                      - margin-top-half
                    text: ON/OFF
                    style:
                      color: var(--f7-text-color)
                      font-size: var(--f7-badge-in-icon-font-size)
          - component: Label
            config:
              text: =items[props.prefix + "_RoomTemperature"].state.displayState || items[props.prefix + "_RoomTemperature"].state
    - component: f7-row
      config:
        class:
          - justify-content-center
      slots:
        default:
          - component: oh-knob
            config:
              min: 16
              max: 31
              stepSize: 1
              size: 270
              item: =[props.prefix + '_SetTemperature']
    - component: f7-row
      config:
        class:
          - margin-half
      slots:
        default:
          - component: oh-repeater
            config:
              fragment: true
              for: mode
              in:
                - value: AUTO
                  icon: arrow_2_circlepath
                - value: HEAT
                  icon: thermometer_sun
                - value: DRY
                  icon: drop
                - value: FAN
                  icon: wind
                - value: COOL
                  icon: thermometer_snowflake
            slots:
              default:
                - component: f7-col
                  slots:
                    default:
                      - component: oh-link
                        config:
                          class:
                            - display-flex
                            - flex-direction-column
                          action: command
                          actionItem: =props.prefix + "_Mode"
                          actionCommand: =loop.mode.value
                        slots:
                          default:
                            - component: f7-icon
                              config:
                                style:
                                  color: '=(items[props.prefix + "_Mode"].state === loop.mode.value) ? "green" : "gray"'
                                f7: =loop.mode.icon
                            - component: Label
                              config:
                                class:
                                  - margin-top-half
                                text: =loop.mode.value
                                style:
                                  color: '=(items[props.prefix + "_Mode"].state === loop.mode.value) ? "green" : "gray"'
                                  font-size: var(--f7-badge-in-icon-font-size)
    - component: f7-row
      config:
        class:
          - padding-top-half
          - margin-half
      slots:
        default:
          - component: oh-repeater
            config:
              fragment: true
              for: setting
              filter: items[props.prefix + loop.setting.suffix].state != "-"
              in:
                - suffix: _Fan
                  icon: chart_bar
                  iconColor: yellow
                - suffix: _Vane
                  icon: arrow_up_down_circle
                  iconColor: teal
                - suffix: _WideVane
                  icon: arrow_left_right_circle
                  iconColor: teal
            slots:
              default:
                - component: f7-col
                  slots:
                    default:
                      - component: oh-link
                        config:
                          action: options
                          actionItem: =props.prefix + loop.setting.suffix
                          class:
                            - display-flex
                            - flex-direction-column
                        slots:
                          default:
                            - component: f7-icon
                              config:
                                color: =loop.setting.iconColor
                                f7: =loop.setting.icon
                            - component: Label
                              config:
                                class:
                                  - margin-top-half
                                text: =items[props.prefix + loop.setting.suffix].state
                                style:
                                  color: var(--f7-text-color)
                                  font-size: var(--f7-badge-in-icon-font-size)

one needs to append following suffixes as below when defining items:

  _RoomTemperature
  _SetTemperature
  _Power
  _Mode
  _Fan
  _Vane
  _WideVane

for example, my living room AC (label/name pairs):

Air Conditioner (gGF_Living_AC)
  Room Temperature (gGF_Living_AC_RoomTemperature)
  Set Temperature (gGF_Living_AC_SetTemperature)
  Power (gGF_Living_AC_Power)
  Mode (gGF_Living_AC_Mode)
  Fan (gGF_Living_AC_Fan)
  Vane (gGF_Living_AC_Vane)
  Wide Vane (gGF_Living_AC_WideVane)

Note: one can omit i.e. _WideVane and it will not be rendered (not all my ACs have wide vane) …

Following above rules AC widget can be added as simple as

- component: widget:air_conditioner
  config:
    prefix: gGF_Living_AC
    title: Living Room AC

For completeness adding mqtt yaml too (please note allowedStates that contains values one can pick in the widget, as seen in the attached animated gif):

UID: mqtt:topic:homepi:acLivingRoom
label: Air Conditioner Living's Room
thingTypeUID: mqtt:topic
configuration:
  payloadNotAvailable: Connection Lost
  availabilityTopic: GF_Living_Room/status/LWT
  payloadAvailable: Connected
bridgeUID: mqtt:broker:homepi
channels:
  - id: acRoomTemperature
    channelTypeUID: mqtt:number
    label: AC Room Temperature
    description: null
    configuration:
      stateTopic: GF_Living_Room/ac/settings
      transformationPattern: JSONPATH:$.roomTemperature
      unit: °C
  - id: acSetTemperature
    channelTypeUID: mqtt:number
    label: AC Set Temperature
    description: null
    configuration:
      commandTopic: GF_Living_Room/ac/settings/cmd
      unit: °C
      formatBeforePublish: MitsubishiHP,temperature,%d
      stateTopic: GF_Living_Room/ac/settings
      transformationPattern: JSONPATH:$.temperature
  - id: acPower
    channelTypeUID: mqtt:switch
    label: AC Power
    description: null
    configuration:
      commandTopic: GF_Living_Room/ac/settings/cmd
      formatBeforePublish: MitsubishiHP,power,%s
      stateTopic: GF_Living_Room/ac/settings
      transformationPattern: JSONPATH:$.power
  - id: acMode
    channelTypeUID: mqtt:string
    label: AC Mode
    description: null
    configuration:
      commandTopic: GF_Living_Room/ac/settings/cmd
      allowedStates: HEAT,COOL,FAN,DRY,AUTO
      formatBeforePublish: MitsubishiHP,mode,%s
      stateTopic: GF_Living_Room/ac/settings
      transformationPattern: JSONPATH:$.mode
  - id: acFan
    channelTypeUID: mqtt:string
    label: AC Fan
    description: null
    configuration:
      commandTopic: GF_Living_Room/ac/settings/cmd
      allowedStates: 1,2,3,4,AUTO,QUIET
      formatBeforePublish: MitsubishiHP,fan,%s
      stateTopic: GF_Living_Room/ac/settings
      transformationPattern: JSONPATH:$.fan
  - id: acVane
    channelTypeUID: mqtt:string
    label: AC Vane
    description: null
    configuration:
      commandTopic: GF_Living_Room/ac/settings/cmd
      allowedStates: 1,2,3,4,5,SWING,AUTO
      formatBeforePublish: MitsubishiHP,vane,%s
      stateTopic: GF_Living_Room/ac/settings
      transformationPattern: JSONPATH:$.vane
  - id: acWideVane
    channelTypeUID: mqtt:string
    label: AC Wide Vane
    description: null
    configuration:
      commandTopic: GF_Living_Room/ac/settings/cmd
      allowedStates: <<,<,|,>,>>,<>,SWING
      formatBeforePublish: MitsubishiHP,wideVane,%s
      stateTopic: GF_Living_Room/ac/settings
      transformationPattern: JSONPATH:$.wideVane
1 Like