Openhab-> MQTT-> EasyESP-> LED Dimmer
Moderators: grovkillen, Stuntteam, TD-er
-
- New user
- Posts: 3
- Joined: 18 Feb 2016, 20:31
Openhab-> MQTT-> EasyESP-> LED Dimmer
Hi,
this weekend I startet with openhab (on RPI) and easyESP. I really like this software and after playing around I have some usefull applications in my mind.
I use an ESP-01 connected to a proto-board with DS18b20 (GPIO 0) and LED (GPIO 2) and are able to read and display the temperature and switch the LED on/off.
Now, I want to implement the dimming function over mqtt messages.
fyi: Later I want to control an Aquarium-LED and want to simulate the sunrise / sunset.
Is this possible with the easyESP-SW?
If yes, how is the mqtt command for the pwm value?
Something like:
Dimmer AQUALED1 "Dimmer [%s %%]" {mqtt=">[localbroker:/aqualed/gpio/2:command:PWM:<value>]"}
Thanks for your help.
br
Christian
this weekend I startet with openhab (on RPI) and easyESP. I really like this software and after playing around I have some usefull applications in my mind.
I use an ESP-01 connected to a proto-board with DS18b20 (GPIO 0) and LED (GPIO 2) and are able to read and display the temperature and switch the LED on/off.
Now, I want to implement the dimming function over mqtt messages.
fyi: Later I want to control an Aquarium-LED and want to simulate the sunrise / sunset.
Is this possible with the easyESP-SW?
If yes, how is the mqtt command for the pwm value?
Something like:
Dimmer AQUALED1 "Dimmer [%s %%]" {mqtt=">[localbroker:/aqualed/gpio/2:command:PWM:<value>]"}
Thanks for your help.
br
Christian
-
- New user
- Posts: 3
- Joined: 18 Feb 2016, 20:31
Re: Openhab-> MQTT-> EasyESP-> LED Dimmer
Nobody????
Re: Openhab-> MQTT-> EasyESP-> LED Dimmer
i searched the forum for "mqtt" and "pwm" and found some hints.
seems that mqtt cannot control pwm on an ESPeasy..
my you have a look yourself?
http:+pwm:
http://www.esp8266.nu/index.php/GPIO
http+pwm-fade:
http://www.esp8266.nu/forum/viewtopic.p ... +pwm#p4315
mqtt:
http://www.esp8266.nu/forum/viewtopic.p ... 3601#p3601
mqtt more detail:
http://www.esp8266.nu/forum/viewtopic.p ... +pwm#p4199
seems that mqtt cannot control pwm on an ESPeasy..
my you have a look yourself?
http:+pwm:
http://www.esp8266.nu/index.php/GPIO
http+pwm-fade:
http://www.esp8266.nu/forum/viewtopic.p ... +pwm#p4315
mqtt:
http://www.esp8266.nu/forum/viewtopic.p ... 3601#p3601
mqtt more detail:
http://www.esp8266.nu/forum/viewtopic.p ... +pwm#p4199
Re: Openhab-> MQTT-> EasyESP-> LED Dimmer
You should be able to replace "gpio" with "pwm". So instead of this sample:ultraschall81 wrote:Nobody????
Code: Select all
Switch MQTTLED {mqtt=">[localbroker:/openhabdemo/gpio/2:command:ON:1],>[localbroker:/openhabdemo/gpio/2:command:OFF:0]"}
Code: Select all
Switch MQTTLED {mqtt=">[localbroker:/openhabdemo/pwm/2:command:ON:512],>[localbroker:/openhabdemo/pwm/2:command:OFF:0]"}
Current version only supports gpio and pwm commands.
Next ESP edition will likely have the option to provide a full command, just like with the http protocol.
So with that edition, you can do stuff like this:
Code: Select all
Switch MQTTLEDPULSE {mqtt=">[broker:/openhabdemo/cmd:command:ON:pulse,2,0,500],>[broker:/openhabdemo/cmd:command:OFF:pulse,2,0,500]"}
Re: Openhab-> MQTT-> EasyESP-> LED Dimmer
just only to clarify the mqtt topic. (dont know openhab enough),
but if i do it with another mqttclient,
this
should look like this:
http://www.esp8266.nu/forum/viewtopic.p ... +pwm#p4097
or like this:
edit2, found new post with this:
http://www.esp8266.nu/forum/viewtopic.p ... read#p4538
which syntax is right for which firmware?
(meanwhile i try to check the source...
)
but if i do it with another mqttclient,
this
Code: Select all
Switch MQTTLED {mqtt=">[localbroker:/openhabdemo/gpio/2:command:ON:1],>[localbroker:/openhabdemo/gpio/2:command:OFF:0]"}
Code: Select all
mosquitto_pub -q 1 -d -t /esp3/GPIO/14 -m "0";
or like this:
Code: Select all
mosquitto_pub -q 1 -d -t "/esp-sysname/gpio/2:command:ON:1"
Code: Select all
Yes, it is possible.
I use:
esp GPIO:
sysname/pwm/2 with payload: 0-255
pca9685 GPIO
sysname/pcapwm/2 with payload: 0-4095
Top
which syntax is right for which firmware?
(meanwhile i try to check the source...

-
- New user
- Posts: 3
- Joined: 18 Feb 2016, 20:31
Re: Openhab-> MQTT-> EasyESP-> LED Dimmer
Hi,
yesterday I tried : Switch MQTTLED {mqtt=">[localbroker:/openhabdemo/pwm/2:command:ON:512],>[localbroker:/openhabdemo/pwm/2:command:OFF:0]"}
which was not working at all. The led was always off.
On the Weekend, I will try the new command: sysname/pwm/2 with payload: 0-255
yesterday I tried : Switch MQTTLED {mqtt=">[localbroker:/openhabdemo/pwm/2:command:ON:512],>[localbroker:/openhabdemo/pwm/2:command:OFF:0]"}
which was not working at all. The led was always off.
On the Weekend, I will try the new command: sysname/pwm/2 with payload: 0-255
Re: Openhab-> MQTT-> EasyESP-> LED Dimmer
i checked the source,
but i am somehow a coding noob and cant see anything
as far as i see, all possible MQTT output commands are hidden in each plugin separately. under the plugin_write section. or not?
so i think i cant find them at one place in the code.
if this is true for this archtectural decision,
i could be helpful for a normal user to have a serial-cmd
which iterates over the plugins and shows the user a list of possible (MQTT) output commands as a actual valid list.
Or am i wrong, somehow?
edit:
if this would be working the MQTT-way with the IR-Send plugin from the Playground, it would be gorgoius! 


as far as i see, all possible MQTT output commands are hidden in each plugin separately. under the plugin_write section. or not?
so i think i cant find them at one place in the code.
if this is true for this archtectural decision,
i could be helpful for a normal user to have a serial-cmd
which iterates over the plugins and shows the user a list of possible (MQTT) output commands as a actual valid list.
Or am i wrong, somehow?

edit:


Re: Openhab-> MQTT-> EasyESP-> LED Dimmer
I got my ESP8266 RGB LED Dimmer running this way with OpenHAB:
in the .items File:
(Do not use the Item "Dimmer" here because it only accepts Values from 0 to 100 - we need to send up to 1000 so we use the "Number" item)
in the .rules File:
was quite hard to get that running - and I am not a noob - I am in business since over 25 years. I like what's going on with esp/openhab and other IOT-stuff, but missing useful documentation for beginners/starters
Now I have it running with KNX - openHAB - MQTT - ESPEasy
btw: I have 12V drivers at the GPIO's that invert the GPIO signal, so maybe you have to invert the output somwhere else
Daniel
in the .items File:
Code: Select all
/* RGB ESP8266 */
Number RGB_OG05_2r "LED rot [%s]" <dimmer> (gOG_S, Lights) { mqtt=">[dsbroker:/ESP-OG01-S/pwm/14:command:*:default]" }
Number RGB_OG05_2g "LED grün [%s]" <dimmer> (gOG_S, Lights) { mqtt=">[dsbroker:/ESP-OG01-S/pwm/12:command:*:default]" }
Number RGB_OG05_2b "LED blau [%s]" <dimmer> (gOG_S, Lights) { mqtt=">[dsbroker:/ESP-OG01-S/pwm/13:command:*:default]" }
Color RGB_OG05_2 "Empire State" <slider> (gOG_S, Lights)
in the .rules File:
Code: Select all
var HSBType hsbValue
rule "Set RGB value"
when
Item RGB_OG05_2 changed
then
hsbValue = RGB_OG05_2.state as HSBType
sendCommand( RGB_OG05_2r, hsbValue.red.intValue * 10)
sendCommand( RGB_OG05_2g, hsbValue.green.intValue * 10)
sendCommand( RGB_OG05_2b, hsbValue.blue.intValue * 10)
end
Now I have it running with KNX - openHAB - MQTT - ESPEasy
btw: I have 12V drivers at the GPIO's that invert the GPIO signal, so maybe you have to invert the output somwhere else
Daniel
-
- New user
- Posts: 4
- Joined: 30 Jan 2016, 04:24
Re: Openhab-> MQTT-> EasyESP-> LED Dimmer
Hi dabe5,
I got stuck here, can you show me the codes in .sitemap file?
Thanks.
I got stuck here, can you show me the codes in .sitemap file?
Thanks.
Re: Openhab-> MQTT-> EasyESP-> LED Dimmer
Well my .sitemap is allmost empty
:
but you need to define a Room in the .items file:
But this is all OpenHAB stuff.

Code: Select all
sitemap demo label="EFH"
{
Frame {
Group item=gOG label="Obergeschoss" icon="firstfloor"
Group item=gEG label="Erdgeschoss" icon="groundfloor"
Group item=gUG label="Keller" icon="cellar"
}
}
Code: Select all
Group gOG_S "Zimmer links" <smiley> (gOG)
Who is online
Users browsing this forum: No registered users and 11 guests