given the WLED can be used as a http dimmer can this rule “INCREASE/DECREASE”
by toggel a push button this wood be VERY NICE
…
Dimmer myDimmer "My http Dimmer is [%d %%]" {http=">[*:POST:http://www.domain.org/home/lights/23871/?status=%2$s&type=text] <[http://www.domain.org/weather/openhabcity/daily:60000:REGEX(.*?<title>(.*?)</title>.*)]"}
(Item definition from documentation)
Now to change the value, either use a slider in Basic UI or something similar, with “real” sliders, or use INCREASE/DECREASE commands and a rule to set the value:
rule "My http dimmer"
when
Item myDimmer received command
then
if (receivedCommand == DECREASE) {
myDimmer.sendCommand((myDimmer.state as DecimalType) - 5)
}
else if (receivedCommand == INCREASE) {
myDimmer.sendCommand((myDimmer.state as DecimalType) + 5)
}
I`m still making my lights smarter diy. ,but untili have gotten the first light to work like before
i tried to make it smarter (it had a regular dimmer before) , but i like some bling bling some times to play whit,so before i can move on to more lights i have to make this work first .
After woods i will like some off this lights to work on BK Hobby`s Hasp plates for next project
If you use min/max definition in the channel configuration in .things file, you can transform dimmer’s 0-100 percent values to wled’s 0-255 values. The only drawback is, there is no way to round it up to integer value, but it seems it works fine on wled side without problems.
Here is my master brightness definition:
.things:
Thing mqtt:topic:sentinel:k-led-1 "Kitchen LED 1" (mqtt:broker:sentinel) @ "MQTT2" {
Channels:
Type dimmer : k_led_1_Dimmer "Kitchen LED Brightness [%d]" [ stateTopic="wled/k_led_1/g", commandTopic="wled/k_led_1/api", min=0,max=255, formatBeforePublish="&A=%s" ]
i got everything working. To make it easier for following openHAB users i forked aditya_Sharma repository and tried to adapt my working configuration files. So far i couldn’t test it in a seperate openHAB installation. I will do this in the next few days. Also i tried to put all information from this thread into the read me from this repository.
@matt1 Thank you, I didn’t know about it, now I have it installed, it works and it looks like the problem. I am thinking is it because I use the firmware version for WLED_0.x.x_ESP8266_1M_ota.bin (I use ESP-01S RGB LED Controller Module) and it is not fully functional?
Do you have the latest iOS app or is that android? Try basic ui in a browser to check if it works in there. Older iOS version of it did that where the drop down lists were empty. It may be possible to use a mapping on the selection elements to fix it.
The other possible reason is when u drop a jar into the addons folder openhab may need more than one reboot for the cache to be created. Try a few reboots.
Regarding if it could be caused by your model of esp I doubt it as the binding should still display the full list in the selection drop down list. The list is hard encoded and should display fine, either it is the binding not loading correctly or a bug in your display ui, hence test it in basic ui.
thanks! I will try rebooting the system several times as well as with the basic interface. The items are all linked in Things, Android app version is the latest. As for my esp, I think there is no problem because previously using the solution of "Regnets Andreas " above, it works fully, except for Color.
Yeah that looks like it wont work as it is probably sending the wrong format for colour…
Type number : WLED_Color “WLED: Color” [ commandTopic=“wled/785f2a/col” ]
And then it uses a rule to send a packet. The above line should be removed from the things file and a unbound control created for the rule to use in a items file. see @aditya_Sharma post in this thread which has an example that looks like it will work.
Let me know which way works better once you solve the drop down list issue, which BTW it works fine here on Android app on my tablet, on my iOS phone and with Basic UI.
I hope someone can help me out here. I thought getting my WLED light integrated via MQTT would be super easy but somehow it is just not working. Instead of sending ON/OFF it is sending 1/0 thus just dimming the light. Here is my config
Thing:
Thing topic WledSchrank1 "Schrank rechts" @ "Wohnzimmer" {
Channels:
Type switch : power "Licht" [ stateTopic="wled/schrank1/g", commandTopic="wled/schrank1", transformationPattern="MAP:WLED.map" ]
}
Hi,
got it half working via MQTT (colour yes, switch, effect & palette settings no).
But I when I look up with MQTTExplorer I can see various topics - but no “api” topic:
It seems, the transformations don’t publish any values.
Any idea what I need to check to make this working? (I’m using mosquitto)
Never mind, seems the example on Github is not fully working. I got it working now with additional rules - here’s the final ruleset to make everything work:
rule “WLED: Adapt Color Parameter to WLED Notation”
when
Item WLED_Color received update
then
val HSBType newState = triggeringItem.state
val rgb = 16777215 + newState.getRGB
val mqttActions = getActions("mqtt","mqtt:broker:mosquitto")
mqttActions.publishMQTT("wled/wztv/col","" + rgb)
end
rule “WLED: Effect”
when
Item WLED_Effect received update or
Item WLED_Effect_Speed received update or
Item WLED_Effect_Intensity received update
then
val mqttActions = getActions("mqtt","mqtt:broker:mosquitto")
val effect = transform("MAP", "WLEDEffectMapping.map",WLED_Effect.state.toString)
mqttActions.publishMQTT("wled/wztv/api","&" + effect + "&SX=" + ((WLED_Effect_Speed.state as Number) * 255 / 100 ) + "&IX=" + ((WLED_Effect_Intensity.state as Number) * 255 / 100))
end
rule “WLED: Brightness”
when
Item WLED_Dimmer received update
then
val mqttActions = getActions("mqtt","mqtt:broker:mosquitto")
mqttActions.publishMQTT("wled/wztv/api","&A=" + ((WLED_Dimmer.state as Number) * 255 / 100 ))
end
rule “WLED: Palette”
when
Item WLED_Palette received update
then
val mqttActions = getActions("mqtt","mqtt:broker:mosquitto")
val palette = transform("MAP", "WLEDPaletteMapping.map",WLED_Palette.state.toString)
mqttActions.publishMQTT("wled/wztv/api","&" + palette)
Yes OLD setup is broken.
Now the new setup is ready with MQTT 2.5 and WLED latest version. I shall upload the latest one.
The discussion thread is here