Finished: H801 RGBWW control with openhab2 and mqtt
Moderators: grovkillen, Stuntteam, TD-er
Re: Finished: H801 RGBWW control with openhab2 and mqtt
Very well done Guys! Thanks for your efforts
Re: Finished: H801 RGBWW control with openhab2 and mqtt
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.:
Only after a reboot, can I get it to work
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
Re: Finished: H801 RGBWW control with openhab2 and mqtt
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.
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.
Re: Finished: H801 RGBWW control with openhab2 and mqtt
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.
Re: Finished: H801 RGBWW control with openhab2 and mqtt
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?
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?
Re: Finished: H801 RGBWW control with openhab2 and mqtt
Erm did you read first post? The connection to openhab is well explained. Your log is normal it shows no error.
Re: Finished: H801 RGBWW control with openhab2 and mqtt
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
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
Re: Finished: H801 RGBWW control with openhab2 and mqtt
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.
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.
Re: Finished: H801 RGBWW control with openhab2 and mqtt
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"
Re: Finished: H801 RGBWW control with openhab2 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.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.
Peter
Re: Finished: H801 RGBWW control with openhab2 and mqtt
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:
sitemap:
rules:
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]" }
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"
}
}
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
Re: Finished: H801 RGBWW control with openhab2 and mqtt
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?
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?
Re: Finished: H801 RGBWW control with openhab2 and mqtt
Hi, you can set a timer to prevent openhab from spamming rgb values. eg. wait for 2 sec bevore sending actual color
Re: Finished: H801 RGBWW control with openhab2 and mqtt
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:
items:
sitemap:
rules:
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:
H801 log:
thanks for the help
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" ]
}
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" }
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"
}
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
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
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.
Re: Finished: H801 RGBWW control with openhab2 and mqtt
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.
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)
Re: Finished: H801 RGBWW control with openhab2 and mqtt
Hi Ath,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.
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
Re: Finished: H801 RGBWW control with openhab2 and mqtt
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?
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)
Re: Finished: H801 RGBWW control with openhab2 and mqtt
The reason for the FW upgrade on the node is the inactivity in with OH.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?
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?
Re: Finished: H801 RGBWW control with openhab2 and mqtt
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)
Re: Finished: H801 RGBWW control with openhab2 and mqtt
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".
The above rules with correction. I hope someone else gets it right.
Ath thanks for the tips
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
Ath thanks for the tips
Re: Finished: H801 RGBWW control with openhab2 and mqtt
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)
Re: Finished: H801 RGBWW control with openhab2 and mqtt
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.
Re: Finished: H801 RGBWW control with openhab2 and mqtt
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
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)
Re: Finished: H801 RGBWW control with openhab2 and mqtt
Would be very nice to have it updated. I'm running it on an old ESPEasy, and it's overall not that stable.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
Re: Finished: H801 RGBWW control with openhab2 and mqtt
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.
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.
Re: Finished: H801 RGBWW control with openhab2 and mqtt
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)
Who is online
Users browsing this forum: No registered users and 65 guests