name: Moisture sensor
products:
  - id: gvygg3m8
    model: SGS01
  - id: nt4pquef
    model: SGS02Z
entities:
  - entity: sensor
    name: Soil moisture
    class: moisture
    dps:
      - id: 3
        name: sensor
        type: integer
        unit: "%"
  - entity: sensor
    name: Soil temperature
    class: temperature
    dps:
      - id: 5
        name: sensor
        type: integer
        class: measurement
        mapping:
          - scale: 10
      - id: 9
        name: unit
        type: string
        mapping:
          - dps_val: f
            value: F
          - value: C
  - entity: sensor
    class: battery
    category: diagnostic
    dps:
      - id: 14
        type: string
        optional: true
        name: state
      - id: 15
        type: integer
        name: sensor
        unit: "%"
  - entity: select
    translation_key: temperature_unit
    category: config
    dps:
      - id: 9
        type: string
        name: option
        mapping:
          - dps_val: c
            value: celsius
          - dps_val: f
            value: fahrenheit
  - entity: button
    name: Refresh
    class: restart
    category: config
    dps:
      - id: 9
        type: string
        name: button
        mapping:
          - dps_val: c
            constraint: current
            conditions:
              - dps_val: c
                value: true
              - dps_val: f
                value: false
          - dps_val: f
            constraint: current
            conditions:
              - dps_val: c
                value: false
              - dps_val: f
                value: true
      - id: 9
        type: string
        name: current
  - entity: sensor
    name: Light intensity
    class: enum
    hidden: unavailable  # only SGS02Z supports this
    dps:
      - id: 2
        type: string
        optional: true
        name: sensor
        mapping:
          - dps_val: lower
            value: dark
          - dps_val: low
            value: low
          - dps_val: normal
            value: normal
          - dps_val: high
            value: high
          - dps_val: higher
            value: bright
      - id: 2
        type: string
        optional: true
        name: available
        mapping:
          - dps_val: null
            value: false
          - value: true
