[ESP8266] Commercial H801 WiFi RGB-dimmer topic

Everything about esp8266 and more.

Moderator: leecollings

r255
Posts: 3
Joined: Monday 22 June 2015 21:17
Target OS: -
Domoticz version:
Contact:

Re: [ESP8266] Commercial H801 WiFi RGB-dimmer topic

Post 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 )
User avatar
ledfreak3d
Posts: 98
Joined: Sunday 01 November 2015 15:30
Target OS: Linux
Domoticz version: 3.8025
Location: Hoorn
Contact:

Re: [ESP8266] Commercial H801 WiFi RGB-dimmer topic

Post by ledfreak3d »

nobody has a working example for this controller on domoticz ?
Unleashe the magic smoke ;)
dijkdj
Posts: 63
Joined: Saturday 07 March 2015 22:10
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: [ESP8266] Commercial H801 WiFi RGB-dimmer topic

Post by dijkdj »

GerardM
Posts: 8
Joined: Monday 30 November 2015 11:38
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Gouda, The Neatherlands
Contact:

Re: [ESP8266] Commercial H801 WiFi RGB-dimmer topic

Post by GerardM »

ThinkPad wrote:I got some help from a friendly member of Tweakers.net, and it is now working :mrgreen:

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
Domoticz newbee | arduino and Esp8266 hobbyist
ThinkPad
Posts: 890
Joined: Tuesday 30 September 2014 8:49
Target OS: Linux
Domoticz version: beta
Location: The Netherlands
Contact:

Re: [ESP8266] Commercial H801 WiFi RGB-dimmer topic

Post 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.
I am not active on this forum anymore.
GerardM
Posts: 8
Joined: Monday 30 November 2015 11:38
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Gouda, The Neatherlands
Contact:

Re: [ESP8266] Commercial H801 WiFi RGB-dimmer topic

Post 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
Domoticz newbee | arduino and Esp8266 hobbyist
ThinkPad
Posts: 890
Joined: Tuesday 30 September 2014 8:49
Target OS: Linux
Domoticz version: beta
Location: The Netherlands
Contact:

Re: [ESP8266] Commercial H801 WiFi RGB-dimmer topic

Post 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.
I am not active on this forum anymore.
GerardM
Posts: 8
Joined: Monday 30 November 2015 11:38
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Gouda, The Neatherlands
Contact:

Re: [ESP8266] Commercial H801 WiFi RGB-dimmer topic

Post 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 !
Last edited by GerardM on Saturday 05 December 2015 13:02, edited 1 time in total.
Domoticz newbee | arduino and Esp8266 hobbyist
ThinkPad
Posts: 890
Joined: Tuesday 30 September 2014 8:49
Target OS: Linux
Domoticz version: beta
Location: The Netherlands
Contact:

Re: [ESP8266] Commercial H801 WiFi RGB-dimmer topic

Post by ThinkPad »

I suppose the 192.169.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.
I am not active on this forum anymore.
GerardM
Posts: 8
Joined: Monday 30 November 2015 11:38
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Gouda, The Neatherlands
Contact:

Re: [ESP8266] Commercial H801 WiFi RGB-dimmer topic

Post 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...
Domoticz newbee | arduino and Esp8266 hobbyist
ThinkPad
Posts: 890
Joined: Tuesday 30 September 2014 8:49
Target OS: Linux
Domoticz version: beta
Location: The Netherlands
Contact:

Re: [ESP8266] Commercial H801 WiFi RGB-dimmer topic

Post 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.
I am not active on this forum anymore.
GerardM
Posts: 8
Joined: Monday 30 November 2015 11:38
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Gouda, The Neatherlands
Contact:

Re: [ESP8266] Commercial H801 WiFi RGB-dimmer topic

Post 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
Last edited by GerardM on Sunday 06 December 2015 14:27, edited 1 time in total.
Domoticz newbee | arduino and Esp8266 hobbyist
ThinkPad
Posts: 890
Joined: Tuesday 30 September 2014 8:49
Target OS: Linux
Domoticz version: beta
Location: The Netherlands
Contact:

Re: [ESP8266] Commercial H801 WiFi RGB-dimmer topic

Post by ThinkPad »

Ah..... I thought you were talking about the original H801 that i mentioned in the first post... :mrgreen:
I am not active on this forum anymore.
GerardM
Posts: 8
Joined: Monday 30 November 2015 11:38
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Gouda, The Neatherlands
Contact:

Re: [ESP8266] Commercial H801 WiFi RGB-dimmer topic

Post by GerardM »

Any idea why nc wont sent an UDP packet to the broadcast address?
Found it...
nc cant do that by design
Domoticz newbee | arduino and Esp8266 hobbyist
ThinkPad
Posts: 890
Joined: Tuesday 30 September 2014 8:49
Target OS: Linux
Domoticz version: beta
Location: The Netherlands
Contact:

Re: [ESP8266] Commercial H801 WiFi RGB-dimmer topic

Post by ThinkPad »

Good to know, thanks!
I am not active on this forum anymore.
deennoo
Posts: 784
Joined: Wednesday 10 December 2014 13:06
Target OS: Linux
Domoticz version: beta
Location: Bordeaux France
Contact:

Re: [ESP8266] Commercial H801 WiFi RGB-dimmer topic

Post 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 ?
Domoticz stable 3.5877 for real & Domoticz beta for test
Rfxtrxe / RFLink / Milight / Yeelight / Tasmota / MQTT / BLE / Zigate
http://domo-attitude.fr
rklootwijk
Posts: 1
Joined: Saturday 30 January 2016 13:55
Target OS: -
Domoticz version:
Contact:

Re: [ESP8266] Commercial H801 WiFi RGB-dimmer topic

Post by rklootwijk »

Does somebody know how to get the device to connect to an existing access point without using the android app?
deennoo
Posts: 784
Joined: Wednesday 10 December 2014 13:06
Target OS: Linux
Domoticz version: beta
Location: Bordeaux France
Contact:

Re: [ESP8266] Commercial H801 WiFi RGB-dimmer topic

Post 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
Domoticz stable 3.5877 for real & Domoticz beta for test
Rfxtrxe / RFLink / Milight / Yeelight / Tasmota / MQTT / BLE / Zigate
http://domo-attitude.fr
ThinkPad
Posts: 890
Joined: Tuesday 30 September 2014 8:49
Target OS: Linux
Domoticz version: beta
Location: The Netherlands
Contact:

Re: [ESP8266] Commercial H801 WiFi RGB-dimmer topic

Post 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?
I am not active on this forum anymore.
deennoo
Posts: 784
Joined: Wednesday 10 December 2014 13:06
Target OS: Linux
Domoticz version: beta
Location: Bordeaux France
Contact:

Re: [ESP8266] Commercial H801 WiFi RGB-dimmer topic

Post 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...
Domoticz stable 3.5877 for real & Domoticz beta for test
Rfxtrxe / RFLink / Milight / Yeelight / Tasmota / MQTT / BLE / Zigate
http://domo-attitude.fr
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests