Standard OH config; I need to check this out!
Well, point taken; lets give it a YAMLcomposer example then (see,I said I am not a YAML guy; never used it in context with openHAB).
The battery set-up here is a YAMLcomposer example ![]()
This is another composer example; creating LEDs…
variables:
group_prefix: grp_${item_prefix}
power_groups: []
colour_groups: []
online_groups: []
things:
mqtt:topic:mosquitto:${package_id}:
bridge: mqtt:broker:mosquitto
label: ${thing_label}
location: ${location}
channels:
online:
type: switch
label: Online
config:
stateTopic: ${topic_base}/availability
transformationPattern:
- JSONPATH:$.state
"on": online
"off": offline
power:
type: switch
label: Power
config:
stateTopic: ${topic_base}/state
commandTopic: ${topic_base}/set/state
brightness:
type: dimmer
label: Brightness
config:
stateTopic: ${topic_base}/brightness
commandTopic: ${topic_base}/set
transformationPattern:
- JS:light_brightness_in.js
transformationPatternOut:
- JS:light_brightness_out.js
formatBeforePublish: '{"brightness":%s,"transition":3}'
min: 0
max: 100
colour:
type: color
label: Colour
config:
colorMode: XYY
stateTopic: ${topic_base}
commandTopic: ${topic_base}/set
transformationPattern:
- JS:light_xyy_in.js
transformationPatternOut:
- JS:light_xyy_out.js
colour_temperature:
type: dimmer
label: Colour temperature
config:
stateTopic: ${topic_base}/color_temp
commandTopic: ${topic_base}/set
transformationPattern:
- JS:light_temp_in.js
transformationPatternOut:
- JS:light_temp_out.js
formatBeforePublish: '{"color_temp":%s,"transition":3}'
min: 0
max: 100
colour_mode:
type: string
label: Colour mode
config:
stateTopic: ${topic_base}/color_mode
link_quality:
type: number
label: Link quality
config:
stateTopic: ${topic_base}/linkquality
min: 0
max: 255
command:
type: string
label: Combined JSON command
config:
commandTopic: ${topic_base}/set
items:
${group_prefix}:
type: Group
label: ${thing_label}
${item_prefix}_Power:
type: Switch
label: ${thing_label} power
icon: switch
groups: "${[group_prefix] + power_groups}"
channel: mqtt:topic:mosquitto:${package_id}:power
${item_prefix}_Brightness:
type: Dimmer
label: ${thing_label} brightness
icon: light
groups: ["${group_prefix}"]
channel: mqtt:topic:mosquitto:${package_id}:brightness
${item_prefix}_Colour:
type: Color
label: ${thing_label} colour
icon: colorwheel
groups: "${[group_prefix] + colour_groups}"
channel: mqtt:topic:mosquitto:${package_id}:colour
${item_prefix}_ColourTemperature:
type: Dimmer
label: ${thing_label} colour temperature
icon: colorwheel
groups: ["${group_prefix}"]
channel: mqtt:topic:mosquitto:${package_id}:colour_temperature
${item_prefix}_Online:
type: Switch
label: ${thing_label} online
icon: network
groups: "${[group_prefix] + online_groups}"
channel: mqtt:topic:mosquitto:${package_id}:online
${item_prefix}_ColourMode:
type: String
label: ${thing_label} colour mode
groups: ["${group_prefix}"]
channel: mqtt:topic:mosquitto:${package_id}:colour_mode
${item_prefix}_LinkQuality:
type: Number
label: ${thing_label} link quality
icon: network
groups: ["${group_prefix}"]
channel: mqtt:topic:mosquitto:${package_id}:link_quality
${item_prefix}_Command:
type: String
label: ${thing_label} combined command
groups: ["${group_prefix}"]
channel: mqtt:topic:mosquitto:${package_id}:command
version: 1
packages:
house_led_001: !include
file: $pkg/zigbee-rgbcct-light.inc.yaml
vars:
topic_base: ArgyleCourt/House/LED_001
item_prefix: House_LED_001
thing_label: House LED 001
location: House
house_led_002: !include
file: $pkg/zigbee-rgbcct-light.inc.yaml
vars:
topic_base: ArgyleCourt/House/LED_002
item_prefix: House_LED_002
thing_label: House LED 002
location: House
# ...through House_LED_050
I don’t know though if there is a loop or range [1..50] option.