Mi_light Ibox v6 (API) not working

Please use template to report bugs and problems. Post here your questions when not sure where else to post
Only for bugs in the Domoticz application! other problems go in different subforums!
Forum rules
Before posting here, make sure you are on the latest Beta or Stable version.
If you have problems related to the web gui, clear your browser cache + appcache first.

Use the following template when posting here:

Version: xxxx
Platform: xxxx
Plugin/Hardware: xxxx
Description:
.....

If you are having problems with scripts/blockly, always post the script (in a spoiler or code tag) or screenshots of your blockly

If you are replying, please do not quote images/code from the first post
ziaziung
Posts: 17
Joined: Friday 13 February 2015 11:23
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Mi_light Ibox v6 (API) not working

Post by ziaziung » Friday 06 January 2017 18:36

Thank you for your help.

I can't install ephem and remove to whole function is difficult : isday is called in other scripts.

User avatar
LumKitty
Posts: 26
Joined: Sunday 11 October 2015 12:50
Target OS: Raspberry Pi
Domoticz version: 3.5877
Location: South Wales, UK
Contact:

Re: Mi_light Ibox v6 (API) not working

Post by LumKitty » Monday 09 January 2017 3:42

I'm reworking how this is done to support ibox, and the IsDay function (and its dependency on ephem) is getting moved to a separate file, so hang fire and I'll have it sorted for you :)

User avatar
LumKitty
Posts: 26
Joined: Sunday 11 October 2015 12:50
Target OS: Raspberry Pi
Domoticz version: 3.5877
Location: South Wales, UK
Contact:

Re: Mi_light Ibox v6 (API) not working

Post by LumKitty » Monday 09 January 2017 4:39

New version up with dependency on ephem removed and a bit or reworking in how the commands are called, so it's now eg.

milight.zone[1].brightness(100)

Not had much testing (just on and off), and a lot of code has been moved around, so proceed with caution.

Also delete your old milight.dat as the new version does eg. milight3-192.168.1.1.dat so if you have multiple milight boxes they all have their own status stored separately.

matv
Posts: 23
Joined: Sunday 08 January 2017 19:26
Target OS: Raspberry Pi
Domoticz version: 3.5877
Location: EU
Contact:

Re: Mi_light Ibox v6 (API) not working

Post by matv » Tuesday 10 January 2017 21:48

Thanks for your effort and sharing, LumKitty!
I will test your script and get back to you after that.

Right now I am working whit another script but it does not function properly: https://github.com/bwydoogh/domoticz-scripts
Starting every line with '$ python milight-home.py', these are the responses:

ON 00 00 iBox turns on
OFF 00 00 iBox turns off
OFF 08 00 RGBWW bulb dims to low brightness
OFF 08 01 RGBWW bulb dims to low brightness

ON 07 00 Doesn't work
ON 07 01 Doesn't work
ON 08 00 Doesn't work
ON 08 01 Doesn't work
OFF 07 00 Doesn't work
OFF 07 01 Doesn't work

I already rebooted my Raspberry Pi, my iBox and re-linked my bulb to Zone1 in the app.
The RGBWW bulb works completely fine when using the app.

Do you by any chance have an idea why I can't turn ON/OFF my RGBWW bulb?

User avatar
LumKitty
Posts: 26
Joined: Sunday 11 October 2015 12:50
Target OS: Raspberry Pi
Domoticz version: 3.5877
Location: South Wales, UK
Contact:

Re: Mi_light Ibox v6 (API) not working

Post by LumKitty » Wednesday 11 January 2017 2:06

Looking at bwydoogh's scripts, are the iBox light commands identical to the zone commands only the 08 is replaced with 00? because that is different from what the limitless docs actually say.

