empierre / MyDomoAtHome

MyDomoAtHome - REST interface for ImperoHome with Domoticz (ISS)
http://domoticz.com/wiki/ImperiHome
GNU General Public License v3.0
32 stars 22 forks source link

Milight wrong value #141

Closed mariuszlabedzki closed 6 years ago

mariuszlabedzki commented 7 years ago

Hi I have strange situation, maybe someone can help me. I have RGBW milight lamp, and mydomo show wrong value:

  {
     "AddjMulti" : 1.0,
     "AddjMulti2" : 1.0,
     "AddjValue" : 0.0,
     "AddjValue2" : 0.0,
     "BatteryLevel" : 255,
     "CustomImage" : 0,
     "Data" : "On",
     "Description" : "",
     "Favorite" : 1,
     "HardwareID" : 4,
     "HardwareName" : "milight",
     "HardwareType" : "Limitless/AppLamp/Mi Light with LAN/WiFi interface",
     "HardwareTypeVal" : 22,
     "HaveDimmer" : true,
     "HaveGroupCmd" : false,
     "HaveTimeout" : false,
     "ID" : "1",
     "Image" : "Light",
     "IsSubDevice" : false,
     "LastUpdate" : "2017-04-27 20:54:51",
     "Level" : 100,
     "LevelInt" : 100,
     "MaxDimLevel" : 100,
     "Name" : "Lampka",
     "Notifications" : "false",
     "PlanID" : "4",
     "PlanIDs" : [ 4 ],
     "Protected" : false,
     "ShowNotifications" : true,
     "SignalLevel" : "-",
     "Status" : "On",
     "StrParam1" : "",
     "StrParam2" : "",
     "SubType" : "RGBW",
     "SwitchType" : "Dimmer",
     "SwitchTypeVal" : 7,
     "Timers" : "true",
     "Type" : "Lighting Limitless/Applamp",
     "TypeImg" : "dimmer",
     "Unit" : 3,
     "Used" : 1,
     "UsedByCamera" : false,
     "XOffset" : "0",
     "YOffset" : "0",
     "idx" : "24"
  },

-------------- mydomo response --------------------- {"id":"24","name":"Lampka","type":"DevRGBLight","params":[{"key":"Status","value":0}]}

why mydomo is showing 0 ?

Thanks for any help

mariuszlabedzki commented 7 years ago

ok i found the issue

in function: DevRGBLight

we have something like:

if (data.Status.match(/Set Level/) || (data.HaveDimmer === 'true'))

but data.HaveDimmer is not a string, so we can add checking for bool value:

if (data.Status.match(/Set Level/) || (data.HaveDimmer === 'true') || (data.HaveDimmer === true)) {

empierre commented 6 years ago

thanks for reporting and testing, integrated