Finished: H801 RGBWW control with openhab2 and mqtt

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
mrwee
Normal user
Posts: 225
Joined: 31 Aug 2016, 12:52

Re: Finished: H801 RGBWW control with openhab2 and mqtt

#11 Post by mrwee » 24 Jan 2017, 08:41

Very well done Guys! Thanks for your efforts :)

mrwee
Normal user
Posts: 225
Joined: 31 Aug 2016, 12:52

Re: Finished: H801 RGBWW control with openhab2 and mqtt

#12 Post by mrwee » 24 Jan 2017, 21:32

Hi,

I've now flashed a H801 with 147RC8 + the latest P123_lights. I've got a RGB led strip connected. Using OH2+MQTT + the items/rules examples provided, it works fine for a while by using the color picker. After a while it suddenly it stop updating, and load goes to 100% on the H801.

I can see that the MQTT bus is completely quiet, but the log on ESP Easy continues with e.g.:

Code: Select all

845970 : MQTT : Payload: lights,rgb,2819ff,1
845976 : Lights: Set 160/100/1023/-203360/-203360
851104 : MQTT : Topic: /newdevice/cmd
851104 : MQTT : Payload: lights,rgb,4419ff,1
851109 : Lights: Set 272/100/1023/-203360/-203360
856911 : MQTT : Topic: /newdevice/cmd
856911 : MQTT : Payload: lights,rgb,4c1cff,1
856916 : Lights: Set 304/112/1023/-203360/-203360
Only after a reboot, can I get it to work :(

sledge
Normal user
Posts: 17
Joined: 20 Jan 2017, 20:42

Re: Finished: H801 RGBWW control with openhab2 and mqtt

#13 Post by sledge » 25 Jan 2017, 15:07

Hm strange. I have to design a lamp to install the h801 and test it in a long term. But i did let it run over night and everything was fine.
Make sure your mqtt bus is really clean. Try to listen to all messages with mosquitto_sub -d -t /#
If you edit settings in openhab it will take a while until all files are updated. If you do change colors in the meanwhile in a nervous manner openhab will fire all commands over mqtt as soon as new configuration is loaded. Maybe your poor esp gets confused about that and uses some kind of queue to handle all commands.

mrwee
Normal user
Posts: 225
Joined: 31 Aug 2016, 12:52

Re: Finished: H801 RGBWW control with openhab2 and mqtt

#14 Post by mrwee » 30 Jan 2017, 19:39

Well, it seems like it's only the iOS app which seems to somehow bring H801 to it's knees. It happens if you 'float' your finger around on the color-picker.. Strange.

ewas
New user
Posts: 2
Joined: 04 Mar 2017, 00:27

Re: Finished: H801 RGBWW control with openhab2 and mqtt

#15 Post by ewas » 04 Mar 2017, 00:34

Why do I get this feat log?

1984739 : WD : Uptime 33 ConnectFailures 0 FreeMem 25896
2014740 : WD : Uptime 33 ConnectFailures 0 FreeMem 25896
2044741 : WD : Uptime 34 ConnectFailures 0 FreeMem 25896

Does anyone connect the H801 to OpenHab?

sledge
Normal user
Posts: 17
Joined: 20 Jan 2017, 20:42

Re: Finished: H801 RGBWW control with openhab2 and mqtt

#16 Post by sledge » 04 Mar 2017, 02:11

Erm did you read first post? The connection to openhab is well explained. Your log is normal it shows no error.

ewas
New user
Posts: 2
Joined: 04 Mar 2017, 00:27

Re: Finished: H801 RGBWW control with openhab2 and mqtt

#17 Post by ewas » 07 Mar 2017, 11:56

Still server does not receive messages. Log beginning as follows:
260 : INIT : Booting Build nr:147
1147 : IP : Static IP :192.168.1.148
1147 : WIFI : Connecting... 1
4652 : WIFI : Connected!
4652 : INIT : SPI not enabled
4655 : INIT : Lights [RGB WW CW FADING CONSTBRI PON]
4668 : MQTT : Connected to broker
4671 : Subscribed to: /H801/#
4671 : INIT : Boot OK
4671 : INIT : Normal boot

JayJay
New user
Posts: 6
Joined: 01 Jan 2017, 12:26

Re: Finished: H801 RGBWW control with openhab2 and mqtt

#18 Post by JayJay » 16 Mar 2017, 21:13

Had the same problem, wanted to use home assistant and mqtt.
But whatever I tried I was unable to get them to talk to eachother, so I did abandon esp easy and used a simpler script found on the internet.
The difficulty for newbies trying to solve things and getting stuck is that most people who get it running or who wrote the code, are way further in understanding evrything that the connection with newbies is hard.
This module in esp easy was easy to access via a browser command but never ran from HASS and mqtt.

sledge
Normal user
Posts: 17
Joined: 20 Jan 2017, 20:42

Re: Finished: H801 RGBWW control with openhab2 and mqtt

#19 Post by sledge » 17 Mar 2017, 00:54

Ewas, you log looks good so far. Try to send a mqtt command manually in linux console: mosquitto_pub -t "/H801/cmd" -m "lights,rgb,00ff00"

fraeggle
Normal user
Posts: 21
Joined: 20 Nov 2017, 20:12

Re: Finished: H801 RGBWW control with openhab2 and mqtt

#20 Post by fraeggle » 24 Nov 2017, 11:41

JayJay wrote: 16 Mar 2017, 21:13 Had the same problem, wanted to use home assistant and mqtt.
But whatever I tried I was unable to get them to talk to eachother, so I did abandon esp easy and used a simpler script found on the internet.
The difficulty for newbies trying to solve things and getting stuck is that most people who get it running or who wrote the code, are way further in understanding evrything that the connection with newbies is hard.
This module in esp easy was easy to access via a browser command but never ran from HASS and mqtt.
Hi Jayjay.. What do you use for RGB right now and how do you control it. Have the same Prob. It does not send its Name and Values to MQTT. I use Iobroker.

Peter

mastamx
New user
Posts: 2
Joined: 02 Apr 2018, 03:18

Re: Finished: H801 RGBWW control with openhab2 and mqtt

#21 Post by mastamx » 02 Apr 2018, 03:31

Thanks to sledge for posting.

I have currently ESPEasy v2.0 running together with openhab 2.2 via mosquitto 1.4.15 (native build). I compiled with atom (platformio) and uploaded with flash download tools V3.6.2.2.

Everything is wonderful, except openhab colorpicker always sends values like: EA,60,05, which distort the plugin when using white channels (WW and CW is enabled in my setup)

So, I decided to post my "solution" for this "misbehavior", because I don't like bright ww or cw LED when I expect colour

items:

Code: Select all

Color  H801_1_RGB	  "Color Select"	<slider>
Dimmer  H801_1_level  "White Level [%s %%]" 
Dimmer  H801_1_temp   "White Temperature [%s %%]"

//String gets update in Rule and sends Command to Device
String H801_1_CMD	{ mqtt=">[broker:H801_1/cmd:state:*:default]" }

sitemap:

Code: Select all

sitemap demo label="Main Menu"
{

	
	Frame label="H801_1" {
		Slider		item=H801_1_level
		Slider		item=H801_1_temp
		Colorpicker	item=H801_1_RGB	icon="slider"
	}
}
rules:

Code: Select all

import org.eclipse.smarthome.core.library.types.HSBType

rule "H801_1"
when
	Item H801_1_RGB received update
then
	var HSBType hsbValue = H801_1_RGB.state as HSBType
	
	var intred 		= hsbValue.red.intValue*255/100
	var intgreen 	= hsbValue.green.intValue*255/100
	var intblue 	= hsbValue.blue.intValue*255/100
		
	var newintred = intred
	var newintgreen = intgreen
	var newintblue = intblue
	
	if ((intred <=	intgreen) 	&& (intred <= intblue)) newintred = 0
	if ((intgreen < intred) 	&& (intgreen < intblue)) newintgreen = 0
	if ((intblue <=	intred) 	&& (intblue <= intgreen)) newintblue = 0
	
	var String redpwmString = Integer::toHexString(newintred)
	var String greenpwmString = Integer::toHexString(newintgreen)
	var String bluepwmString = Integer::toHexString(newintblue)

	
	var String rgb_cmd = ("00"+redpwmString).substring(redpwmString.length()) + ("00"+greenpwmString).substring(greenpwmString.length()) + ("00"+bluepwmString).substring(bluepwmString.length());
    rgb_cmd = "lights,rgb," + rgb_cmd + ",1"
	H801_1_CMD.postUpdate(rgb_cmd)	
	
end

rule "H801_1 Level"
when
	Item H801_1_level received update
then
	H801_1_CMD.postUpdate("lights,pct," + (H801_1_level.state as DecimalType).intValue +",1")
end

rule "H801_1 Temperature"
when
	Item H801_1_temp received update
then
	H801_1_CMD.postUpdate("lights,ct," + ( (2000 + (H801_1_temp.state as DecimalType).intValue * 40)) + ",1")
	// Sets The Range of Color Temperature (2000 + 0-100 * 40) gives a range from 2000 to 6000.
	//Change this according your led´s color temperatures or leave defaults
end

mastamx
New user
Posts: 2
Joined: 02 Apr 2018, 03:18

Re: Finished: H801 RGBWW control with openhab2 and mqtt

#22 Post by mastamx » 02 Apr 2018, 06:50

Another Question

If we send more than one new "RGB" command to H801, it will get clogged. Color Picker in Openhab is more like one value per 300ms. Is there a solution for this?

sledge
Normal user
Posts: 17
Joined: 20 Jan 2017, 20:42

Re: Finished: H801 RGBWW control with openhab2 and mqtt

#23 Post by sledge » 02 Apr 2018, 13:54

Hi, you can set a timer to prevent openhab from spamming rgb values. eg. wait for 2 sec bevore sending actual color

zupy666
Normal user
Posts: 15
Joined: 18 Nov 2017, 20:09

Re: Finished: H801 RGBWW control with openhab2 and mqtt

#24 Post by zupy666 » 22 Aug 2020, 08:55

Hi, I'm wondering if you could provide me with a link where I could download a newer version of the FW .ino file for the H80 based on "ESPEasy v2.0"?
So far I have used "Build 148" but it no longer works with OH 2.5.5.1 :(

On the OH side, I have the following configuration.

things:

Code: Select all

Thing topic nH801_1 "nH801_1" @ "Living" {
	Channels:
        Type string : H801_1_CMD  [ stateTopic="/nH801_1/cmd" , commandTopic="/nH801_1/cmd" ]
}
items:

Code: Select all

/*RGB_led - Living*/
Color H801_1_RGB            "Color Select"	<slider>
Dimmer H801_1_level         "White Level [%s %%]"
Dimmer H801_1_temp          "White Temperature [%s %%]"
//String gets update in Rule and sends Command to Device
String H801_1_CMD           { channel="mqtt:topic:komar:nH801_1:H801_1_CMD" }
sitemap:

Code: Select all

Frame label="RGB - H801_1 - Living" {
	Slider		item=H801_1_level
	Slider		item=H801_1_temp
	Colorpicker	item=H801_1_RGB		    icon="slider"
}
rules:

Code: Select all

import org.eclipse.smarthome.core.library.types.HSBType

rule "H801_1"
when
	Item H801_1_RGB changed
then
	var HSBType hsbValue = H801_1_RGB.state as HSBType
	var intred 		= hsbValue.red.intValue*255/100
	var intgreen 	= hsbValue.green.intValue*255/100
	var intblue 	= hsbValue.blue.intValue*255/100
		
	var newintred = intred
	var newintgreen = intgreen
	var newintblue = intblue
	
	if ((intred <=	intgreen) 	&& (intred <= intblue)) newintred = 0
	if ((intgreen < intred) 	&& (intgreen < intblue)) newintgreen = 0
	if ((intblue <=	intred) 	&& (intblue <= intgreen)) newintblue = 0
	
	var String redpwmString = Integer::toHexString(newintred)
	var String greenpwmString = Integer::toHexString(newintgreen)
	var String bluepwmString = Integer::toHexString(newintblue)

	var String rgb_cmd = ("00"+redpwmString).substring(redpwmString.length()) + ("00"+greenpwmString).substring(greenpwmString.length()) + ("00"+bluepwmString).substring(bluepwmString.length());
	H801_1_CMD.postUpdate("Lights,rgb," + rgb_cmd + ",1")
end

rule "H801_1 Level"
when
	Item H801_1_level changed
then
	H801_1_CMD.postUpdate("Lights,pct," + (H801_1_level.state as DecimalType).intValue +",1")
end

rule "H801_1 Temperature"
when
	Item H801_1_temp changed
then
	H801_1_CMD.postUpdate("Lights,ct," + ( (2000 + (H801_1_temp.state as DecimalType).intValue * 40)) + ",1")
	// Sets The Range of Color Temperature (2000 + 0-100 * 40) gives a range from 2000 to 6000.
	//Change this according your led´s color temperatures or leave defaults
end
In case I send the same command to the mqtt broker via the console or MQTT.fx, the command reaches the node and executes it correctly.

OH log:

Code: Select all

09:25:52.269 [INFO ] [smarthome.event.ItemStateChangedEvent] - H801_1_CMD changed from Lights,rgb,549300,1 to Lights,rgb,4c9300,1
H801 log:

Code: Select all

6159569 : WD : Uptime 102 ConnectFailures 0 FreeMem 20488
6161116 : Lights: Set 0/0/0/0/0
6161173 : Lights: Set 0/0/0/0/0
6162174 : Lights: Fade down complete
6189570 : WD : Uptime 103 ConnectFailures 0 FreeMem 20264

thanks for the help
Last edited by zupy666 on 22 Aug 2020, 11:51, edited 1 time in total.

User avatar
Ath
Normal user
Posts: 3519
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Finished: H801 RGBWW control with openhab2 and mqtt

#25 Post by Ath » 22 Aug 2020, 10:50

Latest version of ESPEasy is always available at the Github releases page: https://github.com/letscontrolit/ESPEasy/releases
Not sure about that H801 controller, but it looks like it's a 1 MB ESP8266 based device. Please make a proper backup of any rules/scripts/configuration before upgrading, there have been many improvements and changes to the firmware since R148, but it should all be backward compatible.

After an initial 'wired' update, it should be possible do do OTA (over the air) updates, when running on a 4 MB device you can always easily do an OTA update of the device. For 1 MB devices you need a 2-step procedure, first uploading a minimal-OTA version, and after that the desired updated version. I'd settle with one of the 'Normal' 1M builds for ESP8266.
/Ton (PayPal.me)

zupy666
Normal user
Posts: 15
Joined: 18 Nov 2017, 20:09

Re: Finished: H801 RGBWW control with openhab2 and mqtt

#26 Post by zupy666 » 22 Aug 2020, 11:16

Ath wrote: 22 Aug 2020, 10:50 Latest version of ESPEasy is always available at the Github releases page: https://github.com/letscontrolit/ESPEasy/releases
Not sure about that H801 controller, but it looks like it's a 1 MB ESP8266 based device. Please make a proper backup of any rules/scripts/configuration before upgrading, there have been many improvements and changes to the firmware since R148, but it should all be backward compatible.

After an initial 'wired' update, it should be possible do do OTA (over the air) updates, when running on a 4 MB device you can always easily do an OTA update of the device. For 1 MB devices you need a 2-step procedure, first uploading a minimal-OTA version, and after that the desired updated version. I'd settle with one of the 'Normal' 1M builds for ESP8266.
Hi Ath,

As far as I know H801 is not included in ESP_Easy_mega_20200812_normal_ESP8266_1M.bin and uses the plugin https://github.com/letscontrolit/ESPEas ... 5_RGBW.ino

To this end, I ask if anyone has already managed to compile a working sketch based on ESPEasy v2.0. Unfortunately, I don't have enough knowledge to just run the compiler successfully :(

Thanks for the help and reply

User avatar
Ath
Normal user
Posts: 3519
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Finished: H801 RGBWW control with openhab2 and mqtt

#27 Post by Ath » 22 Aug 2020, 11:43

Aha, no, plugin P105 (RGBW MiLight) is only available in the plugin playground, and didn't make it into an official plugin yet.

As the implementation of plugins has been slightly adapted over the last years (last change to this plugin was > 2 years ago), it's likely it will need some adjustments before it can be incorporated.

Other than being 'up to date', what is your reason to update your device? I assume it currently works as it should?
/Ton (PayPal.me)

zupy666
Normal user
Posts: 15
Joined: 18 Nov 2017, 20:09

Re: Finished: H801 RGBWW control with openhab2 and mqtt

#28 Post by zupy666 » 22 Aug 2020, 11:47

Ath wrote: 22 Aug 2020, 11:43 Aha, no, plugin P105 (RGBW MiLight) is only available in the plugin playground, and didn't make it into an official plugin yet.

As the implementation of plugins has been slightly adapted over the last years (last change to this plugin was > 2 years ago), it's likely it will need some adjustments before it can be incorporated.

Other than being 'up to date', what is your reason to update your device? I assume it currently works as it should?
The reason for the FW upgrade on the node is the inactivity in with OH.
For once, I can't find a reason on the OH side why he doesn't send me a command to the mqtt broker. Do you have any idea?

User avatar
Ath
Normal user
Posts: 3519
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Finished: H801 RGBWW control with openhab2 and mqtt

#29 Post by Ath » 22 Aug 2020, 11:58

Must assume you checked all the obvious possible errors, like bad WiFi connection (not likely as it can receive commands), changed password (or other settings) on the MQTT broker, change on the OH side so it doesn't understand the MQTT messages H801 is sending?
/Ton (PayPal.me)

zupy666
Normal user
Posts: 15
Joined: 18 Nov 2017, 20:09

Re: Finished: H801 RGBWW control with openhab2 and mqtt

#30 Post by zupy666 » 22 Aug 2020, 12:01

Finally again the thing works like it used to :)
The reason for the non-operation is my small superficiality :) in the rules.