(BTW, I have a few bad days of IRL coming up. Will still try to answer questions and fix bugs, but probably won't be attempting any more with the iBox light until the weekend)

bwydoogh
Posts: 10
Joined: Monday 26 December 2016 12:21
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Mi_light Ibox v6 (API) not working

Post by bwydoogh » Wednesday 11 January 2017 7:36

matv wrote:Thanks for your effort and sharing, LumKitty!
I will test your script and get back to you after that.

Right now I am working whit another script but it does not function properly: https://github.com/bwydoogh/domoticz-scripts
Starting every line with '$ python milight-home.py', these are the responses:

ON 00 00 iBox turns on
OFF 00 00 iBox turns off
OFF 08 00 RGBWW bulb dims to low brightness
OFF 08 01 RGBWW bulb dims to low brightness

ON 07 00 Doesn't work
ON 07 01 Doesn't work
ON 08 00 Doesn't work
ON 08 01 Doesn't work
OFF 07 00 Doesn't work
OFF 07 01 Doesn't work

I already rebooted my Raspberry Pi, my iBox and re-linked my bulb to Zone1 in the app.
The RGBWW bulb works completely fine when using the app.

Do you by any chance have an idea why I can't turn ON/OFF my RGBWW bulb?
Hi :). I'm using my script in combination with the iBox and 3 RGBWW bulbs in zone 1. I don't have any issue: OFF 00 00 and OFF 07 00 do turn off all the lights (both iBox and bulbs). So it looks strange to me that the OFF 07 00 command does nothing in your setup. Did you use the latest version of the script (changed yesterday), and if so, could you send me the debug messages (which are written in the milight-home.log file). Thanks in advance.

matv
Posts: 23
Joined: Sunday 08 January 2017 19:26
Target OS: Raspberry Pi
Domoticz version: 3.5877
Location: EU
Contact:

Re: Mi_light Ibox v6 (API) not working

Post by matv » Wednesday 11 January 2017 14:40

LumKitty wrote:Looking at bwydoogh's scripts, are the iBox light commands identical to the zone commands only the 08 is replaced with 00? because that is different from what the limitless docs actually say.

(BTW, I have a few bad days of IRL coming up. Will still try to answer questions and fix bugs, but probably won't be attempting any more with the iBox light until the weekend)
Took me some tinkering but I finally got it working :)
I made 3 versions: on, off and dim and the RBGWW-bulb responds perfectly.
Thanks a lot, this is what I was looking for.
Will start testing other things now, to be continued!
bwydoogh wrote:Did you use the latest version of the script (changed yesterday), and if so, could you send me the debug messages (which are written in the milight-home.log file). Thanks in advance.
PM Sent!

User avatar
LumKitty
Posts: 26
Joined: Sunday 11 October 2015 12:50
Target OS: Raspberry Pi
Domoticz version: 3.5877
Location: South Wales, UK
Contact:

Re: Mi_light Ibox v6 (API) not working

Post by LumKitty » Thursday 12 January 2017 2:18

Updated again. Please note that there is now a hard dependency on the "fasteners" module. Re-read the instructions to get this installed. iBox still isn't working as my motivation to fix that thing is low.

https://github.com/LumKitty/MiLight3

Changes:
  • Lockfile support
    Script will check to see if another instance is active and will wait up to 10 seconds for it to finish, then fail
    If writing your own scripts, please try not to leave sessions open. milight-temp.py shows a way to do this
  • IsDay moved to separate module and expanded
    For people who don't want to install ephem. The day/night functions are now in a separate module
  • Colour temperature support
    Default on/off scripts now detect day/night, select warm/cold as appropriate and do a nice fade
    New milight-temp.py script. Run it at sunset & sunrise via a domoticz scene and all lights that are currently switched on and set to white will gradually fade to warm white at night, and cold white in the morning. By default this takes an hour to run so probably want to call it via nohup (not tested this yet, but should work in theory)
Don't forget to set your longitude/lattitude/elevation in isday.py or people not from Wales may get strange results!

Not a change, but to save wear on your SD card, you might want to set STATUSFILE = "/tmp/milight/" in milightbox.py and ensure your /tmp directory is on tmpfs. Make sure to backup/restore this directory on shutdown/reboot if you don't want weirdness the first time you use each light after rebooting.

matv
Posts: 23
Joined: Sunday 08 January 2017 19:26
Target OS: Raspberry Pi
Domoticz version: 3.5877
Location: EU
Contact:

Re: Mi_light Ibox v6 (API) not working

Post by matv » Saturday 14 January 2017 15:27

Wow ! Beautiful fades you have going there! Really appreciated :)
Took me a while, tinkering with sudo pip install fasteners / python-dev / epem but I worked it out! Leanint along the way :geek:

