Page 5 of 6
Re: [ESP8266] Commercial H801 WiFi RGB-dimmer topic
Posted: Saturday 12 November 2016 12:33
by ledfreak3d
DarkFoxDK wrote:deennoo wrote:MadBanana wrote:ledfreak3d
Code: Select all
...
runcommand = "curl 'http://" .. IP .. "/control?cmd=PWM," ..PIN.. "," .. CalcValue .. "'";
...
How does os.execute curl compare to the OpenURL command in speed?
Edit: Should've just tested it. It's much faster. Script below updated.
This is my current script for driving my ESPEasy lights, including a way to simulate white on RGB-only strips. It also uses a curve to get higher resolution at the lower end, where the brightness changes are more noticeable.
Code: Select all
local lights = {
['Stuereol Spots'] = {ip = '192.168.33.61', pin = '14', rgb = false},
['Stuereol Skab'] = {ip = '192.168.33.61', pin = '4', rgb = false},
['Vitrineskab'] = {ip = '192.168.33.62', pin = '13', rgb = false},
['Kontorreol'] = {ip = '192.168.33.64', pin = '13', rgb = false},
['Skrivebord'] = {ip = '192.168.33.67', pin = '14', rgb = false},
['Sengelys'] = {ip = '192.168.33.66', pin = '14', rgb = false},
['Kontorhylde W'] = {ip = '192.168.33.67', red = '15', grn = '13', blu = '12', rgb = true},
['Stuereol W'] = {ip = '192.168.33.61', red = '15', grn = '13', blu = '12', rgb = true},
['Seng W'] = {ip = '192.168.33.66', red = '15', grn = '13', blu = '12', rgb = true}
}
function setlight (ip, pin, dvalue)
os.execute("curl 'http://" .. ip.. "/control?cmd=PWM,".. pin .."," .. tostring(dvalue) .. ",128'")
end
commandArray = {}
for deviceName,deviceValue in pairs(devicechanged) do
if (lights[deviceName]) then
if (deviceValue == 'Off') then
dvalue = 0
elseif (deviceValue == 'On') then
dvalue = 1024
else
inputValue = tonumber(otherdevices_svalues[deviceName])
curve = 1.5848931924611
normalizedCurVal = (inputValue - 1.0) / 99.0
rangedValue = (math.pow(normalizedCurVal, curve) * 1023.0) + 1.0
dvalue = math.ceil(rangedValue)
end
if (lights[deviceName]['rgb']) then
setlight(lights[deviceName]["ip"], lights[deviceName]["red"], dvalue)
setlight(lights[deviceName]["ip"], lights[deviceName]["grn"], dvalue)
setlight(lights[deviceName]["ip"], lights[deviceName]["blu"], dvalue)
else
setlight(lights[deviceName]["ip"], lights[deviceName]["pin"], dvalue)
end
end
end
return commandArray
2nd edit: Cleaned up the code a bit.
humz keep getting a error in domotiz when I try this one
[string "local lights = { ..."]:12: bad argument #1 to 'pairs' (table expected, got nil)
cant realy figure out why
Re: [ESP8266] Commercial H801 WiFi RGB-dimmer topic
Posted: Saturday 12 November 2016 14:42
by DarkFoxDK
ledfreak3d wrote:
humz keep getting a error in domotiz when I try this one
[string "local lights = { ..."]:12: bad argument #1 to 'pairs' (table expected, got nil)
cant realy figure out why
Did you create it as a device-type script? Otherwise, the deviceschanged table is empty.
Oh, and there's a trick to get the full 1-100 steps on a dummy dimmer switch (Normally it'll round it to something like only 12 steps).
1. Create a dummy Selector switch.
2. Edit it and make sure everything is as you want it (Due to a bug, you can't edit it later*).
3. Set the switch type to dimmer.
Now the dummy switch will have the full 100 steps available.
* Unless you use your browser's debugging tool, to change the switch type to "Dimmer" in the edit link.
Re: [ESP8266] Commercial H801 WiFi RGB-dimmer topic
Posted: Saturday 12 November 2016 18:21
by ledfreak3d
yea that was my mistake I did not add it as a device script
managed to find that adding it as a selector first and then changing it to a dimmer fixed the issue that it wont go tom100 % brightness
Re: [ESP8266] Commercial H801 WiFi RGB-dimmer topic
Posted: Friday 25 November 2016 22:00
by Reley
Crap... Even with the FTDi I receive an error
Uploading 416064 bytes from C:\Users\Remco\AppData\Local\Temp\arduino_build_539286/ESPEasy.ino.bin to flash at 0x00000000
................................................................................ [ 19% ]
.......................Er is een fout opgetreden bij het uploaden van de schets
I have tried many settings, but all the time the same error...
How the h*ll did you upload the ESPeasy firmware...

Re: [ESP8266] Commercial H801 WiFi RGB-dimmer topic
Posted: Friday 25 November 2016 22:04
by ledfreak3d
what settings did you use in the Arduino ide to compile and upload
and whats the size if your esp's flash ?

- Capture.PNG (178.38 KiB) Viewed 7170 times
Re: [ESP8266] Commercial H801 WiFi RGB-dimmer topic
Posted: Saturday 26 November 2016 9:38
by Reley
How can I check the size of the h801's flash?
I will make a screenshot this evening...
Re: [ESP8266] Commercial H801 WiFi RGB-dimmer topic
Posted: Saturday 26 November 2016 11:14
by MadBanana
Reley wrote:How can I check the size of the h801's flash?
I will make a screenshot this evening...
My settings are the same as the post from ledfreak3d except that my Flash Mode is "DIO" - no idea why though, but it works! My baud rate is 115200, not had any problems with any of my three H801s ...
My H801 flash looks to be a 25Q80 - I think all mine are the same so these settings should be ok for you too.
Re: [ESP8266] Commercial H801 WiFi RGB-dimmer topic
Posted: Saturday 26 November 2016 11:38
by MadBanana
MadBanana wrote:Reley wrote:How can I check the size of the h801's flash?
I will make a screenshot this evening...
My H801 flash looks to be a 25Q80 - I think all mine are the same so these settings should be ok for you too.
And ESPEasy reports .. Flash Size: 1024 kB
Re: [ESP8266] Commercial H801 WiFi RGB-dimmer topic
Posted: Saturday 26 November 2016 11:58
by Reley
See attachment
I have tried allmost all flash sizes... none is working.
I even tried to upload a small sketch to determine the size, but that also does not work...
I have connected 4 wires to my ftdi, (3,3 gnd tx/rx) and shorted J3 on the 801..

- Naamloos.jpg (50.9 KiB) Viewed 7134 times
Tried with the same settings, no go. 115200 baud is not working as well. It needs 9600....
Re: [ESP8266] Commercial H801 WiFi RGB-dimmer topic
Posted: Saturday 26 November 2016 12:33
by MadBanana
Reley wrote:See attachment
I have tried allmost all flash sizes... none is working.
I even tried to upload a small sketch to determine the size, but that also does not work...
I have connected 4 wires to my ftdi, (3,3 gnd tx/rx) and shorted J3 on the 801..
Naamloos.jpg
Tried with the same settings, no go. 115200 baud is not working as well. It needs 9600....
That's strange, I have had no issues at all. A couple of points to check - don't feed the H801 off the FTDI as there may not be enough current to reliably flash. My H801 header has TX and RX swapped - so you need to join TX to TX and RX to RX (and not swapped as you'd expect). You've probably already found this though!
Re: [ESP8266] Commercial H801 WiFi RGB-dimmer topic
Posted: Saturday 26 November 2016 17:44
by Reley
MadBanana wrote:Reley wrote:See attachment
I have tried allmost all flash sizes... none is working.
I even tried to upload a small sketch to determine the size, but that also does not work...
I have connected 4 wires to my ftdi, (3,3 gnd tx/rx) and shorted J3 on the 801..
Naamloos.jpg
Tried with the same settings, no go. 115200 baud is not working as well. It needs 9600....
That's strange, I have had no issues at all. A couple of points to check - don't feed the H801 off the FTDI as there may not be enough current to reliably flash. My H801 header has TX and RX swapped - so you need to join TX to TX and RX to RX (and not swapped as you'd expect). You've probably already found this though!
Tried everything... but with an external power supply he won't upload at all. He can't connect.
Re: [ESP8266] Commercial H801 WiFi RGB-dimmer topic
Posted: Saturday 26 November 2016 18:56
by MadBanana
Reley wrote:Tried everything... but with an external power supply he won't upload at all. He can't connect.
Ok, I've not read your previous posts so apologies if you've already tried:-
1) flash original firmware using esptool
2) flash ESPEasy using esptool
3) a different USB --> serial unit
do you get the same errors?
Re: [ESP8266] Commercial H801 WiFi RGB-dimmer topic
Posted: Saturday 26 November 2016 19:04
by deennoo
With external power : don't forget to join gnd to your programmer
Re: [ESP8266] Commercial H801 WiFi RGB-dimmer topic
Posted: Monday 28 November 2016 14:57
by Reley
With external power and ground connected it gives another error:
Code: Select all
warning: espcomm_sync failed
error: espcomm_open failed
error: espcomm_upload_mem failed
error: espcomm_upload_mem failed
[/s]
Working!
Don't know how, but its working now!
Now trying to create some nice hardware in domoticz...
Re: [ESP8266] Commercial H801 WiFi RGB-dimmer topic
Posted: Monday 28 November 2016 21:57
by MadBanana
Reley wrote:
Working!
Don't know how, but its working now!
Now trying to create some nice hardware in domoticz...
Well done - enjoy!!
Re: [ESP8266] Commercial H801 WiFi RGB-dimmer topic
Posted: Wednesday 07 December 2016 22:13
by frankv
Hi all,
Apologies for resurrecting an old thread, and being somewhat off-topic for Domotocz, but this does seem to be the centre of knowledge on this subject...
I have a couple of H801s connected to RGB strings. Everything works fine (LEDs work, I can control both H801s from my phone) except that I can't connect to either of them from my PC.
When I attempt to connect to UDP port 30977 on an H801, I get a "Connection Refused" error message. I'm working in Java on Linux... the code works fine for connecting to other WiFi devices. Has anyone encountered anything like this with H801s? And have a solution?
Thanks
Frank
Re: [ESP8266] Commercial H801 WiFi RGB-dimmer topic
Posted: Wednesday 07 December 2016 23:04
by MadBanana
frankv wrote:I have a couple of H801s connected to RGB strings. Everything works fine (LEDs work, I can control both H801s from my phone) except that I can't connect to either of them from my PC.
When I attempt to connect to UDP port 30977 on an H801, I get a "Connection Refused" error message. I'm working in Java on Linux... the code works fine for connecting to other WiFi devices. Has anyone encountered anything like this with H801s? And have a solution?
Is this using the original firmware? I couldn't even get it to work reliably using the app - so probably won't be of much help, but will try!
Re: [ESP8266] Commercial H801 WiFi RGB-dimmer topic
Posted: Tuesday 24 January 2017 4:52
by secteur
If anyone wants to use the original firmware and control programmatically:
After having "Linked" the device using the Android app
https://drive.google.com/open?id=0B1gzq ... ERBUndCU28 Default password 88888888
I was able to send commands via UPD from shell using
https://nmap.org/ncat/
Code: Select all
echo fbeb00ff00000096509900 | xxd -r -p | ncat -4u -p 30978 192.168.1.255 30977
and from Python
Code: Select all
from socket import *
import binascii
cs = socket(AF_INET, SOCK_DGRAM)
cs.setsockopt(SOL_SOCKET, SO_REUSEADDR, 1)
cs.setsockopt(SOL_SOCKET, SO_BROADCAST, 1)
cs.sendto(binascii.unhexlify('fbebffe200000096509900'), ('192.168.1.255', 30977))
Re: [ESP8266] Commercial H801 WiFi RGB-dimmer topic
Posted: Sunday 05 March 2017 20:44
by Vojta
ledfreak3d wrote:DarkFoxDK wrote:deennoo wrote:
How does os.execute curl compare to the OpenURL command in speed?
Edit: Should've just tested it. It's much faster. Script below updated.
This is my current script for driving my ESPEasy lights, including a way to simulate white on RGB-only strips. It also uses a curve to get higher resolution at the lower end, where the brightness changes are more noticeable.
Code: Select all
local lights = {
['Stuereol Spots'] = {ip = '192.168.33.61', pin = '14', rgb = false},
['Stuereol Skab'] = {ip = '192.168.33.61', pin = '4', rgb = false},
['Vitrineskab'] = {ip = '192.168.33.62', pin = '13', rgb = false},
['Kontorreol'] = {ip = '192.168.33.64', pin = '13', rgb = false},
['Skrivebord'] = {ip = '192.168.33.67', pin = '14', rgb = false},
['Sengelys'] = {ip = '192.168.33.66', pin = '14', rgb = false},
['Kontorhylde W'] = {ip = '192.168.33.67', red = '15', grn = '13', blu = '12', rgb = true},
['Stuereol W'] = {ip = '192.168.33.61', red = '15', grn = '13', blu = '12', rgb = true},
['Seng W'] = {ip = '192.168.33.66', red = '15', grn = '13', blu = '12', rgb = true}
}
function setlight (ip, pin, dvalue)
os.execute("curl 'http://" .. ip.. "/control?cmd=PWM,".. pin .."," .. tostring(dvalue) .. ",128'")
end
commandArray = {}
for deviceName,deviceValue in pairs(devicechanged) do
if (lights[deviceName]) then
if (deviceValue == 'Off') then
dvalue = 0
elseif (deviceValue == 'On') then
dvalue = 1024
else
inputValue = tonumber(otherdevices_svalues[deviceName])
curve = 1.5848931924611
normalizedCurVal = (inputValue - 1.0) / 99.0
rangedValue = (math.pow(normalizedCurVal, curve) * 1023.0) + 1.0
dvalue = math.ceil(rangedValue)
end
if (lights[deviceName]['rgb']) then
setlight(lights[deviceName]["ip"], lights[deviceName]["red"], dvalue)
setlight(lights[deviceName]["ip"], lights[deviceName]["grn"], dvalue)
setlight(lights[deviceName]["ip"], lights[deviceName]["blu"], dvalue)
else
setlight(lights[deviceName]["ip"], lights[deviceName]["pin"], dvalue)
end
end
end
return commandArray
2nd edit: Cleaned up the code a bit.
humz keep getting a error in domotiz when I try this one
[string "local lights = { ..."]:12: bad argument #1 to 'pairs' (table expected, got nil)
cant realy figure out why
Hi guys,
Sorry, to be dumbo, but I dont have any experience with lua scripts.
I have h801 flashed on espeasy with RGB milight plugin and using applamp, colours works great but I would like to simulate white as well.
Could you please advise how to amend script for my ip device 192.168.0.106 and add to Applamp group one dimmer?
Thanks
Sorry for annoying
Vojta
Re: [ESP8266] Commercial H801 WiFi RGB-dimmer topic
Posted: Wednesday 08 March 2017 21:41
by ledfreak3d
actualy with above script you don't need to use the milight plugin
it will just dim using the build in pwm dimmer function.