The firmware supports two PWM types: software and hardware.

Software, configurable 1, 2, 3, 5 kHz – the firmware can generate the PWM signal on any pin. The higher frequency requires more CPU resources. The frequency may slightly float. You may configure up to two PWM outputs in the configuration.

Hardware, configurable 1, 2, 4, 8, 16, 32, 64, 128 kHz – the firmware uses the hardware PWM generator on the chip. The PWM duty cycle has 256 states (8 bits). It is precise and does not use CPU resources, but it can work on the following pins only:

PWM #1 pins: P13, P14, P16, P17 (one of these pins)
PWM #2 pins: P10, P11, P20, P23 (one of these pins)

If the frequency of all PWM is identical, you may create up to four hardware PWM.

PWM #1 pins: P13 or P16
PWM #2 pins: P10 or P20
PWM #3 pins: P14 or P17
PWM #4 pins: P11 or P23

If a PWM output is linked to a corresponding input (e.g. Input 2 – Output 2), the input can control the PWM state:

  1. If the “switch” option for a linked input is “off” and the “Linked input” option for the PWM output is “Changes level”, every click changes the PWM level value step-by-step (12 steps, cyclic, 0 – 20 – 40 .. 240 – 255 – 0).
  2. If the “switch” option for a linked input is “off” and the “Linked input” option is “On/Off,” every click toggles the state of the PWM output from ON to OFF and vice versa. If you press and hold the linked button, the firmware will change the PWM level value step-by-step (12 steps, cyclic, 0 – 20 – 40 .. 240 – 255 0).
  3. If the “switch” option for input is “on,” the switch changes the output state to on or off. The firmware can remember the PWM level before switching off and restore it after switching on. You can set the exact PWM level from a bounded control or a coordinator.

Transition – defines the time interval when the firmware smoothly changes the level value from 0 to 254. The firmware calculates the corresponding time interval for short transitions. If the transition time is zero, the firmware immediately changes the PWM level.

Linked input – change the mode if a linked push button.

Remember state – the firmware saves the last state of the PWM output and restores it after power loss.

Inverter – if this options is on, the firmware decreases the duty cycle of a PWM output. So, the maximum level means the permanent LOW state of a PWM output.

Zigbee attributes: ATTRID_LEVEL_CURRENT_LEVEL (uint8)
Zigbee commands: read, write, moveToLevel, moveToLevelWithOff

Zigbee attributes: ATTRID_IOV_BASIC_PRESENT_VALUE (float, range: 0-255)
Zigbee commands: read, write

Zigbee2MQTT commands

on/off – Look for commands and examples for GPIO outputs.
write – sets the PWM duty cycle.
Topic: z2m/[friedly_name]/[channel]/set/brightness
Channel: l1, l2, l3 … l8
Payload: value
Topic: z2m/[friedly_name]/set/[channel]
Channel: l1, l2, l3 … l8
Payload: {“brightness”: value, “transition”: 3}
value – 0 .. 254.
transition – (optional) the transition time in seconds between states.
read – reads the current value
Topic: z2m/[friedly_name]/[channel]/get/brightness
Payload: none
Returns: {“brightness_[channel]”: value}

Harvey Specter
Posted at 08:02 April 28, 2021

Is it possible to get a transition slider (like brightness slider, or text field) in zigbee2mqtt web interface? (in custom converter for Z2M).

Thanks for answer!

    Harvey Specter
    Posted at 08:40 April 28, 2021

    You should create and use a custom converter for your device. This slider will appear.

      Harvey Specter
      Posted at 14:09 April 28, 2021

      Button in ptvo creates custom converter without this slider. Where I can find info about transition variable for converter?

        Harvey Specter
        Posted at 03:34 April 29, 2021

        Sorry, but I didn’t understand your question correctly. Unfortunately, you cannot get a slider for a transition time.

Harvey Specter
Posted at 21:49 January 7, 2021

Thank you for your work!

I have write converter for Homeassistant-Zigbee2mqtt

Leave a Reply