I do notice quite some false-positives with 'milight-on.py 1' where the script execute but the E27 bulb does not turn on.
This happens about 4 out of 10 times I tested the -on script.
When I re-execute the -on script after a false-positive, the script only sends 3 commands (see below) and the lamp turns on with either full brightness instantly (I think that's the default behaviour after a false-positive?) OR with +- minimal brightness (this only happened once).

Code: Select all

1 sending message: 80 00 00 00 11 f5 01 00 00 00 31 00 00 08 04 01 00 00 00 01 00 3F Sent to IP: 192.168.2.54
1 sending message: 80 00 00 00 11 f5 01 00 01 00 31 00 00 08 03 64 00 00 00 01 00 A1 Sent to IP: 192.168.2.54
1 sending message: 80 00 00 00 11 f5 01 00 02 00 31 00 00 08 05 64 00 00 00 01 00 A3 Sent to IP: 192.168.2.54
I hope this testing is of any value to you. Don't want to come across too critical, I really love the fades!
If iBox is supported I'll help you testing that one too, let me know if I can test anything specific!

Question: I see isday.py checks for sunrise/sunset times. I see the milight-on.py uses these times to determine the temperature of the color. Is it possible to offset the sunset/sunrise times by x hours? eg "I want the color temperature to change 1 hour after sunset"?

- edit - Also tested the milight-temp now: amazing! I changed the values below for testing purposes. Works like a charm!

Code: Select all

DELAY = 1   # to see the actual effect in 1-2 minutes instead of 1 hour

if isday.IsDay():
	targettemp = 0   # bc it is day and the lamp was already at 100 temp

ziaziung
Posts: 17
Joined: Friday 13 February 2015 11:23
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Mi_light Ibox v6 (API) not working

Post by ziaziung » Saturday 14 January 2017 21:09

Thanks LumKitty and bwydoogh for your work.

@ bwydoogh :
What works :
python milight-home.py ON 07 01 turns ON all the GU10 lamps of the zone 01
python milight-home.py OFF 07 01 turns OFF all the GU10 lamps of the zone 01
python milight-home.py DISCO1 07 01 turns all the GU10 lamps of the zone 01 in DISCO mode



python milight-home.py ON 00 00 turns ON the ibox
python milight-home.py OFF 00 00 turns OFF the ibox
python milight-home.py DISCO1 00 00 turns the ibox in DISCO mode


python milight-home.py CMD "31 00 00 08 04 02 00 00 00 00" 07
python milight-home.py CMD "31 00 00 08 04 01 00 00 00 00" 07
python milight-home.py CMD "31 00 00 08 04 05 00 00 00 00" 07 all does nothing.

If I type python milight-home.py DISCO1 07 01, then python milight-home.py OFF 07 01 and then python milight-home.py ON 07 01 all the GU10 lamps of the zone 01 stay in DISCO mode




@LumKitty :
python milight-off.py 1 does nothing



To all : I can set a second zone. When I try to link lamps with zone 2 in the Android app it does not work. Do you know an other way to set up zones?
/domoticz/scripts/python/MiLight3-master $ python milight-off.py 1
Status file: ./milight3-192.168.1.22.dat
received message: 28000000110002f0fe6b16adbe50aa4b9b0001d40000
requesting iBox to execute command d4
requesting iBox to execute command 00
Statusfile zone 1 valid - using stored values
Initialising zone: 1 Hue: -1 Sat: 100 Val: -1 Temp: 0
Statusfile zone 2 valid - using stored values
Initialising zone: 2 Hue: -1 Sat: 100 Val: 0 Temp: 0
Statusfile zone 3 valid - using stored values
Initialising zone: 3 Hue: -1 Sat: 100 Val: 0 Temp: 0
Statusfile zone 4 valid - using stored values
Initialising zone: 4 Hue: -1 Sat: 100 Val: 0 Temp: 0
Statusfile iBox valid - using stored values
Initialising ibox: Hue: -1 Val: 0
1 sending message: 80 00 00 00 11 d4 00 00 00 00 31 00 00 08 03 00 00 00 00 01 00 3D Sent to IP: 192.168.1.22
1 sending message: 80 00 00 00 11 d4 00 00 01 00 31 00 00 08 04 02 00 00 00 01 00 40 Sent to IP: 192.168.1.22
Writing: ./milight3-192.168.1.22.dat
python milight-on.py 1 does nothing

matv
Posts: 23
Joined: Sunday 08 January 2017 19:26
Target OS: Raspberry Pi
Domoticz version: 3.5877
Location: EU
Contact:

Re: Mi_light Ibox v6 (API) not working

Post by matv » Sunday 15 January 2017 1:02

I just noticed something else, in addition to what I wrote earlier today:

If the bightness is set to < 100 and the light turns off, it first flashes to full brightness.

Example: during the evening I use brightness 30-50, and at midnight my lights turn off via LumKitty's script in a scene in Domoticz.
Instead of fading off, it first turns on full brightness before dimming down.

Can't wait till the fade-in tomorrow morning!

User avatar
LumKitty
Posts: 26
Joined: Sunday 11 October 2015 12:50
Target OS: Raspberry Pi
Domoticz version: 3.5877
Location: South Wales, UK
Contact:

Re: Mi_light Ibox v6 (API) not working

Post by LumKitty » Sunday 15 January 2017 2:54

If you are getting issues with the bulbs not responding. Increase the SLEEP_TIME setting in milightbox.py.
The official value is 0.05 (50ms) though on my particular bulbs I can go down to 0.02 and I most likely forgot to set it back to 0.05.

Note that increasing the SLEEP_TIME will also slow down the fades. You can increase the speed to compensate.

If you're still getting problems increase the UDP_TIMES_TO_SEND_COMMAND setting. Unfortunately UDP is not a reliable network protocol, especially over wireless. I really wish the milights would switch to TCP!
Last edited by LumKitty on Sunday 15 January 2017 3:03, edited 1 time in total.

User avatar
LumKitty
Posts: 26
Joined: Sunday 11 October 2015 12:50
Target OS: Raspberry Pi
Domoticz version: 3.5877
Location: South Wales, UK
Contact:

Re: Mi_light Ibox v6 (API) not working

Post by LumKitty » Sunday 15 January 2017 3:01

matv wrote:I just noticed something else, in addition to what I wrote earlier today:

If the bightness is set to < 100 and the light turns off, it first flashes to full brightness.

Example: during the evening I use brightness 30-50, and at midnight my lights turn off via LumKitty's script in a scene in Domoticz.
Instead of fading off, it first turns on full brightness before dimming down.

Can't wait till the fade-in tomorrow morning!
If you are altering the brightness outside of my scripts, then unfortunately I have no way of knowing that you did that and think the brightness is still on 100, so I start fading from there.

If you do your evening dimming via my script as well, then I'll know about it and start fading from 30 or 50.

Unfortunately the V6 box doesn't give a way for me to query the values, so I just track them myself, and there's no "brightness down" command like the old white milights had.

matv
Posts: 23
Joined: Sunday 08 January 2017 19:26
Target OS: Raspberry Pi
Domoticz version: 3.5877
Location: EU
Contact:

Re: Mi_light Ibox v6 (API) not working

Post by matv » Sunday 15 January 2017 14:31

Thanks LumKitty for the accurate responses.

I changed the SLEEP_TIME to .05 and the UPD_TIMES to 3. So far it works fine :)

