light:
  - platform: "mqtt"
    name: "hue_white_1"
    state_topic: "z2m_deconz/hue_white_1"
    availability_topic: "z2m_deconz/bridge/state"
    brightness: true
    color_temp: false
    xy: false
    hs: false
    schema: "json"
    command_topic: "z2m_deconz/hue_white_1/set"
    brightness_scale: 254

  - platform: "mqtt"
    name: "hue_white_2"
    state_topic: "z2m_deconz/hue_white_2"
    availability_topic: "z2m_deconz/bridge/state"
    brightness: true
    color_temp: false
    xy: false
    hs: false
    schema: "json"
    command_topic: "z2m_deconz/hue_white_2/set"
    brightness_scale: 254

  - platform: "mqtt"
    name: "hue_white_3"
    state_topic: "z2m_deconz/hue_white_3"
    availability_topic: "z2m_deconz/bridge/state"
    brightness: true
    color_temp: false
    xy: false
    hs: false
    schema: "json"
    command_topic: "z2m_deconz/hue_white_3/set"
    brightness_scale: 254

  - platform: "mqtt"
    name: "hue_white_4"
    state_topic: "z2m_deconz/hue_white_4"
    availability_topic: "z2m_deconz/bridge/state"
    brightness: true
    color_temp: false
    xy: false
    hs: false
    schema: "json"
    command_topic: "z2m_deconz/hue_white_4/set"
    brightness_scale: 254

  - platform: "mqtt"
    name: "hue_ambiance_1"
    state_topic: "z2m_deconz/hue_ambiance_1"
    availability_topic: "z2m_deconz/bridge/state"
    brightness: true
    color_temp: true
    xy: false
    hs: false
    schema: "json"
    command_topic: "z2m_deconz/hue_ambiance_1/set"
    brightness_scale: 254
    max_mireds: 500
    min_mireds: 150
    effect: true
    effect_list:
      - "blink"
      - "breathe"
      - "okay"
      - "channel_change"
      - "finish_effect"

  - platform: "mqtt"
    name: "hue_ambiance_2"
    state_topic: "z2m_deconz/hue_ambiance_2"
    availability_topic: "z2m_deconz/bridge/state"
    brightness: true
    color_temp: true
    xy: false
    hs: false
    schema: "json"
    command_topic: "z2m_deconz/hue_ambiance_2/set"
    brightness_scale: 254
    max_mireds: 500
    min_mireds: 150
    effect: true
    effect_list:
      - "blink"
      - "breathe"
      - "okay"
      - "channel_change"
      - "finish_effect"

  - platform: "mqtt"
    name: "hue_ambiance_3"
    state_topic: "z2m_deconz/hue_ambiance_3"
    availability_topic: "z2m_deconz/bridge/state"
    brightness: true
    color_temp: true
    xy: false
    hs: false
    schema: "json"
    command_topic: "z2m_deconz/hue_ambiance_3/set"
    brightness_scale: 254
    max_mireds: 500
    min_mireds: 150
    effect: true
    effect_list:
      - "blink"
      - "breathe"
      - "okay"
      - "channel_change"
      - "finish_effect"

  - platform: "mqtt"
    name: "hue_ambiance_4"
    state_topic: "z2m_deconz/hue_ambiance_4"
    availability_topic: "z2m_deconz/bridge/state"
    brightness: true
    color_temp: true
    xy: false
    hs: false
    schema: "json"
    command_topic: "z2m_deconz/hue_ambiance_4/set"
    brightness_scale: 254
    max_mireds: 500
    min_mireds: 150
    effect: true
    effect_list:
      - "blink"
      - "breathe"
      - "okay"
      - "channel_change"
      - "finish_effect"

  - platform: "mqtt"
    name: "hue_1"
    state_topic: "z2m_deconz/hue_1"
    availability_topic: "z2m_deconz/bridge/state"
    brightness: true
    color_temp: true
    xy: true
    hs: false
    schema: "json"
    command_topic: "z2m_deconz/hue_1/set"
    brightness_scale: 254
    max_mireds: 500
    min_mireds: 150
    effect: true
    effect_list:
      - "blink"
      - "breathe"
      - "okay"
      - "channel_change"
      - "finish_effect"
      - "stop_effect"

  - platform: "mqtt"
    name: "hue_2"
    state_topic: "z2m_deconz/hue_2"
    availability_topic: "z2m_deconz/bridge/state"
    brightness: true
    color_temp: true
    xy: true
    hs: false
    schema: "json"
    command_topic: "z2m_deconz/hue_2/set"
    brightness_scale: 254
    max_mireds: 500
    min_mireds: 150
    effect: true
    effect_list:
      - "blink"
      - "breathe"
      - "okay"
      - "channel_change"
      - "finish_effect"
      - "stop_effect"

  - platform: "mqtt"
    name: "hue_3"
    state_topic: "z2m_deconz/hue_3"
    availability_topic: "z2m_deconz/bridge/state"
    brightness: true
    color_temp: true
    xy: true
    hs: false
    schema: "json"
    command_topic: "z2m_deconz/hue_3/set"
    brightness_scale: 254
    max_mireds: 500
    min_mireds: 150
    effect: true
    effect_list:
      - "blink"
      - "breathe"
      - "okay"
      - "channel_change"
      - "finish_effect"
      - "stop_effect"

  - platform: "mqtt"
    name: "hue_4"
    state_topic: "z2m_deconz/hue_4"
    availability_topic: "z2m_deconz/bridge/state"
    brightness: true
    color_temp: true
    xy: true
    hs: false
    schema: "json"
    command_topic: "z2m_deconz/hue_4/set"
    brightness_scale: 254
    max_mireds: 500
    min_mireds: 150
    effect: true
    effect_list:
      - "blink"
      - "breathe"
      - "okay"
      - "channel_change"
      - "finish_effect"
      - "stop_effect"

  - platform: "mqtt"
    name: "hue_5"
    state_topic: "z2m_deconz/hue_5"
    availability_topic: "z2m_deconz/bridge/state"
    brightness: true
    color_temp: true
    xy: true
    hs: false
    schema: "json"
    command_topic: "z2m_deconz/hue_5/set"
    brightness_scale: 254
    max_mireds: 500
    min_mireds: 150
    effect: true
    effect_list:
      - "blink"
      - "breathe"
      - "okay"
      - "channel_change"
      - "finish_effect"
      - "stop_effect"


