sensor:
  - platform: mlx90614
    update_interval: 5s
    ambient:
      id: mlx90614_temperature_ambient
      name: "IR: Ambient Temperature"
      unit_of_measurement: °C
      accuracy_decimals: 2
      <<: !include filter.yaml
      on_value:
        if:
          condition:
            sensor.in_range:
              id: mlx90614_temperature_ambient
              below: 0.0
          then:
            - logger.log: 
                format: "IR Temperature sensor 'ambient' misbehaving, resetting device!"
                level: ERROR
            - button.press: device_reset
    object:
      id: mlx90614_temperature_object
      name: "IR: Object Temperature"
      unit_of_measurement: °C
      accuracy_decimals: 2
      <<: !include filter.yaml
      on_value:
        if:
          condition:
            sensor.in_range:
              id: mlx90614_temperature_object
              below: 0.0
          then:
            - logger.log: 
                format: "IR Temperature sensor 'object' misbehaving, resetting device!"
                level: ERROR
            - button.press: device_reset

prometheus:
  relabel:
    mlx90614_temperature_object:
      id: temperature_ir
      name: "Object Temperature (IR)"
    mlx90614_temperature_ambient:
      id: temperature_ir_ambient
      name: "Ambient Temperature (IR)"
