Zigbee2MQTT button event , trigger & increase brightness

Hi,

I just configured CC2531 Zigbee USB Dongle with zigbee2MQTT.
it works fine with my own mqtt server.

data_path: /config/zigbee2mqtt
devices: devices.yaml
groups: groups.yaml
homeassistant: true
permit_join: true
mqtt:
  base_topic: zigbee2mqtt
  server: 'mqtt://192.168.0.25:1883'
serial:
  port: /dev/ttyACM0
advanced:
  pan_id: 6754
  channel: 11
  network_key:
    - 1
    - 3
    - 5
    - 7
    - 9
    - 11
    - 13
    - 15
    - 0
    - 2
    - 4
    - 6
    - 8
    - 10
    - 12
    - 13
  availability_blacklist: []
ban: []
whitelist: []
queue: {}
socat:
  enabled: true
  master: 'pty,raw,echo=0,link=/dev/ttyZ2M,mode=777'
  slave: 'tcp-listen:8485,keepalive,nodelay,reuseaddr,keepidle=1,keepintvl=1,keepcnt=5'
  restartdelay: 1
  initialdelay: 1
  options: '-d -d'
  log: false
core-ssh: '/share/zigbee2mqtt#'
disable_led: true

# Configure a default setup of Home Assistant (frontend, api, etc)
default_config:

# Uncomment this if you are using SSL/TLS, running in Docker container, etc.
# http:
#   base_url: example.duckdns.org:8123

# Text to speech
tts:
  - platform: google_translate

#group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml

mqtt:
  broker: 127.0.0.1 # This will have to be your mqtt broker
  port: 1883
  discovery: true

input_boolean:
  zigbee_permit_join:
    name: Allow devices to join
    initial: on
    icon: mdi:cellphone-wireless

timer:
  zigbee_permit_join:
    name: Time remaining
    duration: 600

sensor:
  - platform: mqtt
    name: Bridge state
    state_topic: "zigbee2mqtt/bridge/state"
    icon: mdi:router-wireless

group:
  zigbee_group:
    name: Zigbee
    entities:
      - input_boolean.zigbee_permit_join
      - timer.zigbee_permit_join
      - sensor.bridge_state

automation:
  - id: enable_zigbee_join
    alias: Enable Zigbee joining
    #hide_entity: true
    trigger:
      platform: state
      entity_id: input_boolean.zigbee_permit_join
      to: 'on'
    action:
    - service: mqtt.publish
      data:
        topic: zigbee2mqtt/bridge/config/permit_join
        payload: 'true'
    - service: timer.start
      data:
        entity_id: timer.zigbee_permit_join
  - id: disable_zigbee_join
    alias: Disable Zigbee joining
    trigger:
    - entity_id: input_boolean.zigbee_permit_join
      platform: state
      to: 'off'
    action:
    - data:
        payload: 'false'
        topic: zigbee2mqtt/bridge/config/permit_join
      service: mqtt.publish
    - data:
        entity_id: timer.zigbee_permit_join
      service: timer.cancel
    hide_entity: true
  - id: disable_zigbee_join_timer
    alias: Disable Zigbee joining by timer
    hide_entity: true
    trigger:
    - platform: event
      event_type: timer.finished
      event_data:
        entity_id: timer.zigbee_permit_join
    action:
    - service: mqtt.publish
      data:
        topic: zigbee2mqtt/bridge/config/permit_join
        payload: 'false'
    - service: input_boolean.turn_off
      data:
        entity_id: input_boolean.zigbee_permit_join

Now, i would like to use OSRAM SMART+ button to increase or decrease light walue.

Here is MQTT payload :

zigbee2mqtt:info  2020-02-22 11:34:59: Successfully configured '0x000d6f001019e83a'
zigbee2mqtt:info  2020-02-22 11:37:15: MQTT publish: topic 'zigbee2mqtt/0x000d6f001019e83a', payload '{"action":"circle_click","linkquality":68}'
zigbee2mqtt:info  2020-02-22 11:37:15: MQTT publish: topic 'zigbee2mqtt/0x000d6f001019e83a', payload '{"linkquality":68,"action":""}'
zigbee2mqtt:info  2020-02-22 11:37:16: MQTT publish: topic 'zigbee2mqtt/0x000d6f001019e83a', payload '{"linkquality":73,"action":"up"}'
zigbee2mqtt:info  2020-02-22 11:37:16: MQTT publish: topic 'zigbee2mqtt/0x000d6f001019e83a', payload '{"linkquality":73,"action":""}'
zigbee2mqtt:info  2020-02-22 11:37:18: MQTT publish: topic 'zigbee2mqtt/0x000d6f001019e83a', payload '{"linkquality":76,"action":"down"}'
zigbee2mqtt:info  2020-02-22 11:37:18: MQTT publish: topic 'zigbee2mqtt/0x000d6f001019e83a', payload '{"linkquality":76,"action":""}'
zigbee2mqtt:info  2020-02-22 11:37:19: MQTT publish: topic 'zigbee2mqtt/0x000d6f001019e83a', payload '{"linkquality":76,"action":"circle_click"}'
zigbee2mqtt:info  2020-02-22 11:37:19: MQTT publish: topic 'zigbee2mqtt/0x000d6f001019e83a', payload '{"linkquality":76,"action":""}'
zigbee2mqtt:info  2020-02-22 11:37:20: MQTT publish: topic 'zigbee2mqtt/0x000d6f001019e83a', payload '{"linkquality":76,"action":"up"}'
zigbee2mqtt:info  2020-02-22 11:37:20: MQTT publish: topic 'zigbee2mqtt/0x000d6f001019e83a', payload '{"linkquality":76,"action":""}'

Here is MQTT payload for lamp :

zigbee2mqtt:info  2020-02-22 11:45:06: MQTT publish: topic 'zigbee2mqtt/0x84182600000f971c', payload '{"state":"ON"}'
zigbee2mqtt:info  2020-02-22 11:45:10: MQTT publish: topic 'zigbee2mqtt/0x84182600000f971c', payload '{"state":"OFF"}'
zigbee2mqtt:info  2020-02-22 12:12:21: MQTT publish: topic 'zigbee2mqtt/0x84182600000f971c', payload '{"state":"ON","brightness":66}'
zigbee2mqtt:info  2020-02-22 12:12:24: MQTT publish: topic 'zigbee2mqtt/0x7cb03eaa0a05cd84', payload '{"state":"ON","brightness":112}'

I do not really know how i can change brightness value with a button.
Is someone can help me whith this ?
Thank.

You can try this :

1 Like

Will try it tomorrow , thanks.

Hi,

I am the creator of ControllerX. I do not have support for that controller yet, but you can open a “New Device” issue and fill the form in there. I will basically need what are the states the button takes when pressing or holding which button. Something similar of what you posted, but with more detail on which button was pressed and a list of all possible states it can take.