sensor:
  - platform: "mqtt"
    name: "hue_white_1_lqi"
    state_topic: "z2m_deconz/hue_white_1"
    availability_topic: "z2m_deconz/bridge/state"
    value_template: "{{ value_json.linkquality }}"
    unit_of_measurement: "lqi"
    icon: "mdi:signal"
  - platform: "mqtt"
    name: "hue_white_1_update_state"
    state_topic: "z2m_deconz/hue_white_1"
    availability_topic: "z2m_deconz/bridge/state"
    icon: "mdi:update"
    value_template: "{{ value_json['update']['state'] }}"

  - platform: "mqtt"
    name: "hue_white_2_lqi"
    state_topic: "z2m_deconz/hue_white_2"
    availability_topic: "z2m_deconz/bridge/state"
    value_template: "{{ value_json.linkquality }}"
    unit_of_measurement: "lqi"
    icon: "mdi:signal"
  - platform: "mqtt"
    name: "hue_white_2_update_state"
    state_topic: "z2m_deconz/hue_white_2"
    availability_topic: "z2m_deconz/bridge/state"
    icon: "mdi:update"
    value_template: "{{ value_json['update']['state'] }}"

  - platform: "mqtt"
    name: "hue_white_3_lqi"
    state_topic: "z2m_deconz/hue_white_3"
    availability_topic: "z2m_deconz/bridge/state"
    value_template: "{{ value_json.linkquality }}"
    unit_of_measurement: "lqi"
    icon: "mdi:signal"
  - platform: "mqtt"
    name: "hue_white_3_update_state"
    state_topic: "z2m_deconz/hue_white_3"
    availability_topic: "z2m_deconz/bridge/state"
    icon: "mdi:update"
    value_template: "{{ value_json['update']['state'] }}"

  - platform: "mqtt"
    name: "hue_white_4_lqi"
    state_topic: "z2m_deconz/hue_white_4"
    availability_topic: "z2m_deconz/bridge/state"
    value_template: "{{ value_json.linkquality }}"
    unit_of_measurement: "lqi"
    icon: "mdi:signal"
  - platform: "mqtt"
    name: "hue_white_4_update_state"
    state_topic: "z2m_deconz/hue_white_4"
    availability_topic: "z2m_deconz/bridge/state"
    icon: "mdi:update"
    value_template: "{{ value_json['update']['state'] }}"

  - platform: "mqtt"
    name: "hue_ambiance_1_lqi"
    state_topic: "z2m_deconz/hue_ambiance_1"
    availability_topic: "z2m_deconz/bridge/state"
    value_template: "{{ value_json.linkquality }}"
    unit_of_measurement: "lqi"
    icon: "mdi:signal"
  - platform: "mqtt"
    name: "hue_ambiance_1_update_state"
    state_topic: "z2m_deconz/hue_ambiance_1"
    availability_topic: "z2m_deconz/bridge/state"
    icon: "mdi:update"
    value_template: "{{ value_json['update']['state'] }}"

  - platform: "mqtt"
    name: "hue_ambiance_2_lqi"
    state_topic: "z2m_deconz/hue_ambiance_2"
    availability_topic: "z2m_deconz/bridge/state"
    value_template: "{{ value_json.linkquality }}"
    unit_of_measurement: "lqi"
    icon: "mdi:signal"
  - platform: "mqtt"
    name: "hue_ambiance_2_update_state"
    state_topic: "z2m_deconz/hue_ambiance_2"
    availability_topic: "z2m_deconz/bridge/state"
    icon: "mdi:update"
    value_template: "{{ value_json['update']['state'] }}"

  - platform: "mqtt"
    name: "hue_ambiance_3_lqi"
    state_topic: "z2m_deconz/hue_ambiance_3"
    availability_topic: "z2m_deconz/bridge/state"
    value_template: "{{ value_json.linkquality }}"
    unit_of_measurement: "lqi"
    icon: "mdi:signal"
  - platform: "mqtt"
    name: "hue_ambiance_3_update_state"
    state_topic: "z2m_deconz/hue_ambiance_3"
    availability_topic: "z2m_deconz/bridge/state"
    icon: "mdi:update"
    value_template: "{{ value_json['update']['state'] }}"

  - platform: "mqtt"
    name: "hue_ambiance_4_lqi"
    state_topic: "z2m_deconz/hue_ambiance_4"
    availability_topic: "z2m_deconz/bridge/state"
    value_template: "{{ value_json.linkquality }}"
    unit_of_measurement: "lqi"
    icon: "mdi:signal"
  - platform: "mqtt"
    name: "hue_ambiance_4_update_state"
    state_topic: "z2m_deconz/hue_ambiance_4"
    availability_topic: "z2m_deconz/bridge/state"
    icon: "mdi:update"
    value_template: "{{ value_json['update']['state'] }}"

  - platform: "mqtt"
    name: "hue_1_lqi"
    state_topic: "z2m_deconz/hue_1"
    availability_topic: "z2m_deconz/bridge/state"
    value_template: "{{ value_json.linkquality }}"
    unit_of_measurement: "lqi"
    icon: "mdi:signal"
  - platform: "mqtt"
    name: "hue_1_update_state"
    state_topic: "z2m_deconz/hue_1"
    availability_topic: "z2m_deconz/bridge/state"
    icon: "mdi:update"
    value_template: "{{ value_json['update']['state'] }}"

  - platform: "mqtt"
    name: "hue_2_lqi"
    state_topic: "z2m_deconz/hue_2"
    availability_topic: "z2m_deconz/bridge/state"
    value_template: "{{ value_json.linkquality }}"
    unit_of_measurement: "lqi"
    icon: "mdi:signal"
  - platform: "mqtt"
    name: "hue_2_update_state"
    state_topic: "z2m_deconz/hue_2"
    availability_topic: "z2m_deconz/bridge/state"
    icon: "mdi:update"
    value_template: "{{ value_json['update']['state'] }}"

  - platform: "mqtt"
    name: "hue_3_lqi"
    state_topic: "z2m_deconz/hue_3"
    availability_topic: "z2m_deconz/bridge/state"
    value_template: "{{ value_json.linkquality }}"
    unit_of_measurement: "lqi"
    icon: "mdi:signal"
  - platform: "mqtt"
    name: "hue_3_update_state"
    state_topic: "z2m_deconz/hue_3"
    availability_topic: "z2m_deconz/bridge/state"
    icon: "mdi:update"
    value_template: "{{ value_json['update']['state'] }}"

  - platform: "mqtt"
    name: "hue_4_lqi"
    state_topic: "z2m_deconz/hue_4"
    availability_topic: "z2m_deconz/bridge/state"
    value_template: "{{ value_json.linkquality }}"
    unit_of_measurement: "lqi"
    icon: "mdi:signal"
  - platform: "mqtt"
    name: "hue_4_update_state"
    state_topic: "z2m_deconz/hue_4"
    availability_topic: "z2m_deconz/bridge/state"
    icon: "mdi:update"
    value_template: "{{ value_json['update']['state'] }}"

  - platform: "mqtt"
    name: "hue_5_lqi"
    state_topic: "z2m_deconz/hue_5"
    availability_topic: "z2m_deconz/bridge/state"
    value_template: "{{ value_json.linkquality }}"
    unit_of_measurement: "lqi"
    icon: "mdi:signal"
  - platform: "mqtt"
    name: "hue_5_update_state"
    state_topic: "z2m_deconz/hue_5"
    availability_topic: "z2m_deconz/bridge/state"
    icon: "mdi:update"
    value_template: "{{ value_json['update']['state'] }}"


