Simple RGB PWM Control using Openhab2 + EasyESP

Hi,

I am trying to setup simple RGB Control using GPIO12,13 & 15 but i am not successful. I want to use color picker and it should give output HSB to PWM Pins. But nothing is happening.

Please if anyone had past experience please guide me whats wrong ?

items file

String aacc_color_r { mqtt=">[broker:/EASYESP/PWM/12:state:*:default]" }
String aacc_color_g { mqtt=">[broker:/EASYESP/PWM/13:state:*:default]" }
String aacc_color_b { mqtt=">[broker:/EASYESP/PWM/15:state:*:default]" }

rules file

rule "Set RGB LEDs from Color item using ColorPicker"
  when
    Item abc received command
  then
  	if (receivedCommand instanceof HSBType)
  	{
    	val red = receivedCommand.red * 10.23
    	val green = receivedCommand.green * 10.23
    	val blue = receivedCommand.blue * 10.23
	  	
	  	aacc_color_r.sendCommand(red)
	  	aacc_color_g.sendCommand(green)
	  	aacc_color_b.sendCommand(blue)
  	}

end

sitemap file
Colorpicker item=abc

1 Like

Does OH2 publish the state of these 3 items to the broker when the items get their commands from the rule? (check with a tool like MQTT.fx)

Your 3 mqtt String items are bound to an outgoing config to publish the state (not the command) but this shouldn’t be the problem since after the command, the state is updated and the String items should publish the updated state to the Broker.
Maybe the ESP does not react to incoming state updates (and requires incoming commands in another topic)?

I have tested with MQTT.fx but nothing is coming out. If i toggle switches its printed in MQTT.fx but this Color picker is not giving any output. any other suggestion ???

I also tried to chage state with command in things file, but still nothing.

then something is not working with your rule
add some logInfo statements to see what is happening.
Also, check the state of the 3 items from within openHAB console after the rule fires.

found something like

2017-08-06 12:04:07.849 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item ‘abc’ for widget org.eclipse.smarthome.model.sitemap.Colorpicker
2017-08-06 12:04:07.852 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item for widget org.eclipse.smarthome.model.sitemap.Colorpicker
2017-08-06 12:04:07.855 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item for widget org.eclipse.smarthome.model.sitemap.Colorpicker
2017-08-06 12:04:07.858 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item for widget org.eclipse.smarthome.model.sitemap.Colorpicker
2017-08-06 12:04:07.860 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item for widget org.eclipse.smarthome.model.sitemap.Colorpicker
2017-08-06 12:04:07.864 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item ‘abc’ for widget org.eclipse.smarthome.model.sitemap.Colorpicker
2017-08-06 12:04:07.868 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item ‘abc’ for widget org.eclipse.smarthome.model.sitemap.Colorpicker
2017-08-06 12:04:07.870 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item ‘abc’ for widget org.eclipse.smarthome.model.sitemap.Colorpicker