Page 1 of 2

APPLamp control tool (for V3)

Posted: Sunday 26 January 2014 16:41
by elythomaslumber
Found a really nice SW tool on this WebPage: http://iqjar.com/jar/home-automation-us ... ver-wi-fi/
It allows to control APPLamp (WiFi Lamp) with only one command and simple parameters.

Here's the download link: http://iqjar.com/download/jar/milight/m ... naries.zip

Just make a download, unzip it and place it e.g. /home/pi/domoticz/scripts
Make it executable and change the IP adress in the config file to that of your wifi-bridge.
Than from CLI (Putty) start it with ./milight and you'll see all possible parameters.
It's very fast in a bash script.

It inspired me for that simple script calling a very slow brightness and coloure change instead of the build in DISCO-mode which is a little bit too fast for me.

By the way, check the other web-pages of this guy; made very well!

Regards

Hardy


Code: Select all

#!/bin/bash

# prepare show for dimming white

./milight 1 B 1					# dimm to minimum
./milight 1 ON					# switch ON
./milight 1 w					# switch to white
./milight 1 B 1					# dimm to minimum

for i in {0..19}					# change brightness from 0 to 8
do

./milight 1 B $i

		for x in $(seq 200); do	# do it slow
		echo $i $x				# show value and slow down
		done

done
#---------------------------------------------------------------------------------------
# show smooth coloure change

./milight 1 B 1 					# dimm to minimum
./milight 1 C 0					# change coloure to 0 value (dark blue)
./milight 1 B 19					# set brightness to maximum

for i in {0..255}					# do a loop for all values
do

./milight 1 C $i					# change coloure through all values

	for x in $(seq 300); do		# do it slowly
	echo $i $x					# show value and slow down
	done

done
./milight 1 B 1 					# change to brightness minimum
./milight 1 OFF					# switch OFF

Re: APPLamp control tool (for V3)

Posted: Sunday 26 January 2014 17:49
by alfred_j_kwak
Nice. Maybe I now can implement my 'rising sun' alarm clock...

-Jussi-

Re: APPLamp control tool (for V3)

Posted: Sunday 26 January 2014 18:36
by elythomaslumber
I'm working on a weather "forecast lamp" with rough indication of temperature, rain and wind in the next 6 hours...

A little bit crazy I know... :mrgreen:

Regards

Hardy

Re: APPLamp control tool (for V3)

Posted: Sunday 26 January 2014 20:07
by safi78
elythomaslumber wrote:A little bit crazy I know... Hardy
Wow, just what I was looking for.

While the support for this is still in development this is awesome ...

thanks a bundle!

Re: APPLamp control tool (for V3)

Posted: Sunday 26 January 2014 20:12
by howcome
I am using this to control the inside- and outside lighting based on the sunset time. Backgarden light turns off earlier than the frontporge light. Internal lighting is based on sunset, added with a random time within half an hour. Works great.

Re: APPLamp control tool (for V3)

Posted: Sunday 26 January 2014 20:32
by alfred_j_kwak
Hmm. The binary file is for Raspberry? It doesn't run in my Mint server.

-Jussi-

And yes. I have to compile it from source. Now it works.

Re: APPLamp control tool (for V3)

Posted: Sunday 26 January 2014 21:41
by alfred_j_kwak
I need to code something like this to get it run:

Code: Select all

#!/bin/sh


for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
do
	./milight b $i
	sleep 2
done

That {1..19} don't work in my bash. Also it's not ok to use ./milight b 0 - values start from 1.

-Jussi.

Re: APPLamp control tool (for V3)

Posted: Sunday 26 January 2014 22:31
by howcome
I would try it using tcl:

for {set X 1} {$X < 20} {incr X} {
exec ./milight B $X
after 2000
}

I used a similar script for a 'scanner' app to determine the code for the new selflearning 'klik-aan-klik-uit' devices, but the device did not recognize the codes.

Re: APPLamp control tool (for V3)

Posted: Monday 27 January 2014 8:45
by elythomaslumber
alfred_j_kwak wrote:I need to code something like this to get it run:

Code: Select all

#!/bin/sh


for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
do
	./milight b $i
	sleep 2
done

That {1..19} don't work in my bash. Also it's not ok to use ./milight b 0 - values start from 1.

-Jussi.
Don't know if it helps. Sometimes there is really a difference in behaviour of using #!/bin/sh oder #!/bin/bash .
Did you make your "milight" executable?

Setting brightness from 0 works for me for "white" but values between 8 and 19 do not show any change.
I'm using the 9W RGBW bulbs.

Hope you will get it running.