In older versions than OH 2.2 it was enough if you sent the command "postUpdate" now you have to execute another "sendCommand".

Code: Select all

import org.eclipse.smarthome.core.library.types.HSBType

rule "H801_1"
when
	Item H801_1_RGB changed
then
	var HSBType hsbValue = H801_1_RGB.state as HSBType
	var intred 		= hsbValue.red.intValue*255/100
	var intgreen 	= hsbValue.green.intValue*255/100
	var intblue 	= hsbValue.blue.intValue*255/100
		
	var newintred = intred
	var newintgreen = intgreen
	var newintblue = intblue
	
	if ((intred <=	intgreen) 	&& (intred <= intblue)) newintred = 0
	if ((intgreen < intred) 	&& (intgreen < intblue)) newintgreen = 0
	if ((intblue <=	intred) 	&& (intblue <= intgreen)) newintblue = 0
	
	var String redpwmString = Integer::toHexString(newintred)
	var String greenpwmString = Integer::toHexString(newintgreen)
	var String bluepwmString = Integer::toHexString(newintblue)

	var String rgb_cmd = ("00"+redpwmString).substring(redpwmString.length()) + ("00"+greenpwmString).substring(greenpwmString.length()) + ("00"+bluepwmString).substring(bluepwmString.length());
	H801_1_CMD.postUpdate("Lights,rgb," + rgb_cmd + ",1")
	H801_1_CMD.sendCommand("Lights,rgb," + rgb_cmd + ",1")
