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

Setting a dimlevel of 1 (out of 254) causes domoticz to show the lights as "off" #144

Open
basrieter opened this issue Jan 27, 2024 · 0 comments

Comments

@basrieter
Copy link
Contributor

basrieter commented Jan 27, 2024

Recently I noticed that I could set the dimmers of lights to a value of 1 (out of 254). This causes the plugin to round the dim level to 0 and thus making Domoticz think they are switched off.

Changing the dimmer section in plugin.py to this fixes the problem:

# Dimmer
if ikea_device.Level is not None:
    if override_level is None:
        # The remote can make the dimmer value 1 (out of 254) resulting in 0 as level.
        level_number = int(round_half_up(ikea_device.Level / 2.54)) or 1
        level = str(level_number)
    else:
        level = override_level

    if (Devices[Unit].nValue != ikea_device.State) or (
        Devices[Unit].sValue != str(level)
    ):
        Devices[Unit].Update(
            nValue=2 if ikea_device.State else 0, sValue=str(level)
        )
@basrieter basrieter changed the title Setting a dimlevel of 1% causes domoticz to show the lights as "off" Setting a dimlevel of 1 (out of 254) causes domoticz to show the lights as "off" Jan 27, 2024
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