binary_sensor:
  - platform: mqtt
    name: "Hallway motion occupancy"
    state_topic: "z2m_deconz/hallway_motion"
    availability_topic: "z2m_deconz/bridge/state"
    payload_on: true
    payload_off: false
    value_template: "{{ value_json.occupancy }}"
    device_class: "motion"
  - platform: mqtt
    name: "Kitchen motion occupancy"
    state_topic: "z2m_deconz/kitchen_motion"
    availability_topic: "z2m_deconz/bridge/state"
    payload_on: true
    payload_off: false
    value_template: "{{ value_json.occupancy }}"
    device_class: "motion"

sensor:
  # Hallway Motion
  - platform: mqtt
    name: "Hallway motion illuminance"
    state_topic: "z2m_deconz/hallway_motion"
    availability_topic: "z2m_deconz/bridge/state"
    device_class: "illuminance"
    value_template: "{{ value_json.illuminance_lux }}"
  - platform: mqtt
    name: "Hallway motion battery"
    state_topic: "z2m_deconz/hallway_motion"
    availability_topic: "z2m_deconz/bridge/state"
    unit_of_measurement: "%"
    device_class: "battery"
    value_template: "{{ value_json.battery }}"
  - platform: mqtt
    name: "Hallway motion LQI"
    state_topic: "z2m_deconz/hallway_motion"
    availability_topic: "z2m_deconz/bridge/state"
    icon: "mdi:signal"
    unit_of_measurement: "lqi"
    value_template: "{{ value_json.linkquality }}"

  # Kitchen Motion
  - platform: mqtt
    name: "Kitchen motion illuminance"
    state_topic: "z2m_deconz/kitchen_motion"
    availability_topic: "z2m_deconz/bridge/state"
    device_class: "illuminance"
    value_template: "{{ value_json.illuminance_lux }}"
  - platform: mqtt
    name: "Kitchen motion battery"
    state_topic: "z2m_deconz/kitchen_motion"
    availability_topic: "z2m_deconz/bridge/state"
    unit_of_measurement: "%"
    device_class: "battery"
    value_template: "{{ value_json.battery }}"
  - platform: mqtt
    name: "Kitchen motion LQI"
    state_topic: "z2m_deconz/kitchen_motion"
    availability_topic: "z2m_deconz/bridge/state"
    icon: "mdi:signal"
    unit_of_measurement: "lqi"
    value_template: "{{ value_json.linkquality }}"