end


rule "H801_1 Level"
when
	Item H801_1_level changed
then
	H801_1_CMD.postUpdate("Lights,pct," + (H801_1_level.state as DecimalType).intValue +",1")
	H801_1_CMD.sendCommand("Lights,pct," + (H801_1_level.state as DecimalType).intValue +",1")
end


rule "H801_1 Temperature"
when
	Item H801_1_temp changed
then
	H801_1_CMD.postUpdate("Lights,ct," + ( (2000 + (H801_1_temp.state as DecimalType).intValue * 40)) + ",1")
	H801_1_CMD.sendCommand("Lights,ct," + ( (2000 + (H801_1_temp.state as DecimalType).intValue * 40)) + ",1")
	// Sets The Range of Color Temperature (2000 + 0-100 * 40) gives a range from 2000 to 6000.
	//Change this according your led´s color temperatures or leave defaults
end
The above rules with correction. I hope someone else gets it right.

Ath thanks for the tips

User avatar
Ath
Normal user
Posts: 3519
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Finished: H801 RGBWW control with openhab2 and mqtt

#31 Post by Ath » 22 Aug 2020, 13:01

Well, having looked at the source of plugin P105, I'm not sure that's the plugin your ESP is actually using, as I have not found a 'Lights' command there, and also no hexadecimal values are accepted. Is there some other software-layer involved or another plugin used?
/Ton (PayPal.me)