binary_sensor:
  - platform: "mqtt"
    name: "hue_white_1_update_available"
    state_topic: "z2m_deconz/hue_white_1"
    availability_topic: "z2m_deconz/bridge/state"
    payload_on: true
    payload_off: false
    value_template: "{{ value_json.update_available}}"
  - platform: "mqtt"
    name: "hue_white_2_update_available"
    state_topic: "z2m_deconz/hue_white_2"
    availability_topic: "z2m_deconz/bridge/state"
    payload_on: true
    payload_off: false
    value_template: "{{ value_json.update_available}}"
  - platform: "mqtt"
    name: "hue_white_3_update_available"
    state_topic: "z2m_deconz/hue_white_3"
    availability_topic: "z2m_deconz/bridge/state"
    payload_on: true
    payload_off: false
    value_template: "{{ value_json.update_available}}"
  - platform: "mqtt"
    name: "hue_white_4_update_available"
    state_topic: "z2m_deconz/hue_white_4"
    availability_topic: "z2m_deconz/bridge/state"
    payload_on: true
    payload_off: false
    value_template: "{{ value_json.update_available}}"

  - platform: "mqtt"
    name: "hue_ambiance_1_update_available"
    state_topic: "z2m_deconz/hue_ambiance_1"
    availability_topic: "z2m_deconz/bridge/state"
    payload_on: true
    payload_off: false
    value_template: "{{ value_json.update_available}}"
  - platform: "mqtt"
    name: "hue_ambiance_2_update_available"
    state_topic: "z2m_deconz/hue_ambiance_2"
    availability_topic: "z2m_deconz/bridge/state"
    payload_on: true
    payload_off: false
    value_template: "{{ value_json.update_available}}"
  - platform: "mqtt"
    name: "hue_ambiance_3_update_available"
    state_topic: "z2m_deconz/hue_ambiance_3"
    availability_topic: "z2m_deconz/bridge/state"
    payload_on: true
    payload_off: false
    value_template: "{{ value_json.update_available}}"
  - platform: "mqtt"
    name: "hue_ambiance_4_update_available"
    state_topic: "z2m_deconz/hue_ambiance_4"
    availability_topic: "z2m_deconz/bridge/state"
    payload_on: true
    payload_off: false
    value_template: "{{ value_json.update_available}}"

  - platform: "mqtt"
    name: "hue_1_update_available"
    state_topic: "z2m_deconz/hue_1"
    availability_topic: "z2m_deconz/bridge/state"
    payload_on: true
    payload_off: false
    value_template: "{{ value_json.update_available}}"
  - platform: "mqtt"
    name: "hue_2_update_available"
    state_topic: "z2m_deconz/hue_2"
    availability_topic: "z2m_deconz/bridge/state"
    payload_on: true
    payload_off: false
    value_template: "{{ value_json.update_available}}"
  - platform: "mqtt"
    name: "hue_3_update_available"
    state_topic: "z2m_deconz/hue_3"
    availability_topic: "z2m_deconz/bridge/state"
    payload_on: true
    payload_off: false
    value_template: "{{ value_json.update_available}}"
  - platform: "mqtt"
    name: "hue_4_update_available"
    state_topic: "z2m_deconz/hue_4"
    availability_topic: "z2m_deconz/bridge/state"
    payload_on: true
    payload_off: false
    value_template: "{{ value_json.update_available}}"
  - platform: "mqtt"
    name: "hue_5_update_available"
    state_topic: "z2m_deconz/hue_5"
    availability_topic: "z2m_deconz/bridge/state"
    payload_on: true
    payload_off: false
    value_template: "{{ value_json.update_available}}"
