|
|
@@ -2,7 +2,7 @@
|
|
|
|
|
|
This directory contains device configuration files, describing the workings
|
|
|
of supported devices. The files are in YAML format, and describe the mapping
|
|
|
-of Tuya DPS (Data Point Setting) to HomeAssistant attributes.
|
|
|
+of Tuya DPs (Data Points) to HomeAssistant attributes.
|
|
|
|
|
|
Each Tuya device may correspond to one primary entity and any number of
|
|
|
secondary entities in Home Assistant.
|
|
|
@@ -108,11 +108,11 @@ Home Assistant.
|
|
|
|
|
|
### `dps`
|
|
|
|
|
|
-This is a list of the definitions for the Tuya DPS associated with
|
|
|
+This is a list of the definitions for the Tuya DPs associated with
|
|
|
attributes of this entity. There should be one list entry for each
|
|
|
-supported DPS reported by the device.
|
|
|
+supported DPs reported by the device.
|
|
|
|
|
|
-The configuration of DPS entries is detailed in its own section below.
|
|
|
+The configuration of DPs entries is detailed in its own section below.
|
|
|
|
|
|
### `name`
|
|
|
|
|
|
@@ -132,11 +132,11 @@ For number entities, this can be used to force `slider` or `box` as the
|
|
|
input method. The default `auto` uses a slider if the range is small enough,
|
|
|
or a box otherwise.
|
|
|
|
|
|
-## DPS configuration
|
|
|
+## DPs configuration
|
|
|
|
|
|
### `id`
|
|
|
|
|
|
-Every DPS must have a numeric ID matching the DPS ID in the Tuya protocol.
|
|
|
+Every DP must have a numeric ID matching the DP ID in the Tuya protocol.
|
|
|
|
|
|
### `type`
|
|
|
|
|
|
@@ -171,7 +171,7 @@ to Home Assistant, but no functionality for setting them will be exposed.
|
|
|
### `mapping`
|
|
|
|
|
|
*Optional.*
|
|
|
-This can be used to define a list of additional rules that modify the DPS
|
|
|
+This can be used to define a list of additional rules that modify the DP
|
|
|
to Home Assistant attribute mapping to something other than a one to one
|
|
|
copy.
|
|
|
|
|
|
@@ -183,7 +183,7 @@ defined in their own section below.
|
|
|
### `hidden`
|
|
|
|
|
|
*Optional.*
|
|
|
-This can be used to define DPS that do not directly expose Home Assistant
|
|
|
+This can be used to define DPs that do not directly expose Home Assistant
|
|
|
attributes. When set to **true**, no attribute will be sent. A `name` should
|
|
|
still be specified and the attribute can be referenced as a `constraint`
|
|
|
from mapping rules on other attributes to implement complex mappings.
|
|
|
@@ -192,7 +192,7 @@ An example of use is a climate device, where the Tuya device keeps separate
|
|
|
temperature settings for different Normal and Eco preset modes. The Normal
|
|
|
temperature setting is exposed through the standard `temperature`
|
|
|
Home Assistant attribute on the climate device, but the `eco_temperature`
|
|
|
-setting on a different DPS is set to hidden. Mapping Rules are used on the
|
|
|
+setting on a different DP is set to hidden. Mapping Rules are used on the
|
|
|
`temperature` attribute to redirect to `eco_temperature` when `preset_mode`
|
|
|
is set to Eco.
|
|
|
|
|
|
@@ -234,9 +234,9 @@ the device type.
|
|
|
## Mapping Rules
|
|
|
|
|
|
Mapping rules can change the behavior of attributes beyond simple
|
|
|
-copying of DPS values to attribute values. Rules can be defined
|
|
|
+copying of DP values to attribute values. Rules can be defined
|
|
|
without a dps_val to apply to all values, or a list of rules that
|
|
|
-apply to particular dps values can be defined to change only
|
|
|
+apply to particular dp values can be defined to change only
|
|
|
particular cases. Rules can even depend on the values of other
|
|
|
elements.
|
|
|
|
|
|
@@ -245,7 +245,7 @@ elements.
|
|
|
*Optional, if not provided, the rule is a default that will apply to all
|
|
|
values not covered by their own dps_val rule.*
|
|
|
|
|
|
-`dps_val` defines the DPS value that each
|
|
|
+`dps_val` defines the DP value that each
|
|
|
rule in the list applies to. This can be used to map specific values from the
|
|
|
Tuya protocol into attribute values that have specific meaning in Home
|
|
|
Assistant. For example, climate entities in Home Assistant define modes
|
|
|
@@ -260,7 +260,7 @@ instead of "mdi:radiator" when in that mode.
|
|
|
*Optional.*
|
|
|
|
|
|
This can be used to set the attribute value seen by Home Assistant to something
|
|
|
-different than the DPS value from the Tuya protocol. Normally it will be used
|
|
|
+different than the DP value from the Tuya protocol. Normally it will be used
|
|
|
with `dps_val` to map from one value to another. It could also be used at top
|
|
|
level to override all values, but I can't imagine a useful purpose for that.
|
|
|
|
|
|
@@ -268,27 +268,27 @@ level to override all values, but I can't imagine a useful purpose for that.
|
|
|
|
|
|
*Optional, default=1*
|
|
|
|
|
|
-This can be used in an `integer` dps mapping to scale the values. For example
|
|
|
+This can be used in an `integer` dp mapping to scale the values. For example
|
|
|
some climate devices represent the temperature as an integer in tenths of
|
|
|
degrees, and require a scale of 10 to convert them to degrees expected by
|
|
|
Home Assistant. The scale can also be the other way, for a fan with speeds
|
|
|
-1, 2 and 3 as DPS values, this can be converted to a percentage with a scale
|
|
|
+1, 2 and 3 as DP values, this can be converted to a percentage with a scale
|
|
|
of 0.03.
|
|
|
|
|
|
###`invert`
|
|
|
|
|
|
*Optional, default=False*
|
|
|
|
|
|
-This can be used in an `integer` dps mapping to invert the range. For example,
|
|
|
+This can be used in an `integer` dp mapping to invert the range. For example,
|
|
|
some cover devices have an opposite idea of which end of the percentage scale open
|
|
|
and closed are from what Home Assistant assumes. To use this mapping option, a range
|
|
|
-must also be specified for the dps.
|
|
|
+must also be specified for the dp.
|
|
|
|
|
|
### `step`
|
|
|
|
|
|
*Optional, default=1*
|
|
|
|
|
|
-This can be used in an `integer` dps mapping to make values jump by a specific
|
|
|
+This can be used in an `integer` dp mapping to make values jump by a specific
|
|
|
step. It can also be set in a conditions block so that the steps change only
|
|
|
under certain conditions. An example is where a value has a range of 0-100, but
|
|
|
only allows settings that are divisible by 10, so a step of 10 would be set.
|
|
|
@@ -308,8 +308,8 @@ indicates a change from normal operating mode, such as "fan-only",
|
|
|
When a number of rules on different attributes define `icon` changes, you
|
|
|
may need to control which have priority over the others. For example,
|
|
|
if the device is off, probably it is more important to indicate that than
|
|
|
-whether it is in fan-only or heat mode. So in the off/on DPS, you might
|
|
|
-give a priority of 1 to the off icon, 3 to the on icon, and in the mode DPS
|
|
|
+whether it is in fan-only or heat mode. So in the off/on DP, you might
|
|
|
+give a priority of 1 to the off icon, 3 to the on icon, and in the mode DP
|
|
|
you could give a priority of 2 to the fan icon, to make it override the
|
|
|
normal on icon, but not the off icon.
|
|
|
If you don't specify any priorities, the icons will all get the same priority,
|
|
|
@@ -323,8 +323,8 @@ icon will be displayed.
|
|
|
When `value_redirect` is set, the value of the attribute and any attempt to
|
|
|
set it will be redirected to the named attribute instead of the current one.
|
|
|
|
|
|
-An example of how this can be useful is where a Tuya heater has a dps for the
|
|
|
-target temperature in normal mode, and a different dps for the target
|
|
|
+An example of how this can be useful is where a Tuya heater has a dp for the
|
|
|
+target temperature in normal mode, and a different dp for the target
|
|
|
temperature is "eco" mode. Depending on the `preset_mode`, you need to use
|
|
|
one or the other. But Home Assistant just has one `temperature` attribute for
|
|
|
setting target temperature, so the mapping needs to be done before passing to
|
|
|
@@ -336,13 +336,13 @@ Home Assistant.
|
|
|
|
|
|
When `value_mirror` is set, the value of the attribute will be redirected to
|
|
|
the current value of the named attribute. Unlike `value_redirect`, this does
|
|
|
-not redirect attempts to set the dps to the redirected dps, but when used in
|
|
|
+not redirect attempts to set the dp to the redirected dp, but when used in
|
|
|
a map, this can make the mapping dynamic.
|
|
|
|
|
|
An example of how this can be useful is where a thermostat can be configured
|
|
|
to control either a heating or cooling device, but it is not expected to
|
|
|
-change this setting during operation. Once set up, the hvac_mode dps can
|
|
|
-have a mapping that mirrors the value of the configuration dps.
|
|
|
+change this setting during operation. Once set up, the hvac_mode dp can
|
|
|
+have a mapping that mirrors the value of the configuration dp.
|
|
|
|
|
|
### `invalid`
|
|
|
|
|
|
@@ -354,7 +354,7 @@ to the Tuya protocol, attempts to set it will throw an error while it meets
|
|
|
the conditions to be `invalid`. It does not make sense to set this at mapping
|
|
|
level, as it would cause a situation where you can set a value then not be
|
|
|
able to unset it. Instead, this should be used with conditions, below, to
|
|
|
-make the behaviour dependent on another DPS, such as disabling fan speed
|
|
|
+make the behaviour dependent on another DP, such as disabling fan speed
|
|
|
control when the preset is in sleep mode (since sleep mode should force low).
|
|
|
|
|
|
|
|
|
@@ -380,122 +380,123 @@ manage.
|
|
|
|
|
|
## Entity types
|
|
|
|
|
|
-Entities have specific mappings of dps names to functions. Any unrecognized dps name is added
|
|
|
+Entities have specific mappings of dp names to functions. Any unrecognized dp name is added
|
|
|
to the entity as a read-only extra attribute, so can be observed and queried from HA, but if you need
|
|
|
to be able to change it, you should split it into its own entity of an appropriate type (number, select, switch for example).
|
|
|
|
|
|
-If the type of dps does not match the expected type, a mapping should be provided to convert.
|
|
|
+If the type of dp does not match the expected type, a mapping should be provided to convert.
|
|
|
Note that "on" and "off" require quotes in yaml, otherwise it they are interpretted as true/false.
|
|
|
|
|
|
Many entity types support a class attribute which may change the UI behaviour, icons etc. See the
|
|
|
HA documentation for the entity type to see what is valid (these may expand over time)
|
|
|
|
|
|
### binary_sensor
|
|
|
-- **sensor** (required, boolean) the dps to attach to the sensor.
|
|
|
+- **sensor** (required, boolean) the dp to attach to the sensor.
|
|
|
|
|
|
### climate
|
|
|
-- **aux_heat** (optional, boolean) a dps to control the aux heat switch if the device has one.
|
|
|
-- **current_temperature** (optional, number) a dps that reports the current temperature.
|
|
|
-- **current_humidity** (optional, number) a dps that reports the current humidity (%).
|
|
|
-- **fan_mode** (optional, mapping of strings) a dps to control the fan mode if available.
|
|
|
+- **aux_heat** (optional, boolean) a dp to control the aux heat switch if the device has one.
|
|
|
+- **current_temperature** (optional, number) a dp that reports the current temperature.
|
|
|
+- **current_humidity** (optional, number) a dp that reports the current humidity (%).
|
|
|
+- **fan_mode** (optional, mapping of strings) a dp to control the fan mode if available.
|
|
|
Any value is allowed, but HA has some standard modes:
|
|
|
`"on", "off", auto, low, medium, high, top, middle, focus, diffuse`
|
|
|
-- **humidity** (optional, number) a dps to control the target humidity if available. (%)
|
|
|
-- **hvac_mode** (optional, mapping of strings) a dps to control the mode of the device.
|
|
|
+- **humidity** (optional, number) a dp to control the target humidity if available. (%)
|
|
|
+- **hvac_mode** (optional, mapping of strings) a dp to control the mode of the device.
|
|
|
Possible values are: `"off", cool, heat, heat_cool, auto, dry, fan_only`
|
|
|
-- **hvac_action** (optional, string) a dps thar reports the current action of the device.
|
|
|
+- **hvac_action** (optional, string) a dp thar reports the current action of the device.
|
|
|
Possible values are: `"off", idle, cooling, heating, drying, fan`
|
|
|
-- **preset_mode** (optional, mapping of strings) a dps to control preset modes of the device.
|
|
|
+- **preset_mode** (optional, mapping of strings) a dp to control preset modes of the device.
|
|
|
Any value is allowed, but HA has some standard presets:
|
|
|
`none, eco, away, boost, comfort, home, sleep, activity`
|
|
|
-- **swing_mode** (optional, mapping of strings) a dps to control swing modes of the device.
|
|
|
+- **swing_mode** (optional, mapping of strings) a dp to control swing modes of the device.
|
|
|
Possible values are: `"off", vertical, horizontal`
|
|
|
-- **temperature** (optional, number) a dps to set the target temperature of the device.
|
|
|
- A unit may be specified as part of the attribute if a temperature_unit dps is not available, if not
|
|
|
+- **temperature** (optional, number) a dp to set the target temperature of the device.
|
|
|
+ A unit may be specified as part of the attribute if a temperature_unit dp is not available, if not
|
|
|
the default unit configured in HA will be used.
|
|
|
-- **target_temp_high** (optional, number) a dps to set the upper temperature range of the device.
|
|
|
- This dps should be paired with `target_temp_low`, and is mutually exclusive with `temperature`
|
|
|
-- **target_temp_low** (optional, number) a dps to set the lower temperature range of the device.
|
|
|
-- **temperature_unit** (optional, string) a dps that specifies the unit the device is configured for.
|
|
|
+- **target_temp_high** (optional, number) a dp to set the upper temperature range of the device.
|
|
|
+ This dp should be paired with `target_temp_low`, and is mutually exclusive with `temperature`
|
|
|
+- **target_temp_low** (optional, number) a dp to set the lower temperature range of the device.
|
|
|
+- **temperature_unit** (optional, string) a dp that specifies the unit the device is configured for.
|
|
|
Values should be mapped to "C" or "F" (case sensitive) - often the device will use a boolean or
|
|
|
lower case for this
|
|
|
-- **min_temperature** (optional, number) a dps that specifies the minimum temperature that can be set. Some devices provide this, otherwise a fixed range on the temperature dps can be used.
|
|
|
-- **max_temperature** (optional, number) a dps that specifies the maximum temperature that can be set.
|
|
|
+- **min_temperature** (optional, number) a dp that specifies the minimum temperature that can be set. Some devices provide this, otherwise a fixed range on the temperature dp can be used.
|
|
|
+- **max_temperature** (optional, number) a dp that specifies the maximum temperature that can be set.
|
|
|
|
|
|
### cover
|
|
|
|
|
|
Either **position** or **open** should be specified.
|
|
|
|
|
|
-- **position** (optional, number 0-100): a dps to control the percentage that the cover is open.
|
|
|
+- **position** (optional, number 0-100): a dp to control the percentage that the cover is open.
|
|
|
0 means completely close, 100 means completely open.
|
|
|
-- **control** (optional, mapping of strings): a dps to control the cover. Mainly useful if **position** cannot be used.
|
|
|
+- **control** (optional, mapping of strings): a dp to control the cover. Mainly useful if **position** cannot be used.
|
|
|
Valid values are `open, close, stop`
|
|
|
-- **action** (optional, string): a dps that reports the current state of the cover.
|
|
|
+- **action** (optional, string): a dp that reports the current state of the cover.
|
|
|
Special values are `opening, closing`
|
|
|
-- **open** (optional, boolean): a dps that reports if the cover is open. Only used if **position** is not available.
|
|
|
+- **open** (optional, boolean): a dp that reports if the cover is open. Only used if **position** is not available.
|
|
|
|
|
|
### fan
|
|
|
-- **switch** (optional, boolean): a dps to control the power state of the fan
|
|
|
-- **preset_mode** (optional, mapping of strings): a dps to control different modes of the fan.
|
|
|
+- **switch** (optional, boolean): a dp to control the power state of the fan
|
|
|
+- **preset_mode** (optional, mapping of strings): a dp to control different modes of the fan.
|
|
|
Values `"off", low, medium, high` are handled specially by HA as deprecated speed aliases which will be removed in mid 2022. Consider mapping these as **speed** values instead, as voice assistants will respond to phrases like "turn the fan up/down" for speed.
|
|
|
-- **speed** (optional, number 0-100): a dps to control the speed of the fan (%).
|
|
|
+- **speed** (optional, number 0-100): a dp to control the speed of the fan (%).
|
|
|
scale and step can be used to convert smaller ranges to percentages, or a mapping for discrete values.
|
|
|
-- **oscillate** (optional, boolean): a dps to control whether the fan will oscillate or not.
|
|
|
-- **direction** (optional, string): a dps to control the spin direction of the fan.
|
|
|
+- **oscillate** (optional, boolean): a dp to control whether the fan will oscillate or not.
|
|
|
+- **direction** (optional, string): a dp to control the spin direction of the fan.
|
|
|
Valid values are `forward, reverse`.
|
|
|
|
|
|
### humidifier
|
|
|
Humidifer can also cover dehumidifiers (use class to specify which).
|
|
|
|
|
|
-- **switch** (optional, boolean): a dps to control the power state of the fan
|
|
|
-- **mode** (optional, mapping of strings): a dps to control preset modes of the device
|
|
|
-- **humidity** (optional, number): a dps to control the target humidity of the device
|
|
|
+- **switch** (optional, boolean): a dp to control the power state of the fan
|
|
|
+- **mode** (optional, mapping of strings): a dp to control preset modes of the device
|
|
|
+- **humidity** (optional, number): a dp to control the target humidity of the device
|
|
|
|
|
|
### light
|
|
|
-- **switch** (optional, boolean): a dps to control the on/off state of the light
|
|
|
-- **brightness** (optional, number 0-255): a dps to control the dimmer if available.
|
|
|
-- **color_temp** (optional, number): a dps to control the color temperature if available.
|
|
|
+- **switch** (optional, boolean): a dp to control the on/off state of the light
|
|
|
+- **brightness** (optional, number 0-255): a dp to control the dimmer if available.
|
|
|
+- **color_temp** (optional, number): a dp to control the color temperature if available.
|
|
|
will be mapped so the minimum corresponds to 153 mireds (6500K), and max to 500 (2000K).
|
|
|
-- **rgbhsv** (optional, hex): a dps to control the color of the light, using encoded RGB and HSV values. The `format` field names recognized for decoding this field are `r`, `g`, `b`, `h`, `s`, `v`.
|
|
|
-- **color_mode** (optional, mapping of strings): a dps to control which mode to use if the light supports multiple modes.
|
|
|
+- **rgbhsv** (optional, hex): a dp to control the color of the light, using encoded RGB and HSV values. The `format` field names recognized for decoding this field are `r`, `g`, `b`, `h`, `s`, `v`.
|
|
|
+- **color_mode** (optional, mapping of strings): a dp to control which mode to use if the light supports multiple modes.
|
|
|
Special values: `white, color_temp, rgbw, hs, xy, rgb, rgbww`, others will be treated as effects,
|
|
|
Note: only white, color_temp and rgbw are currently supported, others listed above are reserved and may be implemented in future when the need arises.
|
|
|
-- **effect** (optional, mapping of strings): a dps to control effects / presets supported by the light.
|
|
|
- If the light mixes in color modes in the same dps, **color_mode** should be used instead.
|
|
|
+- **effect** (optional, mapping of strings): a dp to control effects / presets supported by the light.
|
|
|
+ If the light mixes in color modes in the same dp, **color_mode** should be used instead.
|
|
|
|
|
|
### lock
|
|
|
-- **lock** (required, boolean): a dps to control the lock state: true = locked, false = unlocked
|
|
|
+- **lock** (required, boolean): a dp to control the lock state: true = locked, false = unlocked
|
|
|
|
|
|
### number
|
|
|
-- **value** (required, number): a dps to control the number that is set.
|
|
|
-- **unit** (optional, string): a dps that reports the units returned by the number.
|
|
|
- This may be useful for devices that switch between C and F, otherwise a fixed unit attribute on the **value** dps can be used.
|
|
|
-- **minimum** (optional, number): a dps that reports the minimum the number can be set to.
|
|
|
- This may be used as an alternative to a range setting on the **value** dps if the range is dynamic
|
|
|
-- **maximum** (optional, number): a dps that reports the maximum the number can be set to.
|
|
|
- This may be used as an alternative to a range setting on the **value** dps if the range is dynamic
|
|
|
+- **value** (required, number): a dp to control the number that is set.
|
|
|
+- **unit** (optional, string): a dp that reports the units returned by the number.
|
|
|
+ This may be useful for devices that switch between C and F, otherwise a fixed unit attribute on the **value** dp can be used.
|
|
|
+- **minimum** (optional, number): a dp that reports the minimum the number can be set to.
|
|
|
+ This may be used as an alternative to a range setting on the **value** dp if the range is dynamic
|
|
|
+- **maximum** (optional, number): a dp that reports the maximum the number can be set to.
|
|
|
+ This may be used as an alternative to a range setting on the **value** dp if the range is dynamic
|
|
|
|
|
|
### select
|
|
|
-- **option** (required, mapping of strings): a dps to control the option that is selected.
|
|
|
+- **option** (required, mapping of strings): a dp to control the option that is selected.
|
|
|
|
|
|
### sensor
|
|
|
-- **sensor** (required, number or string): a dps that returns the current value of the sensor.
|
|
|
-- **unit** (optional, string): a dps that returns the unit returned by the sensor.
|
|
|
- This may be useful for devices that switch between C and F, otherwise a fixed unit attribute on the **sensor** dps can be used.
|
|
|
+- **sensor** (required, number or string): a dp that returns the current value of the sensor.
|
|
|
+- **unit** (optional, string): a dp that returns the unit returned by the sensor.
|
|
|
+ This may be useful for devices that switch between C and F, otherwise a fixed unit attribute on the **sensor** dp can be used.
|
|
|
|
|
|
### switch
|
|
|
-- **switch** (required, boolean): a dps to control the switch state.
|
|
|
-- **current_power_w** (optional, number): a dps that returns the current power consumption in watts.
|
|
|
- This is a legacy attribute, for the HA Energy dashboard it is advisable to also provide a sensor entity linked to the same dps as well.
|
|
|
+- **switch** (required, boolean): a dp to control the switch state.
|
|
|
+- **current_power_w** (optional, number): a dp that returns the current power consumption in watts.
|
|
|
+ This is a legacy attribute, for the HA Energy dashboard it is advisable to also provide a sensor entity linked to the same dp as well.
|
|
|
|
|
|
### vacuum
|
|
|
--**status** (required, mapping of strings): a dps to report and control the status of the vacuum.
|
|
|
+- **status** (required, mapping of strings): a dp to report and control the status of the vacuum.
|
|
|
+- **command** (optional, mapping of strings): a dp to control the statuss of the vacuum. If supplied, the status dp is only used to report the state.
|
|
|
Special values: `return_to_base, clean_spot`, others are sent as general commands
|
|
|
-- **locate** (optional, boolean): a dps to trigger a locator beep on the vacuum.
|
|
|
-- **power** (optional, boolean): a dps to switch full system power on and off
|
|
|
-- **activate** (optional, boolean): a dps to start and pause the vacuum
|
|
|
-- **battery** (optional, number 0-100): a dps that reports the current battery level (%)
|
|
|
-- **direction_control** (optional, mapping of strings): a dps that is used for directional commands
|
|
|
+- **locate** (optional, boolean): a dp to trigger a locator beep on the vacuum.
|
|
|
+- **power** (optional, boolean): a dp to switch full system power on and off
|
|
|
+- **activate** (optional, boolean): a dp to start and pause the vacuum
|
|
|
+- **battery** (optional, number 0-100): a dp that reports the current battery level (%)
|
|
|
+- **direction_control** (optional, mapping of strings): a dp that is used for directional commands
|
|
|
These are additional commands that are not part of **status**. They can be sent as general commands from HA.
|
|
|
-- **error** (optional, bitfield): a dps that reports error status.
|
|
|
+- **error** (optional, bitfield): a dp that reports error status.
|
|
|
As this is mapped to a single "fault" state, you could consider separate binary_sensors to report on individual errors
|