I have seen many examples on how to do this but I cannot get a single one to work. In my log I can see the correct information has been set to a string but in my items the MQTT never publishes due to an error that make no sense. This is basically from one of the many examples I came across.
Group WIFI_RGB_2 "WiFi RGB 2" (All)
Color fWIFI_RGB_2 "RGB" <slider> (WIFI_RGB_2)
String WIFI_RGB_2_RGB (WIFI_RGB_2) {mqtt=">[broker:bruh/sensornode1/set:command:*:default]"}
var HSBType hsbValue
var int redValue
var int greenValue
var int blueValue
var String RGBvalues
rule "Set RGB 2 value"
when
Item fWIFI_RGB_2 changed
then
hsbValue = fWIFI_RGB_2.state as HSBType
redValue = hsbValue.red.intValue
greenValue = hsbValue.green.intValue
blueValue = hsbValue.blue.intValue
RGBvalues= "{state:ON,color:{r:"+redValue.toString + ",g:" + greenValue.toString + ",b:" + blueValue.toString +"}}"
postUpdate( WIFI_RGB_2_RGB, RGBvalues )
logInfo( "fWIFI_RGB_2", RGBvalues )
end
The error in the log file is
org.eclipse.smarthome.model.item.BindingConfigParseException: Configuration 'broker:bruh/sensornode1/set:color:*:default' is not a valid outbound configuration: Invalid type.
Yet I know something is partially working because I also see the correct syntax in the log file which I am wanting to publish.
2017-06-15 00:14:17.161 [ItemStateChangedEvent ] - WIFI_RGB_2_RGB changed from {state:ON,color:{r:51,g:19,b:15}} to {state:ON,color:{r:51,g:15,b:33}}
But if I open a terminal on the MQTT server the following works just fine.
pi@raspberrypi:~ $ mosquitto_pub -t "bruh/sensornode1/set" -m "{state:ON,color:{r:51,g:19,b:15}}"
Yes broker and mosquitto are set to one in the same and receiving information from the sensor via broker works just fine. I can only assume I am looking something obvious over. Hopefully once this is figured out it will help those too who either are transitioning from Home Assistant or using some of the Arduino sketches created to work with Home Assistant, which I fall into the later.
For what itâs worth I literally installed Home Assistant just to try out this one feature and it works so I know itâs not anything hardware wise.