Hi !
Can someone please suggest changes in the items for using it with a things file in mqtt 2.4 setup. I have started late with OH and have only used mqtt2.4.
Update:
Was easy to find out. Thanks OH
Things Definition
Thing mqtt:topic:ledStripThingId "LED Strip"
(mqtt:broker:brokerThingId) @ "My Room"
{
Channels:
Type switch : ledStrip "LED Strip" [ stateTopic="wled/740dd6/g", commandTopic="wled/740dd6", transformationPattern="MAP:LEDONOFF.map" ]
Type dimmer : ledStripDimmerOne "Bed Room Night Brightness [%d]" [ stateTopic="wled/740dd6/g", commandTopic="wled/740dd6", min=0,max=255 ]
Type dimmer : ledStripSpeedOne "Bed Room Night light Speed [%.0f]" [ stateTopic="wled/740dd6/api", commandTopic="wled/740dd6/api", min=0,max=255, formatBeforePublish="&SX=%s" ]
Type dimmer : ledStripIntensityOne "Bed Room Night light intensity [%.0f]" [ stateTopic="wled/740dd6/api", commandTopic="wled/740dd6/api", min=0,max=255, formatBeforePublish="&IX=%s" ]
Type number : ledStripColorN "Bed Room Night Color" [ commandTopic="wled/740dd6/col", transformationPatternOut="MAP:wledColoreffectsJSON.map" ]
Type number : ledStripEffects "Bed Room Night Effects" [ commandTopic="wled/740dd6/api", transformationPatternOut="MAP:wledColoreffectsJSON.map" ]
Type number : ledStripPalettes "Bed Room Night Palettes" [ commandTopic="wled/740dd6/api", transformationPatternOut="MAP:wledColoreffectsJSON.map" ]
}
Item Definition
Switch LEDStrip "LED Strip" ["Switchable"] { channel="mqtt:topic:ledStripThingId:ledStrip" }
Dimmer LEDStripDimmerOne "Bed Room Night Brightness [%d]" { channel="mqtt:topic:ledStripThingId:ledStripDimmerOne" }
Dimmer LEDStripSpeedOne "Bed Room Night light Speed [%.0f]" { channel="mqtt:topic:ledStripThingId:ledStripSpeedOne" }
Dimmer LEDStripIntensityOne "Bed Room Night light intensity [%.0f]" { channel="mqtt:topic:ledStripThingId:ledStripIntensityOne" }
Number LEDStripColorN "Bed Room Night Color" { channel="mqtt:topic:ledStripThingId:ledStripColorN" }
Number LEDStripEffects "Bed Room Night Effects" { channel="mqtt:topic:ledStripThingId:ledStripEffects" }
Number LEDStripPalettes "Bed Room Night Palettes" { channel="mqtt:topic:ledStripThingId:ledStripPalettes" }
Color LEDStripColor "Bed Room Night Color"
Rule for the Color Picker Item
rule "Publish changes to the Color for LEDs"
when
Item LEDStripColor received update
then
val HSBType newState = triggeringItem.state
val rgb = 16777215 + newState.getRGB
val mqttActions = getActions("mqtt","mqtt:broker:brokerThingId") // use the Thing ID for your configured Broker
mqttActions.publishMQTT("wled/740dd6/col",""+rgb)
end
Works now.
Sitemap remains the same, just edit the names accordingly.
Note: I did not use the js transformation as I read some OH developer somewhere saying on the forum that running JS engine inside takes great resources on the machine. Hence I went for simpler approach instead. Thanks