Reimplement my Sitemap (>1000 Items) to WebUI using the yamlcomposer and yaml based widget templates

I am not a YAML guy; I looked at this like a dear in headlights… (almost dismissive like: another thing I don’t know what do do with it)

… until a light bulb went on… (though a day later) :slight_smile:

And I am now in my second day playing with this; my 70 LED downlights are now .inc templated with thing, items, link and group and members creation. Same for my 5 batteries :slight_smile:

Simply awesome!! (y)

Thank you.

… as I continue to rework anything with multiple yet same things.

variables:
  topic_base: ArgyleCourt/Shed/Tower/PACE_MODBUS/${bms}
  item_prefix: BMS_${bms}
  group_prefix: grp_BMS_${bms}

things:
  mqtt:topic:mosquitto:${package_id}:
    bridge: mqtt:broker:mosquitto
    label: Teway Cell Battery ${bms}
    location: Shed Tower

    channels:
      pack_current:
        type: number
        label: BMS ${bms} Current
        config:
          stateTopic: ${topic_base}/pack/current

      pack_voltage:
        type: number
        label: BMS ${bms} Pack voltage
        config:
          stateTopic: ${topic_base}/pack/voltage

      pack_soc:
        type: number
        label: BMS ${bms} State of charge
        config:
          stateTopic: ${topic_base}/pack/soc

      pack_soh:
        type: number
        label: BMS ${bms} State of health
        config:
          stateTopic: ${topic_base}/pack/soh

      pack_capacity_remaining:
        type: number
        label: BMS ${bms} Remaining capacity
        config:
          stateTopic: ${topic_base}/pack/capacity_remain

      pack_capacity_full:
        type: number
        label: BMS ${bms} Full capacity
        config:
          stateTopic: ${topic_base}/pack/capacity_full

      pack_capacity_design:
        type: number
        label: BMS ${bms} Design capacity
        config:
          stateTopic: ${topic_base}/pack/capacity_design

      cell_voltage_1:
        type: number
        label: BMS ${bms} Cell 1 voltage
        config:
          stateTopic: ${topic_base}/cells/1
          min: 2
          max: 4

      cell_voltage_2:
        type: number
        label: BMS ${bms} Cell 2 voltage
        config:
          stateTopic: ${topic_base}/cells/2
          min: 2
          max: 4

      cell_voltage_3:
        type: number
        label: BMS ${bms} Cell 3 voltage
        config:
          stateTopic: ${topic_base}/cells/3
          min: 2
          max: 4

      cell_voltage_4:
        type: number
        label: BMS ${bms} Cell 4 voltage
        config:
          stateTopic: ${topic_base}/cells/4
          min: 2
          max: 4

      cell_voltage_5:
        type: number
        label: BMS ${bms} Cell 5 voltage
        config:
          stateTopic: ${topic_base}/cells/5
          min: 2
          max: 4

      cell_voltage_6:
        type: number
        label: BMS ${bms} Cell 6 voltage
        config:
          stateTopic: ${topic_base}/cells/6
          min: 2
          max: 4

      cell_voltage_7:
        type: number
        label: BMS ${bms} Cell 7 voltage
        config:
          stateTopic: ${topic_base}/cells/7
          min: 2
          max: 4

      cell_voltage_8:
        type: number
        label: BMS ${bms} Cell 8 voltage
        config:
          stateTopic: ${topic_base}/cells/8
          min: 2
          max: 4

      cell_voltage_9:
        type: number
        label: BMS ${bms} Cell 9 voltage
        config:
          stateTopic: ${topic_base}/cells/9
          min: 2
          max: 4

      cell_voltage_10:
        type: number
        label: BMS ${bms} Cell 10 voltage
        config:
          stateTopic: ${topic_base}/cells/10
          min: 2
          max: 4

      cell_voltage_11:
        type: number
        label: BMS ${bms} Cell 11 voltage
        config:
          stateTopic: ${topic_base}/cells/11
          min: 2
          max: 4

      cell_voltage_12:
        type: number
        label: BMS ${bms} Cell 12 voltage
        config:
          stateTopic: ${topic_base}/cells/12
          min: 2
          max: 4

      cell_voltage_13:
        type: number
        label: BMS ${bms} Cell 13 voltage
        config:
          stateTopic: ${topic_base}/cells/13
          min: 2
          max: 4

      cell_voltage_14:
        type: number
        label: BMS ${bms} Cell 14 voltage
        config:
          stateTopic: ${topic_base}/cells/14
          min: 2
          max: 4

      cell_voltage_15:
        type: number
        label: BMS ${bms} Cell 15 voltage
        config:
          stateTopic: ${topic_base}/cells/15
          min: 2
          max: 4

      cell_voltage_16:
        type: number
        label: BMS ${bms} Cell 16 voltage
        config:
          stateTopic: ${topic_base}/cells/16
          min: 2
          max: 4

      sum_cell_voltages:
        type: number
        label: BMS ${bms} Sum of cell voltages
        config:
          stateTopic: ${topic_base}/cell_sum
          min: 40
          max: 60

      sum_cell_voltage_half_1:
        type: number
        label: BMS ${bms} Cell voltage half 1
        config:
          stateTopic: ${topic_base}/cell_half_1
          min: 20
          max: 30

      sum_cell_voltage_half_2:
        type: number
        label: BMS ${bms} Cell voltage half 2
        config:
          stateTopic: ${topic_base}/cell_half_2
          min: 20
          max: 30

      battery_temp_1:
        type: number
        label: BMS ${bms} Battery temperature 1
        config:
          stateTopic: ${topic_base}/temp/battery_1
          min: 0
          max: 50

      battery_temp_2:
        type: number
        label: BMS ${bms} Battery temperature 2
        config:
          stateTopic: ${topic_base}/temp/battery_2
          min: 0
          max: 50

      battery_temp_3:
        type: number
        label: BMS ${bms} Battery temperature 3
        config:
          stateTopic: ${topic_base}/temp/battery_3
          min: 0
          max: 50

      battery_temp_4:
        type: number
        label: BMS ${bms} Battery temperature 4
        config:
          stateTopic: ${topic_base}/temp/battery_4
          min: 0
          max: 50

      mosfet_temperature:
        type: number
        label: BMS ${bms} MOSFET temperature
        config:
          stateTopic: ${topic_base}/temp/mosfet
          min: 0
          max: 100

      environment_temperature:
        type: number
        label: BMS ${bms} Environment temperature
        config:
          stateTopic: ${topic_base}/temp/environment
          min: 0
          max: 50

