Setting Brightness always makes it lowest

I have fresh HA install with some zigbee rotary dimmer added directly through zigbee usb dongle thingie.

Dimmer works fine on its own (its the kind that attaches to light wires directly, and functions even when not paired to hub). When tested through Tuya gateway everything works fine both ways.

When paired to HA I can’t set brightness correctly.
On/Off works.
HA correctly receives brightness and on/off updates in real-time when I molest knob.
Problem: Setting brightness through widget or script always makes it go to lowest.
Sometimes HA shows brightness set to lowest, but usually it lies that its set to what I clicked at.

I tried power-cycling dimmer in question, on first power-on through HA it set light to ~50%, afterwards every click made it go to lowest again.

Do I have to configure something, or is it just not supported?

Dongle is identified in HA as

EZSP = Silicon Labs EmberZNet protocol: Elelabs, HUSBZB-1, Telegesis
by ZHA 

Zigbee info

IEEE: 84:b4:db:ff:fe:ef:c8:b2
Nwk: 0x0000
Device Type: Coordinator
LQI: 255
RSSI: Unknown
Last Seen: 2022-12-09T18:46:17
Power Source: Mains 

Dimmer is identified in HA as

by _TZE200_dfxkcots 

Zigbee info

IEEE: 60:a4:23:ff:fe:fc:d7:9f
Nwk: 0x2816
Device Type: Router
LQI: 96
RSSI: -76
Last Seen: 2022-12-09T19:16:57
Power Source: Mains
Quirk: zhaquirks.tuya.ts0601_dimmer.TuyaSingleSwitchDimmer

Devtools yaml:

  - brightness
off_with_transition: false
off_brightness: null
friendly_name: Dimmer Switch Light
supported_features: 32
color_mode: brightness
brightness: 224

(Brightness goes from 2 to 254)

The issue turned out to be that my dimmer appears to operate in range 0-65535 not in assumed 0-255, because zigbee market is unstandardized mess :confused:
With 8bit range hardcoded in code there’s nothing that can be done through config. Ugh.
So value always gets trimmed to less that 1%.

To test I just threw

level = int(level/255*65535)

in code and now HA matches behavior of manually molesting dimmer knob…