name: Moisture sensor
products:
  - id: gvygg3m8
    name: SGS01
primary_entity:
  entity: sensor
  name: Soil Moisture
  class: moisture
  dps:
    - id: 3
      name: sensor
      type: integer
      unit: "%"
secondary_entities:
  - 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
        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
