Control Nanoleaf Shapes via MQTT

  • Platform information:

    • Hardware: RPi 4 4GB
    • OS: Raspbian OS lite
    • Java Runtime Environment: 21
    • openHAB version: 5.0.0
  • Issue of the topic:
    I want to be able to control the individual Nanoleaf panels via MQTT so that I can access them from Home Assistant.
    My idea was to create a generic MQTT device in OH, connect the channels to the items, and then be able to control them bidirectionally.

    My channels, as an example:

    stateTopic:
    openHAB/shapes/panel0/switch/state
    commandTopic:
    openHAB/shapes/panel0/switch/set

    On the broker, I only ever see the commandTopic.
    Now to the problem that I don’t understand.
    When I use both topics in this way and switch the light in openHAB, I see ON and OFF on the broker, but when I “send” the topic from the broker, nothing changes in OH. If I name both topics in:
    “openHAB/shapes/panel0/switch/set”, I can send a topic from the broker and the switch changes its status in OH but does not switch.

    I’ve been stuck for three days and don’t know where else to look for the error.

    UID: mqtt:topic:8223a738ee:Panel0
    label: Shapes Panel 0
    thingTypeUID: mqtt:topic
    configuration: {}
    bridgeUID: mqtt:broker:8223a738ee
    location: Livingroom
    channels:
      - id: Panel0Switch
        channelTypeUID: mqtt:switch
        label: Panel 0 ON/OFF
        description: ""
        configuration:
          commandTopic: openHAB/shapes/panel0/switch/set
          stateTopic: openHAB/shapes/panel0/switch/state
          off: OFF
          on: ON
    

    Am I simply mistaken, or is the configuration more complex than I thought?

Thanks for your help

Don’t about nanoleaf, but with zwave-js the “set” is on a targetValue. Have you checked the topics via MQTT Explorer to be sure?

UID: mqtt:topic:f06f8352c2:Switches
label: Power Switches
thingTypeUID: mqtt:topic
configuration: {}
bridgeUID: mqtt:broker:253a91e196
location: Power Switches
channels:
  - id: Mud_Room_Lights_n
    channelTypeUID: mqtt:switch
    label: Mud Room Lights
    configuration:
      commandTopic: zwave1/Lights_-_4/switch_binary/endpoint_0/targetValue/set
      stateTopic: zwave1/Lights_-_4/switch_binary/endpoint_0/currentValue
      transformationPattern:
        - JSONPATH:$.value
      off: "false"
      on: "true"

Hello and thanks for your quick response.

Nanoleaf dont use MQTT by default, the Panels are used by the Nanoleaf Binding as a Color lamp.

I’m not shure i think right about “Generic MQTT Device” in openHAB. For me, i think i can use it as a “bridge” between a “normal Item” in openHAB and any other MQTT used Home Automation System.
For e.g. what i mean:

Lamp in OH → exposed as a MQTT Device → Controlled by Home Assistant

I think i need a lot of rules for that, right?

I guess there is no integration in HA for nano leaf? You could check out the event bus in the marketplace

If you want to expose the device to HA, why not use the Matter binding and expose the items as Matter device…

There is integration with HA, but this does not allow you to control the panels individually.

You’re my hero. I had the same idea myself, but after asking ChatGPT, it said that openHAB couldn’t be used as a Matter Bridge, so I didn’t try any further.

But it works as it should.:+1:

1 Like