name: Gas alarm
products:
  - id: UNKNOWN
    name: Weaja WJ-TUYA-S9
primary_entity:
  entity: binary_sensor
  class: gas
  dps:
    - id: 2
      type: string
      name: sensor
      mapping:
        - dps_val: alarm
          value: true
        - value: false
secondary_entities:
  - entity: number
    name: Alarm time
    category: config
    class: timer
    dps:
      - id: 3
        type: integer
        optional: true
        name: value
        unit: s
        range:
          min: 0
          max: 60
        mapping:
          - dps_val: null
            value: 0
            hidden: true
  - entity: sensor
    name: Gas
    icon: "mdi:fire"
    dps:
      - id: 5
        type: integer
        name: sensor
        # image on website shows %LEL, but tuya docs say ppm
        unit: "%LEL"
        class: measurement
        mapping:
          - scale: 10
  - entity: binary_sensor
    name: Carbon monoxide
    class: gas
    dps:
      - id: 6
        type: string
        name: sensor
        mapping:
          - dps_val: alarm
            value: true
          - value: false
  - entity: switch
    name: Alarm
    icon: "mdi:bullhorn"
    category: config
    dps:
      - id: 12
        type: boolean
        name: switch
  - entity: button
    name: Mute
    category: config
    dps:
      - id: 14
        type: boolean
        name: button
        optional: true
  - entity: sensor
    class: carbon_monoxide
    category: diagnostic
    dps:
      - id: 20
        type: integer
        name: sensor
        unit: ppm
        class: measurement