zupy666
Normal user
Posts: 15
Joined: 18 Nov 2017, 20:09

Re: Finished: H801 RGBWW control with openhab2 and mqtt

#32 Post by zupy666 » 22 Aug 2020, 13:31

Ath wrote: 22 Aug 2020, 13:01 Well, having looked at the source of plugin P105, I'm not sure that's the plugin your ESP is actually using, as I have not found a 'Lights' command there, and also no hexadecimal values are accepted. Is there some other software-layer involved or another plugin used?
As already mentioned on the H801 is installed FW espeasy R148 and OH 2.5.5.1, no other physical or software level is in between.

Lights is not a command but a device, I am attaching a configuration on the node for easier explanation.
H8001_device_conf.PNG
H8001_device_conf.PNG (37.96 KiB) Viewed 26287 times

User avatar
Ath
Normal user
Posts: 3519
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Finished: H801 RGBWW control with openhab2 and mqtt

#33 Post by Ath » 22 Aug 2020, 13:38

Well, in the meantime I've found the plugin, P123, and it is referenced in the first message of this thread (that I hadn't read before... ;) ), it is from an external github repo.

I'll see if I can fix up that one to current 'state of affairs', as it does have the 'lights' commands and hexadecimal input values.
Might be a nice add-on to ESPEasy
/Ton (PayPal.me)