About the brightness: I could have known, the bulb doesn't report back it's status of course..
Maybe this will change with the backwards-compatible v7 update:
http://www.limitlessled.com/dev/ wrote: Coming Soon - 2017 (backwards app compatible with both v5 and v6, unlimited zones, offline scheduled timers, two way statefullness, RGBW v5 commands mapping to any DualWhite, RGBW, or RGBW/WW/CW bulbs)
And you were right, after changing the brightness with your script, the OFF-script works just fine :)

Do you know if there is a way to use your script with actual sliders in the Domoticz dashboard?
Right now I am using ON/OFF switches in Domoticz and a seperate brightness.py script in the command line.

User avatar
LumKitty
Posts: 26
Joined: Sunday 11 October 2015 12:50
Target OS: Raspberry Pi
Domoticz version: 3.5877
Location: South Wales, UK
Contact:

Re: Mi_light Ibox v6 (API) not working

Post by LumKitty » Sunday 15 January 2017 16:02

Thanks for the feedback on the SLEEP setting. In future I'll publish the scripts with it set to the official value of 0.5 so that it's more likely to work out of the box for people.

Unfortunately I have no idea how to integrate it with Domoticz in a more sensible manner. Half the reason for posting it in here was in the hope that someone who knows Domoticz would be able to take the lead on that one, having been given an easy(ish) to use Milight interface. I'd like to see the colour slider working as well! :)

Based on what Limitless say, my script as-is will work with the V7 box, but won't use the reporting back features. Someone is welcome to take my script and add this. They'll need to change the _hue _sat _val and _tmp variables into functions that pull info from the box, and delete the entire section that reads and writes to the data files. Someone is also welcome to buy me a V7 box when it comes out :lol:

