Function Hue_Farbe(ByRef light, ByRef state, ByVal sat, ByVal bri, ByVal hue)
Hue_Farbe=False
'*************************************************************************************************************************************
'Funktion um Philips HUE Farben zu ändern
'*************************************************************************************************************************************
Dim sat2, hue2, bri2
Dim IP, Username
Dim MyURL , postData
Dim winHttpReq
Set winHttpReq = CreateObject("WinHttp.WinHttpRequest.5.1")
IP=192.168.178.xxx
Username=123456789
MyURL = "http://"&IP&"/api/"&Username&"/lights/" & light & "/state"
'Umrechung Werte
bri =Round ( bri/100*255)
hue =Round ( hue/360*65280)
sat =Round ( sat/100*255)
'ShowSystemAlarm "bri: " & bri & " hue: " & hue & " sat: " & sat '...
'sat zu Anfrage hinzufügen wenn größer als 1
If sat >1 Then
sat2 = ",""sat"": "& sat &""
End If
'bri zu Anfrage hinzufügen wenn größer als 1
If bri >1 Then
bri2 = ",""bri"": "& bri &""
End If
'hue zu Anfrage hinzufügen wenn größer als 1
If hue >1 Then
hue2 = ",""hue"": "& hue &""
End If
'Farbe Wechseln
postData = "{""on"": true "&sat2&" "&bri2&" "&hue2&"}"
winHttpReq.Open "PUT", MyURL, False
winHttpReq.Send (postData)
Hue_Farbe=True
End Function