Hardy

EDIT: There is aslo a change between 8 and 19... was to late yesterday evening 8-)

Re: APPLamp control tool (for V3)

Posted: Monday 27 January 2014 9:58
by alfred_j_kwak
Yes I get it going.

I just realize that if I make an silent alarm with name in my Samsung phone alarm clock it gives notify.
Tasker can see this notify and run task. So now I can have easily adjustable timer based triggers for my Domoticz.
Domoticz can then run the script to control AppLamp.

-Jussi-

Re: APPLamp control tool (for V3)

Posted: Monday 27 January 2014 10:10
by gizmocuz
Okey, maybe someone can summarize what is working and not working by using the standard applamp hardware in domoticz?
I am able to control my RGBW leds perfectly

Re: APPLamp control tool (for V3)

Posted: Monday 27 January 2014 10:38
by safi78
gizmocuz wrote:Okey, maybe someone can summarize what is working and not working by using the standard applamp hardware in domoticz?
I am able to control my RGBW leds perfectly
Same here, but the command line tool is very nice for scripting ;)

I made a wake up light with it for instance.

Anyway, what I think is annoying is that when you click the button for a zone it doesn't do the default colour setting behind it, like it does with scenes. But I can imagine other peepz would like the current setting (last used setting).

And earlier I thought it was buggy / still under development because I had made a mistake in the configuration, so I was wrong.

Scenes work perfectly by the way :)

Very nice work!

Re: APPLamp control tool (for V3)

Posted: Sunday 26 July 2015 13:53
by nood
Sorry to dig out this old post, but I have a (noob) question.

I made a script (based on TS's code) wich goes thru all the colors very slow. The script takes 30mins or so.
Now I would like to know how to stop this script before it ends and go to white, maximum brightness.
I use a COCO switch to trigger the script.

Thx

Re: APPLamp control tool (for V3)

Posted: Wednesday 23 March 2016 15:56
by benotje
i have copy de scripts for test

Code: Select all

#!/bin/bash

# prepare show for dimming white

./milight 1 b 1               # dimm to minimum
./milight 1 ON               # switch ON
./milight 1 w               # switch to white
./milight 1 b 1               # dimm to minimum

for i in {0..19}               # change brightness from 0 to 8
do

./milight 1 b $i

      for x in $(seq 200); do   # do it slow
      echo $i $x            # show value and slow down
      done

done
#---------------------------------------------------------------------------------------
# show smooth coloure change

./milight 1 b 1                # dimm to minimum
./milight 1 c 0               # change coloure to 0 value (dark blue)
./milight 1 b 19               # set brightness to maximum

for i in {0..255}               # do a loop for all values
do

./milight 1 c $i               # change coloure through all values

   for x in $(seq 300); do      # do it slowly
   echo $i $x               # show value and slow down
   done

done
./milight 1 b 1                # change to brightness minimum
./milight 1 OFF               # switch OFF
i call it "naar_bed_test2.sh"
when i do ssh. connect from putty "pi@domoticzpi ~/domoticz/scripts $ bash naar_bed_test2.sh" it worked

but when i do
Knipsel.JPG
Knipsel.JPG (37.59 KiB) Viewed 5861 times
it dont work hou can i make it work ???

Re: APPLamp control tool (for V3)

Posted: Thursday 24 March 2016 23:33
by safi78
maybe change

Code: Select all

///

to

Code: Select all

//

where it says

Code: Select all

script:///

;) ?

Re: APPLamp control tool (for V3)

Posted: Monday 28 March 2016 19:57
by benotje
no also i do script:// or script:/// not working

Re: APPLamp control tool (for V3)

Posted: Tuesday 29 March 2016 21:17
by safi78
Put your milight executable in a place your script can find ;)

I think I put mine in /usr/local/bin or /usr/bin (don't remember)

Your script calls './milight' (needs to be in the current dir) but I don't think that's the right dir if you try to run the script from where you try it.

Re: APPLamp control tool (for V3)

Posted: Tuesday 29 March 2016 21:20
by safi78
Then, your next problem will be where the milight executable expects the milight.conf ...

I don't like linking outside of the community, but this is what you need: https://www.safiweb.nl/?p=954

Re: APPLamp control tool (for V3)

Posted: Wednesday 30 March 2016 15:30
by Heisenberg
Only for v3? how do I find out which version MyLight controller box I have?

Re: APPLamp control tool (for V3)

Posted: Friday 01 April 2016 14:52
by safi78
Heisenberg wrote:Only for v3? how do I find out which version MyLight controller box I have?
like so:

http://bfy.tw/52me