UselessMnemonic / OpenWiz

A C# library for remote controlling Wiz brand smart lights
MIT License
22 stars 3 forks source link

Dimming not setting properly #2

Open isaacrlevin opened 3 years ago

isaacrlevin commented 3 years ago

Hey there! I assume this is more a light issue than an issue with the library, but I wanted to see if you have this experience. I can update my dimming just fine, but when it is set to 100, it is nowhere near full brightness, and anything more than that gives an error. Here is some sample code to work with.

var command = new WizParams();
command.State = true;
command.Dimming = 150;//_options.LightSettings.Wiz.Brightness;
command.Speed = 0;
command.R = 255;
command.B = 0;
command.G = 0;

UpdateLight(command, lightMacAddress);

private WizResult UpdateLight(WizParams wizParams, string lightId)
{
    WizSocket socket = new WizSocket();
    socket.GetSocket().EnableBroadcast = true; // This will enable sending to the broadcast address
    socket.GetSocket().ReceiveTimeout = 1000; // This will prevent the demo from running indefinitely
    WizHandle handle = new WizHandle(lightId, IPAddress.Broadcast); // MAC doesn't matter here

    WizState state = new WizState
    {
        Method = WizMethod.setPilot,
        Params = wizParams
    };

    socket.SendTo(state, handle);

    WizResult pilot;
    while (true)
    {
        state = socket.ReceiveFrom(handle);
        pilot = state.Result;
        break;
    }
    return pilot;
}
UselessMnemonic commented 3 years ago

Hi @isaacrlevin ! I swear I check up regularly, so sorry for the wait. I'll try to get the fix up today.

UselessMnemonic commented 3 years ago

So after a bit of finessing, I realized that the hue LEDs aren't as perceivably bright as the cool/warm white LEDs.

I played with Params.Dimming (by the way, values here are in [10, 100]) and no max colored LED produces as intense a light. You could try using the white LED's in tandem, but the final color looses a lot of saturation.

isaacrlevin commented 3 years ago

Makes sense, except why does the app allow you to have full brightness when you change color

Get Outlook for Androidhttps://aka.ms/ghei36


From: Christopher Madrigal notifications@github.com Sent: Wednesday, March 3, 2021 6:28:53 PM To: UselessMnemonic/OpenWiz OpenWiz@noreply.github.com Cc: Isaac Levin isaac.r.levin@gmail.com; Mention mention@noreply.github.com Subject: Re: [UselessMnemonic/OpenWiz] Dimming not setting properly (#2)

So after a bit of finessing, I realized that the hue LEDs aren't as perceivably bright as the cool/warm white LEDs.

I played with Params.Dimming (by the way, values here are in [10, 100]) and no max colored LED produces as intense a light. You could try using the white LED's in tandem, but the final color looses a lot of saturation.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/UselessMnemonic/OpenWiz/issues/2#issuecomment-790235952, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ACDXTJTTI2VXKCGBFCFU7OTTB3V6LANCNFSM4YC3HZSQ.

UselessMnemonic commented 3 years ago

The controls on the app map more or less directly to the parameters for setPilot. I went ahead and selected full bright red on the app. This is part of the result of getPilot:

{
  "method" : "getPilot",
  "result" : {
    "rssi" : -54,
    "state" : true,
    "sceneId" : 0,
    "r" : 255,
    "dimming" : 100
  }
}

I tried manually setting the same color, and I get the same result. Full brightness on the app doesn't correlate to physical brightness.

isaacrlevin commented 3 years ago

That is really odd. If I set dimming to 100, like below, the light is nowhere near as bright as setting red in the app

WizSocket socket = new WizSocket();
socket.GetSocket().EnableBroadcast = true; // This will enable sending to the broadcast address
socket.GetSocket().ReceiveTimeout = 1000; // This will prevent the demo from running indefinitely
WizHandle handle = new WizHandle(lightId, IPAddress.Broadcast); // MAC doesn't matter here

WizState state = new WizState
{
    Method = WizMethod.setPilot,
    Params = new WizParams{
         State = true,
         Dimming = 100,
         Speed = 0,
         R = 255,
         B = 0,
         G = 0
    }
};

socket.SendTo(state, handle);

WizResult pilot;
while (true)
{
    state = socket.ReceiveFrom(handle);
    pilot = state.Result;
    break;
}
UselessMnemonic commented 3 years ago

Which particular bulb are you using? I have tested only with the BR30 model, so perhaps your bulb needs some extra configuration.

Alternatively, how often do you send updates? I find that frequent updates cause the bulb to stop mid-transition.

isaacrlevin commented 3 years ago

I have an A19 bulb

Get Outlook for Androidhttps://aka.ms/ghei36


From: Christopher Madrigal notifications@github.com Sent: Thursday, March 4, 2021 6:09:16 PM To: UselessMnemonic/OpenWiz OpenWiz@noreply.github.com Cc: Isaac Levin isaac.r.levin@gmail.com; Mention mention@noreply.github.com Subject: Re: [UselessMnemonic/OpenWiz] Dimming not setting properly (#2)

Which particular bulb are you using? I have tested only with the BR30 model, so perhaps your bulb needs some extra configuration.

Alternatively, how often do you send updates? I find that frequent updates cause the bulb to stop mid-transition.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/UselessMnemonic/OpenWiz/issues/2#issuecomment-791092529, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ACDXTJSXUPMMNQQRY6OQTXLTCA4MZANCNFSM4YC3HZSQ.

UselessMnemonic commented 3 years ago

Could you post a link to the item you bought, by chance? I see a few labeled A19, I just want to be sure I grab the same one.

isaacrlevin commented 3 years ago

https://www.homedepot.com/p/WiZ-60W-Equivalent-A19-Colors-and-Tunable-White-Wi-Fi-Connected-Smart-LED-Light-Bulb-IZ0126081/303142930

isaacrlevin commented 3 years ago

Any update here?

UselessMnemonic commented 3 years ago

Hi there, sorry about the wait, I've gotten busier with work and I'm having troubles securing a bulb

isaacrlevin commented 3 years ago

Did a bit more digging here. It seems that if you increase Dimming to over 100, you will get a an Invalid params message

image

Since 100 dimming is pretty dark, I think the issue is related to not accepting more than 100. For instance, I tried doing this in Python with pywizlight and had no issues setting the dimming to 255.

Disregard the nonsense about dimming over 255, I realized that that pywizlight also uses 0-100

isaacrlevin commented 2 years ago

@UselessMnemonic now that you have a light. Can you try to repro what I am seeing here?

djniuss commented 2 years ago

Same problem with A19 bulb

isaacrlevin commented 2 years ago

Hey @UselessMnemonic coming back here to see if you have had a chance to look at this. I can try to debug, but I am not sure how you debug this issue

Tungsten66 commented 1 year ago

Hello @UselessMnemonic checking to see if had any ideas with the dimming of the A19 bulb