Skip to content

Set state of ON_OFF_SWITCH #18

Answered by luar123
rot169 asked this question in Q&A
Jan 10, 2025 · 3 comments · 6 replies
Discussion options

You must be logged in to vote

I found a work around to make switches work with some lambdas and zigbee sdk knowledge:

  1. add the needed client clusters, for some switches those can be added by simply adding an endpoint with the correct device id:
endpoints:
    - num: 4
      device_type: ON_OFF_SWITCH
  1. Then look up the correct commands and create a lambda. Toggle command for on_off switch is:
on_press:
      then:
        #- zigbee.report: zb
        - lambda: |-
            esp_zb_zcl_on_off_cmd_t cmd_req;
            cmd_req.zcl_basic_cmd.src_endpoint = 4; // switch endpoint, same as ep definition
            cmd_req.address_mode = ESP_ZB_APS_ADDR_MODE_DST_ADDR_ENDP_NOT_PRESENT;
            cmd_req.on_off_cmd_id =…

Replies: 3 comments 6 replies

Comment options

You must be logged in to vote
2 replies
@luar123
Comment options

Answer selected by luar123
@rot169
Comment options

Comment options

You must be logged in to vote
3 replies
@luar123
Comment options

@rot169
Comment options

@luar123
Comment options

Comment options

You must be logged in to vote
1 reply
@luar123
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants