Milight/Limitlessled Skill help needed


#1

Hi,

I’m building my first Mycroft skill.
I have a MiLight set of bulbs at home but same api are compatible with:
LimitlessLED
AppLight
AppLamp
LEDme
dekolight
iLight
EasyBulb

I’m actually using a Python library already tested and avaiable at https://github.com/McSwindler/python-milight

I wrote lot of code and began to test, unfortunately loading skills gives me error:
AttributeError: ‘module’ object has no attribute ‘MiLight’

which would make sense if ctrl+click would not work to inspect where it points and if the Eclipse IDE did not suggest me exactly that. I also checked for any case sensitive errors but can’t figure out.
I tried to run the constructor code in a console and looks like working.

I’m new to Python but developing in .NET for work, can you give me a hint where to look for this to fix?
I published all my code here https://github.com/maxppc/Mycroft-milight-skill

Thanks


#2

This sounds like a virtualenv problem. When running the code to test, it goes into the mycroft virtualenv, which likely doesn’t have the milight package installed. You should be able to solve that by entering the virtualenv with workon mycroft, then pip installing the package. For a solution for others, add the package and its needed version number to requirements.text.


#3

you were right, I mean, the package was not installed in mycroft enviroment but even after that I got same error message, must be something else.

Have you any hint how I can debug step by step?


#4

Oh, I see what the problem is. The trouble is that you named your skill folder the same as the library you’re trying to import. That means when you put import milight, it tries to import the module in the skill folder. I ran into this problem with a roku library as well. I’d recommend changing your skill folder name to something different, maybe milight-control.


#5

IT WORKS!!

Thank you so much, for this and the virtualenv hint!
Now I will do extensive test then will publish the whole code on github and will see if it can be added to the mycroft standard skills or what.


#6

I could not find anything clear enought for me to understand what can I do, if possible, to test this skill in a Debian VM running with Virtualbox in another Debian host.

I’m running the VM with network in bridged mode so it get an IP from my home DHCP and the Debian host is connected with wired lan.

Unfortunately looks like UDP traffic can’t reach the network with python or bash.
In python I’m using the milight 0.6 library which looks like creating a socket with other system libraries,
the bash is just echoing to /dev/udp/192.168.x.x/port but doesn’t work in the VM while it works in the host.

Have someone already had this issue?

Thanks


#7

I’d really appreciate a bit of help with this. I’ve figured out the basics of getting this to load by moving all the code from the milight folder to the Mycroft-milight-skill folder. I’ve also added the required stanza to mycroft.conf:
“MilightSkill”: {
“host”: “[ip address]”,
“port”: “[port]”
}

The problem I have now is that I’ve tried every possible way to tell Mycroft to turn a light off or on and it’s either ignored or I get this error: SpeechClient - INFO - Speak: An error occurred while processing a request in MilightSkill.

So far I have only for “all lights off/on” to work so I know that the skill itself works. I’d appreciate an update as to where you’re up to.


#8

Hi, appreciate you’re using that skill.
To be honest I never had the chance to really test it because I don’t have a mycroft unit and doesn’t work inside the VM but my Mark1 unit is on the way so I will resume the work soon.

I would ask you to wait some days in order to get an update. I don’t even have a Raspberry avaiable to run the mycroft image.

I will continue this project but right now it’s far far from usable.

Anyway as I understand you confirm that command all light on/off works, so the basic connection and main command works. I will look into others as soon as I can.


#9

Excellent, just give me a shout when you’re ready to go and I’ll work with you as much as I can


#10

I recently received my Mark1 unit and I’m willing to resume coding when I will find some free time after work and family.
With a quick check on code I noted that only “all on” and “all off” uses a method that can be called without additional parameters and that may explain why these are the only working commands right now.
Then we need to take note that, at the moment, the parameter needed for any other command is the “lightzone” which is supposed to be a number ranging 1 to 4.

Still this code is considered not working as I’ve never been able to do a complete test run.
I hope to deliver an update in the next weeks.
If you want to help let me know so we can split the tasks.


#11

I’m really sorry to inform you that with a newborn baby I have lots of joy but no spare time to take care of this skill, therefore feel free to edit the code as you prefer. :cry:


#12

Congratulations, @maxppc!


#13

Thank you very much!