Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dimmer value capped at 100 regardless of dimmermax setting #10

Open
seronich opened this issue May 22, 2024 · 0 comments
Open

dimmer value capped at 100 regardless of dimmermax setting #10

seronich opened this issue May 22, 2024 · 0 comments

Comments

@seronich
Copy link

Looks like the issue is in local function procmessages.lua: process_message(topic, msg)

in this block, the numvalue is capped at 100 before the check for dimmermax by the line
if numvalue > 100 then; numvalue = 100; end
which comes before the check for dimmermax


elseif dtype == 'Dimmer' then
          local numvalue = tonumber(value)
          if numvalue then
            log.debug ('Dimmer value received:', numvalue)
            if numvalue < 0 then; numvalue = 0; end
            if numvalue > 100 then; numvalue = 100; end
            
            if device.preferences.dimmermax then
              if numvalue > device.preferences.dimmermax then
                numvalue = device.preferences.dimmermax
              end
            end
            
            device:emit_event(capabilities.switchLevel.level(numvalue))
            
            if device:supports_capability_by_id('switch') then
              if numvalue > 0 then
                device:emit_event(capabilities.switch.switch('on'))
              else
                device:emit_event(capabilities.switch.switch('off'))
              end
            end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant