name: Water heater
products:
  - id: ox9jyuavu5v78o2y
    name: Geyserwise TSE geyser timer and controller
primary_entity:
  entity: water_heater
  dps:
    - id: 1
      type: boolean
      name: operation_mode
      mapping:
        - dps_val: false
          value: "off"
        - dps_val: true
          value: electric
    - id: 2
      type: string
      name: away_mode
      mapping:
        - dps_val: Timer
          value: false
        - dps_val: Holiday
          value: true
    - id: 10
      type: integer
      name: current_temperature
    - id: 20
      type: bitfield
      name: fault_code
      mapping:
        - dps_val: 1
          value: Earth leak
        - dps_val: 2
          value: Dry burn
        - dps_val: 4
          value: Wt sensor fault
        - dps_val: 8
          value: Heating loss
        - dps_val: 16
          value: Over temperature
        - dps_val: 32
          value: Water leak
        - dps_val: 64
          value: Comm failure
        - dps_val: 128
          value: Ct probe fault
        - dps_val: 256
          value: Pump failure
    - id: 103
      type: integer
      name: temperature
      unit: C
      range:
        min: 30
        max: 75
secondary_entities:
  - entity: binary_sensor
    name: Element
    class: running
    category: diagnostic
    dps:
      - id: 13
        type: string
        name: sensor
        mapping:
          - dps_val: "Off"
            value: false
          - dps_val: "On"
            value: true
  - entity: binary_sensor
    class: problem
    category: diagnostic
    dps:
      - id: 20
        type: bitfield
        name: sensor
        mapping:
          - dps_val: 0
            value: false
          - value: true
  - entity: binary_sensor
    name: Solar
    class: running
    category: diagnostic
    dps:
      - id: 101
        type: string
        name: sensor
        mapping:
          - dps_val: "Off"
            value: false
          - dps_val: "On"
            value: true
  - entity: number
    name: Solar temperature
    category: config
    icon: "mdi:solar-power-variant"
    dps:
      - id: 102
        type: integer
        name: value
        unit: C
        range:
          min: 7
          max: 15
        mapping:
          # PV models use a target temp rather than a differential
          - constraint: collector
            conditions:
              - dps_val: null
                range:
                  min: 50
                  max: 75
      - id: 108
        type: integer
        name: collector
        optional: true
  - entity: number
    name: Overnight temperature
    category: config
    class: temperature
    dps:
      - id: 103
        type: integer
        name: value
        unit: C
        range:
          min: 30
          max: 75
  - entity: number
    name: Morning temperature
    category: config
    class: temperature
    dps:
      - id: 104
        type: integer
        name: value
        unit: C
        range:
          min: 30
          max: 75
  - entity: number
    name: Afternoon temperature
    category: config
    class: temperature
    dps:
      - id: 105
        type: integer
        name: value
        unit: C
        range:
          min: 30
          max: 75
  - entity: number
    name: Evening temperature
    category: config
    class: temperature
    dps:
      - id: 106
        type: integer
        name: value
        unit: C
        range:
          min: 30
          max: 75
  - entity: number
    name: Anti-freeze temperature
    category: config
    class: temperature
    icon: "mdi:snowflake-thermometer"
    dps:
      - id: 107
        type: integer
        name: value
        unit: C
        optional: true
        range:
          min: 0
          max: 10
  - entity: sensor
    name: Collector temperature
    class: temperature
    category: diagnostic
    dps:
      - id: 108
        type: integer
        name: sensor
        optional: true
        unit: C
        class: measurement
