Brak opisu

Jason Rumney f35065d59d Move to a more generic tuya_local namespace. 5 lat temu
custom_components f35065d59d Move to a more generic tuya_local namespace. 5 lat temu
.gitignore 00a002c3b9 Refactor to prepare for supporting multiple device types 6 lat temu
LICENSE.md f35065d59d Move to a more generic tuya_local namespace. 5 lat temu
README.md f35065d59d Move to a more generic tuya_local namespace. 5 lat temu
custom_updater.json f35065d59d Move to a more generic tuya_local namespace. 5 lat temu
hacs.json f35065d59d Move to a more generic tuya_local namespace. 5 lat temu

README.md

Home Assistant Tuya Local component

The tuya_local component integrates Goldair WiFi-enabled heaters, WiFi-enabled dehumidifiers, WiFi-enabled fans and Kogan WiFi-enabled heaters into Home Assistant, enabling control of setting the following parameters via the UI and the following services:

Climate devices

Goldair Heaters

  • power (on/off)
  • mode (Comfort, Eco, Anti-freeze)
  • target temperature (5-35 in Comfort mode, 5-21 in Eco mode, in °C)
  • power level (via the swing mode setting because no appropriate HA option exists: Auto, 1-5, Stop)

Current temperature is also displayed.

Goldair Demudifiers

  • power (on/off)
  • mode (Normal, Low, High, Dry clothes, Air clean)
  • target humidity (30-80%)

Current temperature is displayed, and current humidity is available as a property.

Goldair Fans

  • power (on/off)
  • mode (Normal, Eco, Sleep)
  • fan mode (1-12)
  • swing (on/off)

Kogan Heaters

  • power (on/off)
  • mode (LOW/HIGH)
  • target temperature (16-30 in °C)

Current temperature is also displayed.

Additional features

Light (Goldair devices)

  • LED display (on/off)

Lock (Goldair heaters and dehumidifiers)

  • Child lock (on/off)

Binary Sensor (Goldair dehumidifiers)

  • Tank full (on/off)

There was previously a sensor option, however this is easily achieved using a template sensor and therefore is no longer supported.


Warning

Please note, this component has currently only been tested with the Goldair GPPH (inverter), GPDH420 (dehumidifier), and GCPF315 fan, however theoretically it should also work with GEPH and GPCV heater devices, may work with the GPDH440 dehumidifier and any other Goldair heaters, dehumidifiers or fans based on the Tuya platform.

Kogan heater support is tested with the Kogan SmarterHome 1500W Smart Panel Heater. If you have another type of Kogan SmarterHome heater, it may or may not work with the same configuration.


Installation

The preferred installation method is via HACS. Once you have HACS set up, simply follow the instructions for adding a custom repository and then the integration will be available to install like any other.

You can also use Custom Updater. Once Custom Updater is set up, go to the Developer Tools > Service page and call the custom_updater.install service with this service data:

{ "element": "tuya_local" }

Alternatively you can copy the contents of this repository's custom_components directory to your <config>/custom_components directory, however you will not get automatic updates this way.

Configuration

Add the following lines to your configuration.yaml file:

# Example configuration.yaml entry
tuya_local:
  - name: My heater
    host: 1.2.3.4
    device_id: <your device id>
    local_key: <your local key>
    type: heater

Configuration variables

name

    (string) (Required) Any unique for the device; required because the Tuya API doesn't provide

                                          the one you set in the app.

host

    (string) (Required) IP or hostname of the device.

device_id

    (string) (Required) Device ID retrieved

                                          [as per the instructions below](#finding-your-device-id-and-local-key).

local_key

    (string) (Required) Local key retrieved

                                          [as per the instructions below](#finding-your-device-id-and-local-key).

type

    (string) (Required) The type of Goldair device: currently heater, dehumidifier, fan or kogan_heater.

climate

    (boolean) (Optional) Whether to surface this appliance as a climate device.

    Default value: true

display_light

    (boolean) (Optional) Whether to surface this appliance's LED display control as a light (not supported for Kogan Heaters).

    Default value: false

child_lock

    (boolean) (Optional) Whether to surface this appliances's child lock as a lock device (not supported for fans or Kogan Heaters).

    Default value: false

tank_full

    (boolean) (Optional) Whether to surface this appliances's tank full sensor as a binary_sensor device (only supported for dehumidifiers).

Heater gotchas

Goldair heaters have individual target temperatures for their Comfort and Eco modes, whereas Home Assistant only supports a single target temperature. Therefore, when you're in Comfort mode you will set the Comfort temperature (5-35), and when you're in Eco mode you will set the Eco temperature (5-21), just like you were using the heater's own control panel. Bear this in mind when writing automations that change the operation mode and set a temperature at the same time: you must change the operation mode before setting the new target temperature, otherwise you will set the current thermostat rather than the new one.

When switching to Anti-freeze mode, the heater will set the current power level to 1 as if you had manually chosen it. When you switch back to other modes, you will no longer be in Auto and will have to set it again if this is what you wanted. This could be worked around in code however it would require storing state that may be cleared if HA is restarted and due to this unreliability it's probably best that you just factor it into your automations.

When child lock is enabled, the heater's display will flash with the child lock symbol ([]) whenever you change something in HA. This can be confusing because it's the same behaviour as when you try to change something via the heater's own control panel and the change is rejected due to being locked, however rest assured that the changes are taking effect.

Fan gotchas

In my experience, fans don't like to receive a lot of commands in a short period of time. They will emit two fast beeps when accepting a command, and two slow beeps when rejecting one. If you are writing automations for your fan and need to set multiple properties, you may need to put a delay of around 5 seconds or more between each.

Finding your device ID and local key

You can find these keys the same way as you would for any Tuya local integration. You'll need the Tuya Smart app rather than the Goldair app (the Goldair app is just a re-branded clone of Tuya Smart).

You're looking for uuid (this is the device ID) and the localKey values.

Next steps

The devices need to be generalized so a new subdirectory with source code is not needed to add a new device. Instead, device descriptors should be in a yaml file, which is referenced by the config.

Support for non-climate devices needs to be added. For starters, I have some Kogan Power Monitoring Plugs that I haven't yet taken out of the box and converted to ESPHome, but this will probably need input from other users.

This component needs specs! Once they're written I'm considering submitting it to the HA team for inclusion in standard installations. Please report any issues and feel free to raise pull requests.

Acknowledgements

None of this would have been possible without some foundational discovery work to get me started: