Page 2 of 6
Re: [ESP8266] Commercial H801 WiFi RGB-dimmer topic
Posted: Tuesday 03 November 2015 18:39
by r255
omg, i got two of these floating but then time is an issue here to.
What is still on my list is to try this one :
https://github.com/probonopd/ESP8266HueEmulator
Would be a breeze to intergrate it in domoticz when it works..!
( hmmz works with neopixels 5v, so guess thats not one to try without modification of the code )
Re: [ESP8266] Commercial H801 WiFi RGB-dimmer topic
Posted: Saturday 07 November 2015 11:03
by ledfreak3d
nobody has a working example for this controller on domoticz ?
Re: [ESP8266] Commercial H801 WiFi RGB-dimmer topic
Posted: Sunday 08 November 2015 21:43
by dijkdj
Re: [ESP8266] Commercial H801 WiFi RGB-dimmer topic
Posted: Monday 30 November 2015 12:31
by GerardM
ThinkPad wrote:I got some help from a friendly member of Tweakers.net, and it is now working
rgb.php
- Spoiler: show
Code: Select all
<?php
//Script made by 'ThinkPad' for 'H801 WiFi dimmer' (based on ESP8266)
//See forumthread at http://domoticz.com/forum/viewtopic.php?f=38&t=7957
//Save as 'rgb.php' and call the script like rgb.php?hex=ff8d00
$host = 'udp://192.168.4.23';
$port = 30977;
//Strip out any invalid characters, only A-Z and numbers are allowed.
$color = preg_replace("/[^a-zA-Z0-9\s]/", "", $_GET["hex"]);
//Check if the colorcode sent has 6 values
if ( strlen($color) == 6 ) {
$red = substr($color, 0, 2);
$green = substr($color, 2, 2);
$blue = substr($color, 4, 2);
$fp = pfsockopen($host, $port);
//Color should be like 0xfbebRRGGBB000079979d00 (where RR, GG, BB are the hex values for the colors)
$line="\xfb\xeb" . chr(hexdec($red)) . chr(hexdec($green)) . chr(hexdec($blue)) . "\x00\x00\x79\x97\x9d\x00";
fwrite($fp, $line);
fclose($fp);
echo '<body bgcolor="#'. $color .'">';
echo 'Chosen color is: <a href="http://www.color-hex.com/color/' . $color . '"><b>' . $color . '</b></a>';
}
else {
echo "Not a valid colorcode, has to be 6 characters!";
}
//Check if rgb.php?cmd=PWRON was received
if ($_GET["cmd"] == "PWRON"){
$fp = pfsockopen($host, $port);
$line_on="\xfb\xeb\xff\x00\x3c\x00\x00\x79\x97\x9d\x00"; //Power on
$line_normalmode="\xfb\xec\x00\x1e\x00\x00\x00\x79\x97\x9d\x00"; //Set controller into mode to accept colorcodes
$x = 1;
//Send 'power on' command 6 times
while($x <= 6) {
fwrite($fp, $line_on);
fclose($fp);
$x++;
}
//Send 'back to colorcode-mode' command 3 times
while($x <= 3) {
fwrite($fp, $line_normalmode);
fclose($fp);
$x++;
}
}
//Check if rgb.php?cmd=PWROFF was received
if ($_GET["cmd"] == "PWROFF"){
$fp = pfsockopen($host, $port);
$line_off="\xfb\xeb\x00\x00\x00\x00\x00\x79\x97\x9d\x00"; //Power off
//Send 'power off' command 6 times
while($x <= 6) {
fwrite($fp, $line_off);
fclose($fp);
$x++;
}
}
?>
Script got a little bit big, but now i'm sure nothing strange will happen, because i implemented a few checks.
I also made a small page where a color can be picked and sent to the controller:
- Spoiler: show
Code: Select all
<html>
<head>
<title>Colorpicker</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>
<script type="text/javascript">
jQuery(function($){
var field1 = $('#hexcolorcode');
$('#send').click(function(){
if(!field1.val()){
alert("Please enter a value");
field1.focus();
return;
}
jQuery.ajax({
url: 'rgb.php',
type: 'get',
data: 'hex=' + field1.val()
});
});
});
</script>
</head>
<body>
<body>
<script type="text/javascript" src="jscolor/jscolor.js"></script>
Click here: <input class="color" id="hexcolorcode" value="66ff00">
<input type="button" value="Submit" id="send">
</body>
</body>
</html>
It uses 'jscolor' colorpicker:
http://jscolor.com/try.php
For scripting: this commandline command also works:
Code: Select all
echo -e '\xfb\xeb\xf0\x00\xff\x00\x00\x79\x97\x9d\x00' | nc -u -w1 192.168.4.23 30977
Might be useful for a Lua-script later on.
Very interesting!!
Great work!
I have some self built RGB led controllers on esp8266 wich listen on UDP.
I can reprogram then to only respond on the color-hex parameter in an UDP packet.
By sending to the broadcast IP i can switch all the esp's at the same time
They are used for X-mas lighting led-strips on the frontwall of the house
So all i have to do is strip the scripts from the parts i dont need
But wondering, do i have to put the color-picker html page as the action-on on the dashboad ?
Do i understand correctly that the color-picker script calls the php-script ?
Greets
GerardM
Re: [ESP8266] Commercial H801 WiFi RGB-dimmer topic
Posted: Monday 30 November 2015 12:56
by ThinkPad
Hi GerardM,
You can call the PHP-script like this: rgb.php?hex=ff8d00
But you can also do it directly from commandline with the 'nc' command. This saves you from having a webserver needed etc. But for the commandline part, you need to send the HEX-command, which is a bit more difficult.
Re: [ESP8266] Commercial H801 WiFi RGB-dimmer topic
Posted: Monday 30 November 2015 13:32
by GerardM
The php script will most def work.
I am going to reprogram the esp led controlers so they understand the hex code
But i was very interested how to use the color-picker html script in domoticz
So i can pick a color and then send it to all the led controlers.
Is it possible to do that from the dashboard ? Or do i need a frontpage ?
Which is a next project when the x-mas lights work
Re: [ESP8266] Commercial H801 WiFi RGB-dimmer topic
Posted: Monday 30 November 2015 13:35
by ThinkPad
The link between the controller and Domoticz dashboard, is something i haven't done (yet?).
Main blocking point is that a virtual RGB-device doesn't spit out his current color, so i have no idea how to get that information passed on to the controller.
Second is that it probably would cost quite some time, and i don't change the color very often so it will be of little use for me.
Btw, i now have also gathered the information from this topic and put it on my Bitbucket account
here.
Re: [ESP8266] Commercial H801 WiFi RGB-dimmer topic
Posted: Saturday 05 December 2015 12:49
by GerardM
ThinkPad wrote:Hi GerardM,
But you can also do it directly from commandline with the 'nc' command. This saves you from having a webserver needed etc. But for the commandline part, you need to send the HEX-command, which is a bit more difficult.
Thnx
Any idea why nc wont sent an UDP packet to the broadcast address?
The ledcontrollers get their address from DHCP
When i use nc for a single node, it works (192.168.1.163)
When i want to send a command to all of them (192.168.1.255) it doesnt work
I checked with packetsender on windows and i dont see an incoming packet
For the rest, great help !
Re: [ESP8266] Commercial H801 WiFi RGB-dimmer topic
Posted: Saturday 05 December 2015 12:51
by ThinkPad
I suppose the 192.16
9.1.255 is a typo
?
Normally the broadcast address is .255 i thought, so i don't know why it doesn't work. I only have one H801 box, so i can't test it unfortunately.
Re: [ESP8266] Commercial H801 WiFi RGB-dimmer topic
Posted: Saturday 05 December 2015 13:01
by GerardM
Yes, typo
Fixed
Ill guess i have to address then ony by one.
The delay this creates isnt even annoying in the chtrismaslights sequences...
Re: [ESP8266] Commercial H801 WiFi RGB-dimmer topic
Posted: Saturday 05 December 2015 13:08
by ThinkPad
Maybe you can sniff the original app to see how that works. I thought it also send the commands to the broadcast IP. But it's a while ago i did the sniffing, so don't know anymore.
Re: [ESP8266] Commercial H801 WiFi RGB-dimmer topic
Posted: Saturday 05 December 2015 14:45
by GerardM
There isnt an original app
I made the led controllers myself
So i know where they listen and on what port
At the moment they listen for commands like RRR for full red, BBB for full blue etc..
B2R for fade from blue to red etc
Ill think ill keep it that way and change the script with nc
Re: [ESP8266] Commercial H801 WiFi RGB-dimmer topic
Posted: Saturday 05 December 2015 14:57
by ThinkPad
Ah..... I thought you were talking about the original H801 that i mentioned in the first post...
Re: [ESP8266] Commercial H801 WiFi RGB-dimmer topic
Posted: Monday 07 December 2015 0:52
by GerardM
Any idea why nc wont sent an UDP packet to the broadcast address?
Found it...
nc cant do that by design
Re: [ESP8266] Commercial H801 WiFi RGB-dimmer topic
Posted: Monday 07 December 2015 7:43
by ThinkPad
Good to know, thanks!
Re: [ESP8266] Commercial H801 WiFi RGB-dimmer topic
Posted: Thursday 14 January 2016 21:42
by deennoo
ledfreak3d wrote:so still no good way to support this module ?
might just have to flash it with quinled and just add 2 extra channels
Have you test it with quinled ?
Re: [ESP8266] Commercial H801 WiFi RGB-dimmer topic
Posted: Saturday 30 January 2016 13:57
by rklootwijk
Does somebody know how to get the device to connect to an existing access point without using the android app?
Re: [ESP8266] Commercial H801 WiFi RGB-dimmer topic
Posted: Saturday 06 February 2016 9:25
by deennoo
I found on github an ESP firmware who turn it on a Milight bridge + ledstrip controller for pwm led strip.
I test everything looks OK
https://github.com/frizzby/esp8266-rgb-led
I'm starting a conversion for Ws2812b led strip :
https://github.com/deennoo/ESP8266-ws2812b/tree/nodemcu
Envoyé de mon Smart'TAB 7801 en utilisant Tapatalk
Re: [ESP8266] Commercial H801 WiFi RGB-dimmer topic
Posted: Tuesday 09 February 2016 9:49
by ThinkPad
This firmware looks interesting:
https://eryk.io/2015/10/esp8266-based-w ... ller-h801/
Using a simple http call to the device on
http://192.168.0.xx/rgb/ff0000 it is possible to send RGB values in HEX and let the color of the leds change to this color.
It seems this:
https://github.com/jeffeb3/esp8266_lights is based on the code from eryk.io, but i don't see actually what has changed in comparision with the original code form eryk.io?
Re: [ESP8266] Commercial H801 WiFi RGB-dimmer topic
Posted: Friday 12 February 2016 13:41
by deennoo
Now that communication protocole is done with original FW, isn't possible to include it as a "normal" hardware on Domoticz, using Milight or Philips Hue as exemple ?
A french homeautomation software juste release a plugin for it, to use it with the original Fw...