MQTT binary-sensor using HomeAssistant discovery

Hello,

I’m trying to bind a binary_sensor (following HA discovery syntax) but it doesn’t map the true/false boolean to the OnOffType

Command 'True' from channel 'mqtt:homeassistant:x:y:z_online' not supported by type 'OnOffValue': No enum constant org.openhab.core.library.types.OnOffType.True

Here is the channel config

- id: z_online
    channelTypeUID: mqtt:ha-switch
    label: Inverter Online
    configuration:
      component: binary_sensor
      config:
        - '{"name": "Inverter Online", "unique_id": "z_online",
          "state_topic": "aps/x/y", "value_template": "{{
          value_json.online }}", "device": {"identifiers": ["y"],
          "name": "APS Inverter y", "manufacturer": "APsystems",
          "via_device": "x"}, "availability_topic": "aps/status",
          "payload_available": "online", "payload_not_available": "offline",
          "payload_on": "true", "payload_off": "false", "icon":
          "mdi:power-plug"}'
      nodeid: ""
      objectid:
        - aps_z_online

And the MQTT message

Topic: aps/x/y  QoS: 0

{
  "online": false
}

I’ve tried to use profile but it looks like the event doesn’t reach this step

Thanks for your help

Not an HA config user, but there have been other posts about availability, and you may need to configure your app to not include availability. I assume you just want to use payload_on and payload_off. Also “true” and “True” are not the same.

I use generic MQTT things and an example switch config (from code tab)

  - id: Maytag_Washer_Switch_n
    channelTypeUID: mqtt:switch
    label: Maytag Washer Switch
    description: Power Switch
    configuration:
      commandTopic: zwave1/Washer_-_11/switch_binary/endpoint_0/targetValue/set
      stateTopic: zwave1/Washer_-_11/switch_binary/endpoint_0/currentValue
      transformationPattern:
        - JSONPATH:$.value
      off: "false"
      on: "true"