mrwee
Normal user
Posts: 225
Joined: 31 Aug 2016, 12:52

Re: Finished: H801 RGBWW control with openhab2 and mqtt

#34 Post by mrwee » 22 Aug 2020, 13:49

Ath wrote: 22 Aug 2020, 13:38 Well, in the meantime I've found the plugin, P123, and it is referenced in the first message of this thread (that I hadn't read before... ;) ), it is from an external github repo.

I'll see if I can fix up that one to current 'state of affairs', as it does have the 'lights' commands and hexadecimal input values.
Might be a nice add-on to ESPEasy
Would be very nice to have it updated. I'm running it on an old ESPEasy, and it's overall not that stable.

zupy666
Normal user
Posts: 15
Joined: 18 Nov 2017, 20:09

Re: Finished: H801 RGBWW control with openhab2 and mqtt

#35 Post by zupy666 » 22 Aug 2020, 13:53

I apologize for the confusion you're right Plugin 123: Lights is the real one.
And I would be very happy if this plugin was included in one of the newer releases as part of the mega brunch.
At the moment I have not been able to browse from the archive using the .ino file, when I find it I will add it if anything will help.

User avatar
Ath
Normal user
Posts: 3519
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Finished: H801 RGBWW control with openhab2 and mqtt

#36 Post by Ath » 22 Aug 2020, 14:35

This P123 plugin is even older, > 4 years old, and thus uses even older 'standards' in the code that since then have been either deprecated or are no longer working. And though I have fixed enough so it compiles without errors, I'm not sure if I should proceed, as I have no such controller, or the required RGBW lightstrip, I won't be able to test the code, so I won't push it to ESPEasy, unless someone would like to donate me a controller and matching lightstrip, as I don't have a proper use for them right now. (I prefer the use of the NeoPixel/WS28xx ledstrips, as they are easier to control IMHO, though I see some nice features in this plugin)
/Ton (PayPal.me)

Post Reply

Who is online

Users browsing this forum: No registered users and 65 guests