HI , thanks for the last pointer I have been able to get the NodeMCU programmed on the network, connected to my MQTT server. Followed your last guidance and send command to control everything from MQTTfx.
I’ve now hit another sticking point for me. I followed your first post and videos and created the following all the relevant parts. I have included these below if someone can spot what i ahve done wrong?!
The issue is with the rule file I believe but not sure how to fix. My VS Studio is saying there are errors as the following image:
I thought this was because the items weren’t created but they are in my/your ledstrip.items file.
The result is a failed Json creation and the following being sent by my Mqtt server:
Any suggestions would be gratefully received.
Code used below:
ledstrip.items:
String LEDStrip_FF_Kitchen_Cabinet_1 "Kitchen Cabinet 1 String" {mqtt=">[broker:home/FF_Kitchen_Cabinet_1/set:state:*:default]"}
Switch LEDStrip_FF_Kitchen_Cabinet_1_Power "Kitchen Cabinet 1 Power" [ "Switchable" ] {mqtt=">[broker:home/FF_Kitchen_Cabinet_1/set:command:*:MAP(LEDStripEffectJSON.map)]"}
Number LEDStrip_FF_Kitchen_Cabinet_1_FX "Kitchen Cabinet 1 Fx" {mqtt=">[broker:home/FF_Kitchen_Cabinet_1/set:command:*:MAP(LEDStripEffectJSON.map)]"}
Color LEDStrip_FF_Kitchen_Cabinet_1_Color "Kitchen Cabinet 1 Color" <rgb> [ "Switchable" ]
Number LEDStrip_FF_Kitchen_Cabinet_1_Speed "Kitchen Cabinet 1 Speed [%.0f]"
Number LEDStrip_FF_Kitchen_Cabinet_1_Intensity "Kitchen Cabinet 1 Intensity [%d]"
ledstrip.sitemap:
sitemap sitemapnameforleds label="Led Strip Test"
{
Switch item=LEDStrip_FF_Kitchen_Cabinet_1_Power
Selection item=LEDStrip_FF_Kitchen_Cabinet_1_FX mappings=[1="BPM",2="Noise",3="Fire",4="Rainbow",5="Twinkle",6="Glitter",7="Solid",8="Sinelon",9="Juggle",10="Confetti",11="Dots",12="Lightning",13="Candy Cane",14="Cyclon Rainbow",15="Ripple",16="Christmas Alternate",17="Police All",18="Police One",19="Random Stars",20="Sine Hue"]
Colorpicker item=LEDStrip_FF_Kitchen_Cabinet_1_Color
Setpoint item=LEDStrip_FF_Kitchen_Cabinet_1_Speed minValue=5 maxValue=240 step=5
Setpoint item=LEDStrip_FF_Kitchen_Cabinet_1_Intensity minValue=0 maxValue=255 step=16
}
ledstrip.rules
rule "LED Strip Kitchen Cabinet 1 JSON Color"
when Item LEDStrip_FF_Kitchen_Cabinet_1_Color received update
then LEDStrip_FF_Kitchen_Cabinet_1.sendCommand("{\"color\": {" +
"\"r\": " + (LEDStrip_FF_Kitchen_Cabinet_1_Color.state as HSBType).red + "," +
"\"g\": " + (LEDStrip_FF_Kitchen_Cabinet_1_Color.state as HSBType).green + "," +
"\"b\": " + (LEDStrip_FF_Kitchen_Cabinet_1_Color.state as HSBType).blue + "}}") end
rule "LED Strip Kitchen Cabinet 1 JSON Speed"
when Item LEDStrip_FF_Kitchen_Cabinet_1_Speed received update
then LEDStrip_FF_Kitchen_Cabinet_1.sendCommand("{\"transition\": \"" + LEDStrip_FF_Kitchen_Cabinet_1_Speed.state + "\"}") end
rule "LED Strip Kitchen Cabinet 1 JSON Intensity"
when Item LEDStrip_FF_Kitchen_Cabinet_1_Intensity received update
then LEDStrip_FF_Kitchen_Cabinet_1.sendCommand("{\"brightness\":" + LEDStrip_FF_Kitchen_Cabinet_1_Intensity.state + "}") end
LEDStripEffectJSON.map:
1={"effect":"bpm"}
2={"effect":"noise"}
3={"effect":"fire"}
4={"effect":"rainbow"}
5={"effect":"twinkle"}
6={"effect":"glitter"}
7={"effect":"solid"}
8={"effect":"sinelon"}
9={"effect":"juggle"}
10={"effect":"confetti"}
11={"effect":"dots"}
12={"effect":"lightning"}
13={"effect":"candy cane"}
14={"effect":"cyclon rainbow"}
15={"effect":"ripple"}
16={"effect":"christmas alternate"}
17={"effect":"police all"}
18={"effect":"police one"}
19={"effect":"random stars"}
20={"effect":"sine hue"}
ON={"state":"ON"}
OFF={"state":"OFF"}