I have a suspicion that the reporting features of the V7 box may still fail if a physical remote is used, unless major changes are made the remotes still talk directly to the bulbs. If you need that level of reporting back, I'd suggest looking at building The Atomik Controller. It'll probably work out cheaper, especially for complex installations.

deennoo
Posts: 913
Joined: Wednesday 10 December 2014 14:06
Target OS: Linux
Domoticz version: beta
Location: Bordeaux France
Contact:

Re: Mi_light Ibox v6 (API) not working

Post by deennoo » Tuesday 17 January 2017 2:28

@LumKitty.

Does your script & dev works with old rgbw bulb ?
073-151_HR_0.jpg
073-151_HR_0.jpg (92.07 KiB) Viewed 960 times
Domoticz stable 3.5877 for real & Domoticz beta for test
Rfxtrxe / RFLink / Milight / Yeelight / ESP8266 / MQTT / BLE
http://domo-attitude.fr

User avatar
LumKitty
Posts: 26
Joined: Sunday 11 October 2015 12:50
Target OS: Raspberry Pi
Domoticz version: 3.5877
Location: South Wales, UK
Contact:

Re: Mi_light Ibox v6 (API) not working

Post by LumKitty » Tuesday 17 January 2017 4:03

Currently no, but I do have the old controller and bulb, and it's on my list. It'll be a little awkward since I hacked my old controller and attached it directly to the serial port on my Pi (seriously, everyone should do this, it works so much better!) so someone else will have to test network comms when I do this.

It'll most likely be implemented as milightbox.MiLight2 and use the same commands to control it.

I'm undecided as to whether to implement it as milight.zone[1-9] or milight.white[1-4], milight.rgbw[1-4] and milight.rgb. The former makes more sense for ease of doing loops, the latter makes more sense since different functions will be available.

deennoo
Posts: 913
Joined: Wednesday 10 December 2014 14:06
Target OS: Linux
Domoticz version: beta
Location: Bordeaux France
Contact:

Re: Mi_light Ibox v6 (API) not working

Post by deennoo » Tuesday 17 January 2017 9:05

Ok ! That why i spend 2 hours without succes :-)

On my side i use old rgbw bulb with ibox v6, and other with old bridge (don't have issue with old bridge)

For status back to domoticz when i use android app, i use my RFLink and milight option that works great !

I'll prefer your last solution milightrgbw.1-4 etc
Domoticz stable 3.5877 for real & Domoticz beta for test
Rfxtrxe / RFLink / Milight / Yeelight / ESP8266 / MQTT / BLE
http://domo-attitude.fr

jdecelis
Posts: 2
Joined: Tuesday 17 January 2017 12:40
Target OS: Raspberry Pi
Domoticz version: 3.5877
Location: Malta
Contact:

Re: Mi_light Ibox v6 (API) not working

Post by jdecelis » Tuesday 17 January 2017 13:30

Hi

I'm trying to call fadetocolour but i'm getting the error below

Traceback (most recent call last):
File "myTest.py", line 6, in <module>
milight.zone[1].fadetocolour(255,50,100)
File "/home/pi/MiLight3/milightbox.py", line 570, in fadetocolour
self.whitetohsv(self._val-1,hue,sat,val,speed)
File "/home/pi/MiLight3/milightbox.py", line 421, in whitetohsv
self.hsv(desthue,sat,sourceval)
File "/home/pi/MiLight3/milightbox.py", line 280, in hsv
self.hue(hue)

Thanks for your help
James

Nautilus
Posts: 680
Joined: Friday 02 October 2015 12:12
Target OS: Raspberry Pi
Domoticz version: beta
Location: Finland
Contact:

Re: Mi_light Ibox v6 (API) not working

Post by Nautilus » Wednesday 18 January 2017 8:20

Although this is not a MiLight API issue thought it might we worth it to ask here as there are probably quite many MiLight users reading the topic. So I've just received the B4 "4-Zone RGB+CCT Panel Remote Controller" (http://www.futlight.com/p...ls.aspx?id=261&typeid=143) and on the product specification (http://www.futlight.com/productdetails. ... nfo/B4.pdf) it says for compatible products: "RGB / RGBW & RGB+CCT series".

However, I cannot seem to be able to link it to my RGBW(W) lights, only with RGB+CCT. RGBW(W) lights do not react in any way when trying to link. Has anyone succeeded in this and if so - how? Or have I misunderstood something? :)

Post Reply

Who is online

Users browsing this forum: jvdz and 7 guests