OMG! That works so much better! Thanks. I’m not sure why sendcommandline doesn’t work as well, but this is awesome. Thank you so much for the help!
hardware:
ESP 12e v1 (Node MCU)
Software running on the board:
ESP Easy: http://www.esp8266.nu/index.php/ESPEasy
Here is the code for anyone in the future struggling.
.items
String frontPorchPWM12 { mqtt=">[mymosquitto:/frontPorch/PWM/12:state:*:default]" } String frontPorchPWM13 { mqtt=">[mymosquitto:/frontPorch/PWM/13:state:*:default]" } String frontPorchPWM15 { mqtt=">[mymosquitto:/frontPorch/PWM/15:state:*:default]" }
.sitemap
Colorpicker item=themeLights
.rule
import org.openhab.core.library.types.*
var String redpwmString
var String greenpwmString
var String bluepwmString
var HSBType hsbValue
rule "Theme lights"
when
Item themeLights received update
then
hsbValue = themeLights.state as HSBType // sets hsbValue to some kind of variable (int/float?)
redpwmString = (10*hsbValue.red.intValue).toString// grabs just the red value out of hsbValue and multiplies it time 10 so that it has a scale of 0-1000 for the PWM
frontPorchPWM15.postUpdate(redpwmString)// posts the value above in the MQTT message
greenpwmString = (10*hsbValue.green.intValue).toString//same as in red
frontPorchPWM13.postUpdate(greenpwmString)
bluepwmString = (10*hsbValue.blue.intValue).toString //same as in red
frontPorchPWM12.postUpdate(bluepwmString)