items:
  # Groups belonging to this BMS
  ${group_prefix}:
    type: Group
    label: BMS ${bms}

  ${group_prefix}_Cells:
    type: Group
    label: BMS ${bms} Cells
    groups: ["${group_prefix}", grp_Persist_Influx_Tewaycell]

  ${group_prefix}_Cells_1_to_8:
    type: Group
    label: BMS ${bms} Cells 1 to 8
    groups: ["${group_prefix}", gPersist_rrd4j]

  ${group_prefix}_Cells_9_to_16:
    type: Group
    label: BMS ${bms} Cells 9 to 16
    groups: ["${group_prefix}"]

  ${group_prefix}_Pack_Data:
    type: Group
    label: BMS ${bms} Pack data
    groups: [grp_Persist_Influx_Tewaycell]

  ${group_prefix}_Temperatures:
    type: Group
    groups: ["${group_prefix}", grp_Persist_Influx_Tewaycell]

  # MQTT-linked pack data
  ${item_prefix}_Current:
    type: Number
    label: BMS ${bms} Current
    icon: gPersist_rrd4j
    groups: ["${group_prefix}", gPersist_rrd4j, "${group_prefix}_Pack_Data"]
    channel: mqtt:topic:mosquitto:${package_id}:pack_current

  ${item_prefix}_Voltage:
    type: Number
    label: BMS ${bms} Voltage
    icon: gPersist_rrd4j
    groups: ["${group_prefix}", gPersist_rrd4j, "${group_prefix}_Pack_Data"]
    channel: mqtt:topic:mosquitto:${package_id}:pack_voltage

  ${item_prefix}_State_of_charge:
    type: Number
    label: BMS ${bms} State of charge
    icon: battery3
    groups: ["${group_prefix}", gPersist_rrd4j, "${group_prefix}_Pack_Data"]
    channel: mqtt:topic:mosquitto:${package_id}:pack_soc

  ${item_prefix}_State_of_health:
    type: Number
    label: BMS ${bms} State of health
    icon: battery3
    groups: ["${group_prefix}", gPersist_rrd4j]
    channel: mqtt:topic:mosquitto:${package_id}:pack_soh

  ${item_prefix}_Remaining_capacity:
    type: Number
    label: BMS ${bms} Remaining capacity
    icon: battery3
    groups: ["${group_prefix}", "${group_prefix}_Pack_Data"]
    channel: mqtt:topic:mosquitto:${package_id}:pack_capacity_remaining

  ${item_prefix}_Full_capacity:
    type: Number
    label: BMS ${bms} Full capacity
    icon: battery5
    groups: ["${group_prefix}"]
    channel: mqtt:topic:mosquitto:${package_id}:pack_capacity_full

  ${item_prefix}_Design_capacity:
    type: Number
    label: BMS ${bms} Design capacity
    icon: battery4
    groups: ["${group_prefix}"]
    channel: mqtt:topic:mosquitto:${package_id}:pack_capacity_design

  # MQTT-linked cell voltages
  ${item_prefix}_Cell_1_voltage:
    type: Number
    label: BMS ${bms} Cell 1 voltage
    icon: battery
    groups: ["${group_prefix}", "${group_prefix}_Cells", "${group_prefix}_Cells_1_to_8", gPersist_rrd4j]
    channel: mqtt:topic:mosquitto:${package_id}:cell_voltage_1

  ${item_prefix}_Cell_2_voltage:
    type: Number
    label: BMS ${bms} Cell 2 voltage
    icon: battery
    groups: ["${group_prefix}", "${group_prefix}_Cells", "${group_prefix}_Cells_1_to_8", gPersist_rrd4j]
    channel: mqtt:topic:mosquitto:${package_id}:cell_voltage_2

  ${item_prefix}_Cell_3_voltage:
    type: Number
    label: BMS ${bms} Cell 3 voltage
    icon: battery
    groups: ["${group_prefix}", "${group_prefix}_Cells", "${group_prefix}_Cells_1_to_8", gPersist_rrd4j]
    channel: mqtt:topic:mosquitto:${package_id}:cell_voltage_3

  ${item_prefix}_Cell_4_voltage:
    type: Number
    label: BMS ${bms} Cell 4 voltage
    icon: battery
    groups: ["${group_prefix}", "${group_prefix}_Cells", "${group_prefix}_Cells_1_to_8", gPersist_rrd4j]
    channel: mqtt:topic:mosquitto:${package_id}:cell_voltage_4

  ${item_prefix}_Cell_5_voltage:
    type: Number
    label: BMS ${bms} Cell 5 voltage
    icon: battery
    groups: ["${group_prefix}", "${group_prefix}_Cells", "${group_prefix}_Cells_1_to_8", gPersist_rrd4j]
    channel: mqtt:topic:mosquitto:${package_id}:cell_voltage_5

  ${item_prefix}_Cell_6_voltage:
    type: Number
    label: BMS ${bms} Cell 6 voltage
    icon: battery
    groups: ["${group_prefix}", "${group_prefix}_Cells", "${group_prefix}_Cells_1_to_8", gPersist_rrd4j]
    channel: mqtt:topic:mosquitto:${package_id}:cell_voltage_6

  ${item_prefix}_Cell_7_voltage:
    type: Number
    label: BMS ${bms} Cell 7 voltage
    icon: battery
    groups: ["${group_prefix}", "${group_prefix}_Cells", "${group_prefix}_Cells_1_to_8", gPersist_rrd4j]
    channel: mqtt:topic:mosquitto:${package_id}:cell_voltage_7

  ${item_prefix}_Cell_8_voltage:
    type: Number
    label: BMS ${bms} Cell 8 voltage
    icon: battery
    groups: ["${group_prefix}", "${group_prefix}_Cells", "${group_prefix}_Cells_1_to_8", gPersist_rrd4j]
    channel: mqtt:topic:mosquitto:${package_id}:cell_voltage_8

  ${item_prefix}_Cell_9_voltage:
    type: Number
    label: BMS ${bms} Cell 9 voltage
    icon: battery
    groups: ["${group_prefix}", "${group_prefix}_Cells", "${group_prefix}_Cells_9_to_16", gPersist_rrd4j]
    channel: mqtt:topic:mosquitto:${package_id}:cell_voltage_9

  ${item_prefix}_Cell_10_voltage:
    type: Number
    label: BMS ${bms} Cell 10 voltage
    icon: battery
    groups: ["${group_prefix}", "${group_prefix}_Cells", "${group_prefix}_Cells_9_to_16", gPersist_rrd4j]
    channel: mqtt:topic:mosquitto:${package_id}:cell_voltage_10

  ${item_prefix}_Cell_11_voltage:
    type: Number
    label: BMS ${bms} Cell 11 voltage
    icon: battery
    groups: ["${group_prefix}", "${group_prefix}_Cells", "${group_prefix}_Cells_9_to_16", gPersist_rrd4j]
    channel: mqtt:topic:mosquitto:${package_id}:cell_voltage_11

  ${item_prefix}_Cell_12_voltage:
    type: Number
    label: BMS ${bms} Cell 12 voltage
    icon: battery
    groups: ["${group_prefix}", "${group_prefix}_Cells", "${group_prefix}_Cells_9_to_16", gPersist_rrd4j]
    channel: mqtt:topic:mosquitto:${package_id}:cell_voltage_12

  ${item_prefix}_Cell_13_voltage:
    type: Number
    label: BMS ${bms} Cell 13 voltage
    icon: battery
    groups: ["${group_prefix}", "${group_prefix}_Cells", "${group_prefix}_Cells_9_to_16", gPersist_rrd4j]
    channel: mqtt:topic:mosquitto:${package_id}:cell_voltage_13

  ${item_prefix}_Cell_14_voltage:
    type: Number
    label: BMS ${bms} Cell 14 voltage
    icon: battery
    groups: ["${group_prefix}", "${group_prefix}_Cells", "${group_prefix}_Cells_9_to_16", gPersist_rrd4j]
    channel: mqtt:topic:mosquitto:${package_id}:cell_voltage_14

  ${item_prefix}_Cell_15_voltage:
    type: Number
    label: BMS ${bms} Cell 15 voltage
    icon: battery
    groups: ["${group_prefix}", "${group_prefix}_Cells", "${group_prefix}_Cells_9_to_16", gPersist_rrd4j]
    channel: mqtt:topic:mosquitto:${package_id}:cell_voltage_15

  ${item_prefix}_Cell_16_voltage:
    type: Number
    label: BMS ${bms} Cell 16 voltage
    icon: battery
    groups: ["${group_prefix}", "${group_prefix}_Cells", "${group_prefix}_Cells_9_to_16", gPersist_rrd4j]
    channel: mqtt:topic:mosquitto:${package_id}:cell_voltage_16

  # MQTT-linked calculated BMS values and temperatures
  ${item_prefix}_Cell_voltage_total:
    type: Number
    label: BMS ${bms} Cell voltage total
    icon: battery
    groups: ["${group_prefix}", gPersist_rrd4j]
    channel: mqtt:topic:mosquitto:${package_id}:sum_cell_voltages

  ${item_prefix}_Voltage_Sum_Cells_1_to_8:
    type: Number
    label: BMS ${bms} Voltage Sum Cells 1 to 8
    icon: battery3
    groups: ["${group_prefix}"]
    channel: mqtt:topic:mosquitto:${package_id}:sum_cell_voltage_half_1

  ${item_prefix}_Voltage_Sum_Cells_9_to_16:
    type: Number
    label: BMS ${bms} Voltage Sum Cells 9 to 16
    icon: battery3
    groups: ["${group_prefix}"]
    channel: mqtt:topic:mosquitto:${package_id}:sum_cell_voltage_half_2

  ${item_prefix}_Battery_temperature_1:
    type: Number
    groups: ["${group_prefix}", "${group_prefix}_Temperatures"]
    channel: mqtt:topic:mosquitto:${package_id}:battery_temp_1

  ${item_prefix}_Battery_temperature_2:
    type: Number
    groups: ["${group_prefix}", "${group_prefix}_Temperatures"]
    channel: mqtt:topic:mosquitto:${package_id}:battery_temp_2

  ${item_prefix}_Battery_temperature_3:
    type: Number
    groups: ["${group_prefix}", "${group_prefix}_Temperatures"]
    channel: mqtt:topic:mosquitto:${package_id}:battery_temp_3

  ${item_prefix}_Battery_temperature_4:
    type: Number
    groups: ["${group_prefix}", "${group_prefix}_Temperatures"]
    channel: mqtt:topic:mosquitto:${package_id}:battery_temp_4

  ${item_prefix}_MOSFET_temperature:
    type: Number
    label: BMS ${bms} MOSFET temperature
    icon: temperature
    groups: ["${group_prefix}", "${group_prefix}_Temperatures"]
    channel: mqtt:topic:mosquitto:${package_id}:mosfet_temperature

  ${item_prefix}_Environment_temperature:
    type: Number
    groups: ["${group_prefix}", "${group_prefix}_Temperatures"]
    channel: mqtt:topic:mosquitto:${package_id}:environment_temperature

  # Unlinked supporting items retained from BMS 1
  ${item_prefix}_Battery_Max_Voltage:
    type: Number
    label: BMS ${bms} Battery Max Voltage
    icon: battery5
    groups: ["${group_prefix}", gPersist_rrd4j]

  ${item_prefix}_Battery_Min_Voltage:
    type: Number
    label: BMS ${bms} Battery Min Voltage
    icon: battery1
    groups: ["${group_prefix}", gPersist_rrd4j]

  ${item_prefix}_Cell_Max_Voltage:
    type: Number
    label: BMS ${bms} Cell Max Voltage
    icon: battery5
    groups: ["${group_prefix}"]

  ${item_prefix}_Cell_Min_Voltage:
    type: Number
    label: BMS ${bms} Cell Min Voltage
    icon: battery1
    groups: ["${group_prefix}"]

  ${item_prefix}_Cells_1_to_8_Period:
    type: Number
    label: BMS ${bms} Cells 1 to 8 Period
    icon: calendar
    groups: ["${group_prefix}"]

  ${item_prefix}_Cells_9_to_16_Period:
    type: Number
    label: BMS ${bms} Cells 9 to 16 Period
    icon: calendar
    groups: ["${group_prefix}"]

  ${item_prefix}_Current_Period:
    type: Number
    label: BMS ${bms} Current Period
    icon: calendar
    groups: ["${group_prefix}"]

  ${item_prefix}_Delta_Between_Battery_Halves:
    type: Number
    label: BMS ${bms} Delta Between Battery Halves
    icon: gPersist_rrd4j
    groups: ["${group_prefix}", gPersist_rrd4j]

  ${item_prefix}_SOC_Period:
    type: Number
    label: BMS ${bms} SOC Period
    icon: calendar
    groups: ["${group_prefix}"]

  ${item_prefix}_Temperature_Period:
    type: Number
    label: BMS ${bms} Temperature Period
    icon: calendar
    groups: ["${group_prefix}"]

  ${item_prefix}_Voltage_Delta_Period:
    type: Number
    label: BMS ${bms} Voltage Delta Period
    icon: calendar
    groups: ["${group_prefix}"]

  ${item_prefix}_Voltage_Period:
    type: Number
    label: BMS ${bms} Voltage Period
    icon: calendar
    groups: ["${group_prefix}"]

version: 1

packages:
  tewaycell_4: !include
    file: $pkg/teway-cell.inc.yaml
    vars:
      bms: 4

The sitemap is something I’d like to tackle too; thanks for sharing.