Milight Nightmode available in LUA or JSON ?

Others (MiLight, Hue, Toon etc...)

Moderator: leecollings

Post Reply
User avatar
cyberclwn
Posts: 105
Joined: Thursday 20 August 2015 22:53
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.4
Location: The Netherlands
Contact:

Milight Nightmode available in LUA or JSON ?

Post by cyberclwn »

Hey guys,

Anoyone know if it is possible to turn on nightmodeby a LUA-script or using a JSON call ?

To set a milight to white using a switch, i use thia url for the "on" action:
http://x.x.x.x:x/json.htm?type=command&param=setcolbrightnessvalue&idx=81&hex=ffffff&brightness=100&iswhite=true


But i can't find how to set the also available nightmode for a rgbw-bulb.
(nightmode is whitelight at about 3%)

Thanks

ps. i searched for nightmode and couldn't find anything about it .. )
3xPi 2B (Domoticz "live", Domoticz "sandbox", PhotoFrame)
RFXCom433(E), KaKu, Oregon Scientific, Keyes 2-relay, Logitech Media Server, MiLight, Smartwares heating controller(2x), IR Send/Receive, Keyes PIR, XH-M131 DuskSensor, DHT22/11
Nautilus
Posts: 722
Joined: Friday 02 October 2015 12:12
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Finland
Contact:

Re: Milight Nightmode available in LUA or JSON ?

Post by Nautilus »

This works for me:

Code: Select all

		appLampNight = function()
		{
			$.ajax({
				 url: "json.htm?type=command&param=nightlight&idx=" + $.devIdx,
				 async: false,
				 dataType: 'json'
			});
		}
Found in ../domoticz/www/app/LightsController.js. There should also be the button for this on the "edit" screen of your Milight switch.
User avatar
cyberclwn
Posts: 105
Joined: Thursday 20 August 2015 22:53
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.4
Location: The Netherlands
Contact:

Re: Milight Nightmode available in LUA or JSON ?

Post by cyberclwn »

Hey,

Thanks, with that JSON call i can do what i want.
3xPi 2B (Domoticz "live", Domoticz "sandbox", PhotoFrame)
RFXCom433(E), KaKu, Oregon Scientific, Keyes 2-relay, Logitech Media Server, MiLight, Smartwares heating controller(2x), IR Send/Receive, Keyes PIR, XH-M131 DuskSensor, DHT22/11
User avatar
sincze
Posts: 1302
Joined: Monday 02 June 2014 22:46
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.4
Location: Netherlands / Breda Area
Contact:

Re: Milight Nightmode available in LUA or JSON ?

Post by sincze »

Nautilus wrote:This works for me:

Code: Select all

		appLampNight = function()
		{
			$.ajax({
				 url: "json.htm?type=command&param=nightlight&idx=" + $.devIdx,
				 async: false,
				 dataType: 'json'
			});
		}
Found in ../domoticz/www/app/LightsController.js. There should also be the button for this on the "edit" screen of your Milight switch.
That i have to see. Thanks :D any more tricks where this one came from???
Pass2php
LAN: RFLink, P1, OTGW, MySensors
USB: RFXCom, ZWave, Sonoff 3
MQTT: ZIgbee2MQTT,
ZWAVE: Zwave-JS-UI
WIFI: Mi-light, Tasmota, Xiaomi Shelly
Solar: Omnik, PVOutput
Video: Kodi, Harmony HUB, Chromecast
Sensors: You name it I got 1.
Nautilus
Posts: 722
Joined: Friday 02 October 2015 12:12
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Finland
Contact:

Re: Milight Nightmode available in LUA or JSON ?

Post by Nautilus »

sincze wrote:
That i have to see. Thanks :D any more tricks where this one came from???
Just check the file I mentioned (https://github.com/domoticz/domoticz/bl ... troller.js) for anything interesting, like appLampDiscoModeNum, appLampSetKelvin...:)
User avatar
sincze
Posts: 1302
Joined: Monday 02 June 2014 22:46
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.4
Location: Netherlands / Breda Area
Contact:

Re: Milight Nightmode available in LUA or JSON ?

Post by sincze »

Nautilus wrote:
sincze wrote:
That i have to see. Thanks :D any more tricks where this one came from???
Just check the file I mentioned (https://github.com/domoticz/domoticz/bl ... troller.js) for anything interesting, like appLampDiscoModeNum, appLampSetKelvin...:)
Got it :D , found some nice easter eggs.

Code: Select all

SetColValue = "json.htm?type=command&param=setcolbrightnessvalue&idx=" + idx + "&hue=" + hue + "&brightness=" + brightness + "&iswhite=" + isWhite
appLampBrightnessUp = "json.htm?type=command&param=brightnessup&idx=" + $.devIdx
appLampBrightnessDown = "json.htm?type=command&param=brightnessdown&idx=" + $.devIdx
appLampDiscoUp = "json.htm?type=command&param=discoup&idx=" + $.devIdx
appLampDiscoDown = "json.htm?type=command&param=discodown&idx=" + $.devIdx
appLampDiscoMode = "json.htm?type=command&param=discomode&idx=" + $.devIdx
appLampDiscoModeNum = "json.htm?type=command&param=discomodenum" + mode + "&idx=" + $.devIdx
appLampSetKelvin = "json.htm?type=command&param=setkelvinlevel&idx=" + $.devIdx + "&kelvin=" + kelvin
appLampSpeedUp = "json.htm?type=command&param=speedup&idx=" + $.devIdx
appLampSpeedUpLong = "json.htm?type=command&param=speeduplong&idx=" + $.devIdx
appLampSpeedDown = "json.htm?type=command&param=speeddown&idx=" + $.devIdx
appLampSpeedMin = "json.htm?type=command&param=speedmin&idx=" + $.devIdx
appLampSpeedMax = "json.htm?type=command&param=speedmax&idx=" + $.devIdx
appLampWarmer = "json.htm?type=command&param=warmer&idx=" + $.devIdx
appLampFull = "json.htm?type=command&param=fulllight&idx=" + $.devIdx
appLampWhite = "json.htm?type=command&param=whitelight&idx=" + $.devIdx
appLampNight = "json.htm?type=command&param=nightlight&idx=" + $.devIdx
Pass2php
LAN: RFLink, P1, OTGW, MySensors
USB: RFXCom, ZWave, Sonoff 3
MQTT: ZIgbee2MQTT,
ZWAVE: Zwave-JS-UI
WIFI: Mi-light, Tasmota, Xiaomi Shelly
Solar: Omnik, PVOutput
Video: Kodi, Harmony HUB, Chromecast
Sensors: You name it I got 1.
darkside0506
Posts: 3
Joined: Tuesday 18 April 2017 10:58
Target OS: Windows
Domoticz version:
Contact:

Re: Milight Nightmode available in LUA or JSON ?

Post by darkside0506 »

Nice find.

When I use it though, Disco+ slows down the disco mode and disco- speeds it up. I also can't get the discomodenum to send a command to rflink properly. Have you had any success with changing disco mode number?
luclodder
Posts: 1
Joined: Tuesday 02 January 2018 13:09
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Milight Nightmode available in LUA or JSON ?

Post by luclodder »

I believe DiscoUP and Down does not change the speed of the disco effect. But it does change to the next (up) or previous (down) discomode.
Post Reply