Hyrules / WinHue

Controlling the Philips Hue lighting system from your Windows PC.
http://hyrules.github.io/WinHue/
Other
185 stars 40 forks source link

Cant save or edit rules. Error serializing object #242

Closed ppprokurator closed 5 years ago

ppprokurator commented 5 years ago

Hi

Your setup

WinHue version : 3.0.4666.0 Bridge api version : 1.32.0

Expected behavior and actual behavior

I'm trying to create or edit existing rules and after that, save it.

Actual behavior

I cant add or edit existing rules, even though I edit rule I created few months ago using Winhue. I can create sensors, add lights and so on. No matter what I insert into rule form. ...

Steps to reproduce the problem

1) Connect to bridge. 2) Slide down to the rules. 3) Click "Edit" on any rule, the window with its properties appears. 4) without any change in parameters click "Save" 5) Error appears "One or more errors occured while creating the object Type: -2 . A unknown error occured. at address: http://bridgeip/api/key/rules/4.

Same error when creating new rule.

I checked the Event Log and I found errors WinHue3.Philips_Hue.Communication.Serializer Method ModifyJsonObject line 97 Error serializing object Syp-mainSwitch2long1 Syp-mainSwitch2long1 is example of one of mine rules.

Thanks and best regards

Hyrules commented 5 years ago

I will take a look at this. Thanks for reporting.

Hyrules commented 5 years ago

WinHue 3.0.4684.0 Setup.zip

Try this version and let me know what happens.

ppprokurator commented 5 years ago

Hyrules, I tested it quickly and it looks ok. I can create and edit existing rules :). That bug was connected with bridge api version?

Hyrules commented 5 years ago

No there was an error in the serialization sequence. I've been modifying the serialization of certain types of objects lately making it simpler and I must have missed this one. Serialization of objects in WinHue is rather touchy. You have to make the object a JSON string to talk to the bridge. Bridge accepts specific hue object properties at creation but different field at modification this can cause a level of complexity and since I don't use any kind of API to contact the bridge I have to invent the code myself. I always try to simplify things. I rewrite certain parts of the code from time to time making it simpler but this can induce some bugs. I've been trying to implement TestUnits in order to catch that but it's long and boring.

ppprokurator commented 5 years ago

I understand, thanks for explanation. Thanks again for your fast reaction, have a nice day.