Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tuya water valve (TS0049 by _TZ3210_0jxeoadc) #2377

Closed
pcxsam opened this issue May 4, 2023 · 98 comments · Fixed by #3737
Closed

Tuya water valve (TS0049 by _TZ3210_0jxeoadc) #2377

pcxsam opened this issue May 4, 2023 · 98 comments · Fixed by #3737
Labels
Tuya Request/PR regarding a Tuya device

Comments

@pcxsam
Copy link

pcxsam commented May 4, 2023

Problem description

Please can a handler be created to support a Tuya water valve controller (TS0049). The device can be added to home assistant via zha but no entities are available to control the valve.

Solution description

Creation of a new handler to support the device

Screenshots/Video

Screenshots/Video

Screenshot 2023-05-04 115003

Device signature

Device signature
{
  "node_descriptor": "NodeDescriptor(logical_type=<LogicalType.EndDevice: 2>, complex_descriptor_available=0, user_descriptor_available=0, reserved=0, aps_flags=0, frequency_band=<FrequencyBand.Freq2400MHz: 8>, mac_capability_flags=<MACCapabilityFlags.AllocateAddress: 128>, manufacturer_code=4417, maximum_buffer_size=66, maximum_incoming_transfer_size=66, server_mask=10752, maximum_outgoing_transfer_size=66, descriptor_capability_field=<DescriptorCapability.NONE: 0>, *allocate_address=True, *is_alternate_pan_coordinator=False, *is_coordinator=False, *is_end_device=True, *is_full_function_device=False, *is_mains_powered=False, *is_receiver_on_when_idle=False, *is_router=False, *is_security_capable=False)",
  "endpoints": {
    "1": {
      "profile_id": 260,
      "device_type": "0x0000",
      "in_clusters": [
        "0x0000",
        "0xef00"
      ],
      "out_clusters": [
        "0x000a",
        "0x0019"
      ]
    }
  },
  "manufacturer": "_TZ3210_0jxeoadc",
  "model": "TS0049",
  "class": "zigpy.device.Device"
}

Diagnostic information

Diagnostic information
{
  "home_assistant": {
    "installation_type": "Home Assistant OS",
    "version": "2023.4.6",
    "dev": false,
    "hassio": true,
    "virtualenv": false,
    "python_version": "3.10.10",
    "docker": true,
    "arch": "aarch64",
    "timezone": "Europe/London",
    "os_name": "Linux",
    "os_version": "6.1.25",
    "supervisor": "2023.04.1",
    "host_os": "Home Assistant OS 10.1",
    "docker_version": "23.0.3",
    "chassis": "embedded",
    "run_as_root": true
  },
  "custom_components": {
    "fullykiosk": {
      "version": "1.1.0",
      "requirements": [
        "python-fullykiosk==0.0.11"
      ]
    },
    "watchman": {
      "version": "0.5.1",
      "requirements": [
        "prettytable==3.0.0"
      ]
    },
    "hacs": {
      "version": "1.32.1",
      "requirements": [
        "aiogithubapi>=22.10.1"
      ]
    },
    "alexa_media": {
      "version": "4.6.2",
      "requirements": [
        "alexapy==1.26.5",
        "packaging>=20.3",
        "wrapt>=1.12.1"
      ]
    },
    "platerecognizer": {
      "version": "1.0.0",
      "requirements": [
        "pillow",
        "requests"
      ]
    },
    "webrtc": {
      "version": "v3.1.0",
      "requirements": []
    },
    "govee": {
      "version": "0.2.2",
      "requirements": [
        "govee-api-laggat==0.2.2",
        "dacite==1.6.0"
      ]
    },
    "myenergi": {
      "version": "0.0.23",
      "requirements": [
        "pymyenergi==0.0.27"
      ]
    },
    "frigate": {
      "version": "4.0.0",
      "requirements": [
        "pytz==2022.7"
      ]
    },
    "tplink_deco": {
      "version": "3.3.1",
      "requirements": [
        "pycryptodome>=3.12.0"
      ]
    },
    "solaredge_modbus_multi": {
      "version": "2.2.14",
      "requirements": [
        "pymodbus>=3.1.1"
      ]
    },
    "feedparser": {
      "version": "0.1.7",
      "requirements": [
        "feedparser==6.0.8"
      ]
    },
    "samsungtv_smart": {
      "version": "0.11.6",
      "requirements": [
        "websocket-client!=1.4.0,>=0.58.0",
        "wakeonlan>=2.0.0",
        "aiofiles>=0.8.0",
        "casttube>=0.2.1"
      ]
    }
  },
  "integration_manifest": {
    "domain": "zha",
    "name": "Zigbee Home Automation",
    "after_dependencies": [
      "onboarding",
      "usb"
    ],
    "codeowners": [
      "@dmulcahey",
      "@adminiuga",
      "@puddly"
    ],
    "config_flow": true,
    "dependencies": [
      "file_upload"
    ],
    "documentation": "https://www.home-assistant.io/integrations/zha",
    "iot_class": "local_polling",
    "loggers": [
      "aiosqlite",
      "bellows",
      "crccheck",
      "pure_pcapy3",
      "zhaquirks",
      "zigpy",
      "zigpy_deconz",
      "zigpy_xbee",
      "zigpy_zigate",
      "zigpy_znp"
    ],
    "requirements": [
      "bellows==0.35.1",
      "pyserial==3.5",
      "pyserial-asyncio==0.6",
      "zha-quirks==0.0.97",
      "zigpy-deconz==0.20.0",
      "zigpy==0.54.1",
      "zigpy-xbee==0.17.0",
      "zigpy-zigate==0.10.3",
      "zigpy-znp==0.10.0"
    ],
    "usb": [
      {
        "vid": "10C4",
        "pid": "EA60",
        "description": "*2652*",
        "known_devices": [
          "slae.sh cc2652rb stick"
        ]
      },
      {
        "vid": "1A86",
        "pid": "55D4",
        "description": "*sonoff*plus*",
        "known_devices": [
          "sonoff zigbee dongle plus v2"
        ]
      },
      {
        "vid": "10C4",
        "pid": "EA60",
        "description": "*sonoff*plus*",
        "known_devices": [
          "sonoff zigbee dongle plus"
        ]
      },
      {
        "vid": "10C4",
        "pid": "EA60",
        "description": "*tubeszb*",
        "known_devices": [
          "TubesZB Coordinator"
        ]
      },
      {
        "vid": "1A86",
        "pid": "7523",
        "description": "*tubeszb*",
        "known_devices": [
          "TubesZB Coordinator"
        ]
      },
      {
        "vid": "1A86",
        "pid": "7523",
        "description": "*zigstar*",
        "known_devices": [
          "ZigStar Coordinators"
        ]
      },
      {
        "vid": "1CF1",
        "pid": "0030",
        "description": "*conbee*",
        "known_devices": [
          "Conbee II"
        ]
      },
      {
        "vid": "10C4",
        "pid": "8A2A",
        "description": "*zigbee*",
        "known_devices": [
          "Nortek HUSBZB-1"
        ]
      },
      {
        "vid": "0403",
        "pid": "6015",
        "description": "*zigate*",
        "known_devices": [
          "ZiGate+"
        ]
      },
      {
        "vid": "10C4",
        "pid": "EA60",
        "description": "*zigate*",
        "known_devices": [
          "ZiGate"
        ]
      },
      {
        "vid": "10C4",
        "pid": "8B34",
        "description": "*bv 2010/10*",
        "known_devices": [
          "Bitron Video AV2010/10"
        ]
      }
    ],
    "zeroconf": [
      {
        "type": "_esphomelib._tcp.local.",
        "name": "tube*"
      },
      {
        "type": "_zigate-zigbee-gateway._tcp.local.",
        "name": "*zigate*"
      },
      {
        "type": "_zigstar_gw._tcp.local.",
        "name": "*zigstar*"
      },
      {
        "type": "_slzb-06._tcp.local.",
        "name": "slzb-06*"
      }
    ],
    "is_built_in": true
  },
  "data": {
    "ieee": "**REDACTED**",
    "nwk": 59523,
    "manufacturer": "_TZ3210_0jxeoadc",
    "model": "TS0049",
    "name": "_TZ3210_0jxeoadc TS0049",
    "quirk_applied": false,
    "quirk_class": "zigpy.device.Device",
    "manufacturer_code": 4417,
    "power_source": "Battery or Unknown",
    "lqi": 138,
    "rssi": null,
    "last_seen": "2023-05-04T11:53:44",
    "available": true,
    "device_type": "EndDevice",
    "signature": {
      "node_descriptor": "NodeDescriptor(logical_type=<LogicalType.EndDevice: 2>, complex_descriptor_available=0, user_descriptor_available=0, reserved=0, aps_flags=0, frequency_band=<FrequencyBand.Freq2400MHz: 8>, mac_capability_flags=<MACCapabilityFlags.AllocateAddress: 128>, manufacturer_code=4417, maximum_buffer_size=66, maximum_incoming_transfer_size=66, server_mask=10752, maximum_outgoing_transfer_size=66, descriptor_capability_field=<DescriptorCapability.NONE: 0>, *allocate_address=True, *is_alternate_pan_coordinator=False, *is_coordinator=False, *is_end_device=True, *is_full_function_device=False, *is_mains_powered=False, *is_receiver_on_when_idle=False, *is_router=False, *is_security_capable=False)",
      "endpoints": {
        "1": {
          "profile_id": 260,
          "device_type": "0x0000",
          "in_clusters": [
            "0x0000",
            "0xef00"
          ],
          "out_clusters": [
            "0x000a",
            "0x0019"
          ]
        }
      }
    },
    "active_coordinator": false,
    "entities": [],
    "neighbors": [],
    "routes": [],
    "endpoint_names": [
      {
        "name": "ON_OFF_SWITCH"
      }
    ],
    "user_given_name": null,
    "device_reg_id": "298a89d2209617fae104b31fe9fcf0f8",
    "area_id": "outside",
    "cluster_details": {
      "1": {
        "device_type": {
          "name": "ON_OFF_SWITCH",
          "id": 0
        },
        "profile_id": 260,
        "in_clusters": {
          "0xef00": {
            "endpoint_attribute": null,
            "attributes": {},
            "unsupported_attributes": {}
          },
          "0x0000": {
            "endpoint_attribute": "basic",
            "attributes": {
              "0x0004": {
                "attribute_name": "manufacturer",
                "value": "_TZ3210_0jxeoadc"
              },
              "0x0005": {
                "attribute_name": "model",
                "value": "TS0049"
              }
            },
            "unsupported_attributes": {}
          }
        },
        "out_clusters": {
          "0x0019": {
            "endpoint_attribute": "ota",
            "attributes": {},
            "unsupported_attributes": {}
          },
          "0x000a": {
            "endpoint_attribute": "time",
            "attributes": {},
            "unsupported_attributes": {}
          }
        }
      }
    }
  }
}
@idem2lyon
Copy link

It would be great, I have same device !!

@TheJulianJES TheJulianJES added the Tuya Request/PR regarding a Tuya device label May 17, 2023
@fouram
Copy link

fouram commented May 19, 2023

I just bought one of these as well, hoping to get it working. Seems like not yet! Would love to have support, as a renter its nearly impossible to get a hose valve I can simply switch on and off without HACS and cloud services and timings and checking weather schedules (looking at you, Orbit). My setup would greatly benefit from the simplicity of my end points just being on/off switches!

@DonnySus
Copy link

I also bought one of these irrigation valves. ZHA has not a quirk for a moment (at least I found nothing), but Zigbee2MQTT already developed some workaround. Can anybody from development team check following link it the provided code helo to build up a quirk for that device?
The link for Zigbee2MQTT code: https://github.com/Koenkk/zigbee2mqtt/issues/15124

@MiguelAngelLV
Copy link

I have one too.

I try create a quirks but only get a show a useless switch. The switch stage change but it don't do nothing.

@pazzotranquillo
Copy link

Have you guys found a custom solution for this? It would really great if this valve could be added to ZHA.

@Margriko
Copy link

Margriko commented Jul 10, 2023

I tried to put the pieces together for a custom quirk but was not successful. The quirk was applied successfully, switch status is shown in the UI, it reacts to the physical button press, but it is not possible to control it from the UI. Zigbee2MQTT implementation had to send some custom command to activate it, but I am a complete novice with ZHA quirks and Zigbee itself.

Anyway, if anyone wants to continue, here is the starting point for a quirk.
Battery status is not shown correctly as it has 3 states instead of percentage and it needs to be implemented. Also I listed all data points I found in the logs.

from typing import Dict

from zigpy.profiles import zha
from zigpy.quirks import CustomDevice
import zigpy.types as t
from zigpy.zcl import foundation
from zigpy.zcl.clusters.general import Basic, Groups, Identify, OnOff, Ota, Scenes, Time
from zigpy.zcl.clusters.smartenergy import Metering

from zhaquirks import DoublingPowerConfigurationCluster
from zhaquirks.const import (
    DEVICE_TYPE,
    ENDPOINTS,
    INPUT_CLUSTERS,
    MODELS_INFO,
    OUTPUT_CLUSTERS,
    PROFILE_ID,
)
from zhaquirks.tuya import (
    TUYA_SET_DATA,
    TuyaLocalCluster,
    TuyaNewManufCluster,
    TuyaZBExternalSwitchTypeCluster,
    TuyaPowerConfigurationCluster2AA,
)
from zhaquirks.tuya.mcu import (
    DPToAttributeMapping,
    EnchantedDevice,
    TuyaMCUCluster,
    TuyaOnOff,
    TuyaOnOffNM,
    TuyaPowerConfigurationCluster,
)

class TuyaFJKZYellowValveManufCluster(TuyaMCUCluster):
    """Manufacturer Specific Cluster for the _TZ3210_0jxeoadc water valve sold as RAIN SEER FJKZ005C-Y."""

    # class BatteryState(t.enum8):
    #     """Battery state option."""
        
    #     Low = 0x00
    #     Medium = 0x01
    #     High = 0x02
        
    attributes = TuyaMCUCluster.attributes.copy()
    
    dp_to_attribute: Dict[int, DPToAttributeMapping] = {
        101: DPToAttributeMapping(
            TuyaOnOff.ep_attribute,
            "on_off",
        ),
        102: DPToAttributeMapping(
            TuyaMCUCluster.ep_attribute,
            "dp_2",
        ),
        103: DPToAttributeMapping(
            TuyaMCUCluster.ep_attribute,
            "dp_3",
        ),
        105: DPToAttributeMapping(
            TuyaMCUCluster.ep_attribute,
            "dp_5",
        ),
        106: DPToAttributeMapping(
            TuyaMCUCluster.ep_attribute,
            "dp_6",
        ),
        109: DPToAttributeMapping(
            TuyaMCUCluster.ep_attribute,
            "dp_9",
        ),
        110: DPToAttributeMapping(
            TuyaMCUCluster.ep_attribute,
            "dp_110",
        ),
        111: DPToAttributeMapping(
            TuyaMCUCluster.ep_attribute,
            "dp_111",
        ),
        115: DPToAttributeMapping(
            TuyaPowerConfigurationCluster.ep_attribute,
            "battery_status",
        ),
    }

    data_point_handlers = {
        101: "_dp_2_attr_update",
        102: "_dp_2_attr_update",
        103: "_dp_2_attr_update",
        105: "_dp_2_attr_update",
        106: "_dp_2_attr_update",
        109: "_dp_2_attr_update",
        110: "_dp_2_attr_update",
        111: "_dp_2_attr_update",
        115: "_dp_2_attr_update",
    }
    

class TuyaFJKZYellowValve(EnchantedDevice):
    signature = {
        MODELS_INFO: [("_TZ3210_0jxeoadc", "TS0049")],
        ENDPOINTS: {
            # <SimpleDescriptor endpoint=1 profile=260 device_type=266
            # device_version=1
            # input_clusters=[0, 61184]
            # output_clusters=[10, 25]>
            1: {
                PROFILE_ID: zha.PROFILE_ID,
                DEVICE_TYPE: zha.DeviceType.ON_OFF_SWITCH,
                INPUT_CLUSTERS: [
                    Basic.cluster_id,
                    TuyaFJKZYellowValveManufCluster.cluster_id,
                ],
                OUTPUT_CLUSTERS: [Time.cluster_id, Ota.cluster_id],
            },
        },
    }

    replacement = {
        ENDPOINTS: {
            1: {
                PROFILE_ID: zha.PROFILE_ID,
                DEVICE_TYPE: zha.DeviceType.ON_OFF_SWITCH,
                INPUT_CLUSTERS: [
                    Basic.cluster_id,
                    TuyaOnOff,
                    TuyaPowerConfigurationCluster,
                    TuyaFJKZYellowValveManufCluster,
                ],
                OUTPUT_CLUSTERS: [Time.cluster_id, Ota.cluster_id],
            },
        },
    }

@igalg99
Copy link

igalg99 commented Jul 17, 2023

Thanks @Margriko, I have tried it and it is working as you said. cannot control the switch from home assistant but can see the status changing when I physically press the button.

For the time I use a work around and combine it with a finger bot. the finger bot presses and status changes in home assistant. not ideal but it works for now.

Hope someone will manage to totally fix it and make it work properly so I can use the fingerbot elsewhere.

@martinw72
Copy link

log output:

"data": {
"ieee": "REDACTED",
"nwk": 64536,
"manufacturer": "_TZ3210_0jxeoadc",
"model": "TS0049",
"name": "_TZ3210_0jxeoadc TS0049",
"quirk_applied": false,
"quirk_class": "zigpy.device.Device",
"manufacturer_code": 4417,
"power_source": "Battery or Unknown",
"lqi": 180,
"rssi": -55,
"last_seen": "2023-07-16T22:01:13",
"available": false,
"device_type": "EndDevice",
"signature": {
"node_descriptor": "NodeDescriptor(logical_type=<LogicalType.EndDevice: 2>, complex_descriptor_available=0, user_descriptor_available=0, reserved=0, aps_flags=0, frequency_band=<FrequencyBand.Freq2400MHz: 8>, mac_capability_flags=<MACCapabilityFlags.AllocateAddress: 128>, manufacturer_code=4417, maximum_buffer_size=66, maximum_incoming_transfer_size=66, server_mask=10752, maximum_outgoing_transfer_size=66, descriptor_capability_field=<DescriptorCapability.NONE: 0>, *allocate_address=True, *is_alternate_pan_coordinator=False, *is_coordinator=False, *is_end_device=True, *is_full_function_device=False, *is_mains_powered=False, *is_receiver_on_when_idle=False, *is_router=False, *is_security_capable=False)",
"endpoints": {
"1": {
"profile_id": "0x0104",
"device_type": "0x0000",
"input_clusters": [
"0x0000",
"0xef00"
],
"output_clusters": [
"0x000a",
"0x0019"
]
}
},
"manufacturer": "_TZ3210_0jxeoadc",
"model": "TS0049"
},
"active_coordinator": false,
"entities": [],
"neighbors": [],
"routes": [],
"endpoint_names": [
{
"name": "ON_OFF_SWITCH"
}
],
"user_given_name": "Glasshausbew\u00e4sserung",
"device_reg_id": "5d5ba450476da71385ab19e332022105",
"area_id": "glashaus",
"cluster_details": {
"1": {
"device_type": {
"name": "ON_OFF_SWITCH",
"id": 0
},
"profile_id": 260,
"in_clusters": {
"0xef00": {
"endpoint_attribute": null,
"attributes": {},
"unsupported_attributes": {}
},
"0x0000": {
"endpoint_attribute": "basic",
"attributes": {
"0x0004": {
"attribute_name": "manufacturer",
"value": "_TZ3210_0jxeoadc"
},
"0x0005": {
"attribute_name": "model",
"value": "TS0049"
}
},
"unsupported_attributes": {}
}
},
"out_clusters": {
"0x0019": {
"endpoint_attribute": "ota",
"attributes": {},
"unsupported_attributes": {}
},
"0x000a": {
"endpoint_attribute": "time",
"attributes": {},
"unsupported_attributes": {}
}
}
}
}
}

@coutadeurf
Copy link

Hi,

They had the same issue in Z2M, and this was because of that:
"However, the main point that they found was that the valve wouldn't work until the sendDataPoint...() function was called with cmd = 0x04 ("Send commands")".
After adding that value, it worked. I am not fluent enough in quirks to propose something but that may help someone to update the proposed solution

@zenalien
Copy link

hi everyone, any idea, if this will be ever available please ?

@pnneil
Copy link

pnneil commented Jul 27, 2023

FWIW I would like to add my voice to this request :)

@coutadeurf
Copy link

I have a test to do but as I am not close to the device this week, so I cannot test it myself now.
If you want, you can do it: in the given quirks, replace TuyaOnOff by TuyaOnOffNM in the 2 places where it appears: I found a generic tuya valve quirks that is using TuyaOnOffNM. If it doesn't work, other option would be to understand what the quirk I found is doing differently but it isnquite complex...

@pnneil
Copy link

pnneil commented Jul 27, 2023

Thanks, but the behaviour is the same as described above for me...

@coutadeurf
Copy link

I finally decided to go with Z2M because I have another device that is not supported, I was just at the beginning of my setup and estimated that I will spend less time setting up Z2M than trying to blindly fix the quirks.

@pnneil
Copy link

pnneil commented Jul 30, 2023

I finally decided to go with Z2M because I have another device that is not supported, I was just at the beginning of my setup and estimated that I will spend less time setting up Z2M than trying to blindly fix the quirks.

I can understand that, for me this is the only device out of quite a few which is not yet supported, so I'm sticking with ZHA for the time being. Good luck!

@pnneil
Copy link

pnneil commented Aug 1, 2023

So I found this over at Z2MQTT, which is the converter for the device. I can see that a special conversion has been set up for the Switch and Timer for the valve, but I have no idea how to convert this into the required code for a quirk.

Any ideas?

const fz = require('zigbee-herdsman-converters/converters/fromZigbee');
const tz = require('zigbee-herdsman-converters/converters/toZigbee');
const exposes = require('zigbee-herdsman-converters/lib/exposes');
const reporting = require('zigbee-herdsman-converters/lib/reporting');
const extend = require('zigbee-herdsman-converters/lib/extend');
const e = exposes.presets;
const ea = exposes.access;
const tuya = require("zigbee-herdsman-converters/lib/tuya");

const TS0049_ValueConverter = {
Switch:{
to: async (value, meta) => {
const entity = meta.device.endpoints[0];
await tuya.sendDataPointBool(entity, 101, value.toUpperCase() === 'ON', 0x04);
},
from: (value) => {
return {false: 'OFF', true: 'ON'}[value];
},
},
IrrigationTimer:{
to: async (value, meta) => {
const entity = meta.device.endpoints[0];
await tuya.sendDataPointValue(entity, 111, value, 0x04);
},
from: (value) => {
return value;
},
},
}

const definition = {
fingerprint: tuya.fingerprint('TS0049', ['_TZ3210_0jxeoadc']),
model: 'TS0049',
vendor: 'TuYa',
description: 'Water Valve',
fromZigbee: [tuya.fz.datapoints],
toZigbee: [tuya.tz.datapoints],
onEvent: tuya.onEventSetLocalTime,
configure: tuya.configureMagicPacket,
exposes: [
tuya.exposes.errorStatus(),
tuya.exposes.switch(),
tuya.exposes.countdown().withValueMin(0).withValueMax(255).withUnit('minutes')
.withDescription('Max on time in minutes'),
tuya.exposes.batteryState(),
],
meta: {
tuyaDatapoints: [
[26, 'error_status', tuya.valueConverter.raw],
[101, 'state', TS0049_ValueConverter.Switch],
[111, 'countdown', TS0049_ValueConverter.IrrigationTimer],
[115, 'battery_state', tuya.valueConverter.batteryState],
],
},
};
module.exports = definition;

@zenalien
Copy link

zenalien commented Aug 1, 2023

I finally decided to go with Z2M because I have another device that is not supported, I was just at the beginning of my setup and estimated that I will spend less time setting up Z2M than trying to blindly fix the quirks.

Is the device fully functionnal with Z2M ?
By chance wou:ld you know what entities are there ?

Thank you .

@coutadeurf
Copy link

coutadeurf commented Aug 1, 2023 via email

@pnneil
Copy link

pnneil commented Aug 6, 2023

So with some trial and error, (mostly the latter :) ) and borrowing other bits of code I found a way to control the valve. It is throwing warning messages which I haven't eliminated yet but it is a start...

from typing import Any, Dict, Optional, Union

from zigpy.profiles import zha
from zigpy.quirks import CustomDevice
import zigpy.types as t
from zigpy.zcl import foundation
from zigpy.zcl.clusters.general import Basic, Identify, OnOff, Ota, Time
from zigpy.zcl.clusters.smartenergy import Metering

from zhaquirks import DoublingPowerConfigurationCluster
from zhaquirks.const import (
    DEVICE_TYPE,
    ENDPOINTS,
    INPUT_CLUSTERS,
    MODELS_INFO,
    OUTPUT_CLUSTERS,
    PROFILE_ID,
)
from zhaquirks.tuya import (
    TUYA_SEND_DATA,
#    TuyaLocalCluster,
)
from zhaquirks.tuya.mcu import (
    DPToAttributeMapping,
    EnchantedDevice,
    TuyaMCUCluster,
    TuyaOnOff,
    TuyaPowerConfigurationCluster,
)

class TuyaValveFamilyCluster(TuyaMCUCluster):
    """On/Off Tuya family cluster with extra device attributes"""

    attributes = TuyaMCUCluster.attributes.copy()
    
    async def command(
        self,
        command_id: Union[foundation.GeneralCommand, int, t.uint8_t],
        *args,
        manufacturer: Optional[Union[int, t.uint16_t]] = None,
        expect_reply: bool = True,
        tsn: Optional[Union[int, t.uint8_t]] = None,
        **kwargs: Any,
    ):
        """Override the default Cluster command."""
        self.debug("Setting the NO manufacturer id in command: %s", command_id)
        return await super().command(
            TUYA_SEND_DATA,
            *args,
            manufacturer=foundation.ZCLHeader.NO_MANUFACTURER_ID,
            expect_reply=expect_reply,
            tsn=tsn,
            **kwargs,
        )    

    dp_to_attribute: Dict[int, DPToAttributeMapping] = {
        26: DPToAttributeMapping(
            TuyaMCUCluster.ep_attribute,
            "error_status",
        ),
        101: DPToAttributeMapping(
            TuyaOnOff.ep_attribute,
            "on_off",
        ),
        110: DPToAttributeMapping(
            TuyaMCUCluster.ep_attribute,
            "dp_110",
        ),        
        111: DPToAttributeMapping(
            TuyaMCUCluster.ep_attribute,
            "irrigation_time",
        ),
        115: DPToAttributeMapping(
            TuyaPowerConfigurationCluster.ep_attribute,
            "battery_state",
        ),
    }

    data_point_handlers = {
        26: "_dp_2_attr_update",
        101: "_dp_2_attr_update",
        110: "_dp_2_attr_update",
        111: "_dp_2_attr_update",
        115: "_dp_2_attr_update",
    }

class TuyaIrrigationValve(EnchantedDevice):
    """Tuya green irrigation valve device."""
    signature = {
        MODELS_INFO: [("_TZ3210_0jxeoadc", "TS0049")],
        ENDPOINTS: {
            # <SimpleDescriptor endpoint=1 profile=260 device_type=0
            # device_version=1
            # input_clusters=[0, 61184]
            # output_clusters=[10, 25]>
            1: {
                PROFILE_ID: zha.PROFILE_ID,
                DEVICE_TYPE: zha.DeviceType.ON_OFF_SWITCH,
                INPUT_CLUSTERS: [
                    Basic.cluster_id,
                    TuyaValveFamilyCluster.cluster_id,
                ],
                OUTPUT_CLUSTERS: [Time.cluster_id, Ota.cluster_id],
            },
        },
    }

    replacement = {
        ENDPOINTS: {
            1: {
                PROFILE_ID: zha.PROFILE_ID,
                DEVICE_TYPE: zha.DeviceType.ON_OFF_SWITCH,
                INPUT_CLUSTERS: [
                    Basic.cluster_id,
                    TuyaOnOff,
                    TuyaPowerConfigurationCluster,
                    TuyaValveFamilyCluster
                ],
                OUTPUT_CLUSTERS: [Time.cluster_id, Ota.cluster_id],
            },
        },
    }

@danpeig
Copy link
Contributor

danpeig commented Aug 8, 2023

I will try it out If I have some time during the weekend.... what sort of warning messages do you get?

@pnneil
Copy link

pnneil commented Aug 8, 2023

I get these:
2023-08-08 12:42:14.504 WARNING (MainThread) [zigpy.zcl] [0x739A:1:0xef00] Unknown cluster command 5 b'\x00\x8ee\x01\x00\x01\x01'
2023-08-08 12:42:14.614 WARNING (MainThread) [zigpy.zcl] [0x739A:1:0xef00] Unknown cluster command 5
b'\x00\x8fn\x00\x00\x02\x00\x01'

This is the pair I get when I turn the valve on. I get another pair when I turn the valve off which are the same except for the last digit which is a zero. From what I can gather, the warning seems to be triggered by a response coming back from the valve but I could be wrong :)
Here are some logs... The device id is 0x739A.
home-assistant_zha_2023-08-08T07-03-45.684Z.log

@danpeig
Copy link
Contributor

danpeig commented Aug 9, 2023

Hi,

I did some minor changes to expose the irrigation_timer in the cluster settings in ZHA. This way you can set a different maximum duration for the cycle directly from HomeAssistant.

Still trying to understand the warnings and the override of the command function... I am also curious about how to read the battery status properly....

from typing import Any, Dict, Optional, Union

from zigpy.profiles import zha
from zigpy.quirks import CustomDevice
import zigpy.types as t
from zigpy.zcl import foundation
from zigpy.zcl.clusters.general import Basic, Identify, OnOff, Ota, Time
from zigpy.zcl.clusters.smartenergy import Metering

from zhaquirks import DoublingPowerConfigurationCluster
from zhaquirks.const import (
    DEVICE_TYPE,
    ENDPOINTS,
    INPUT_CLUSTERS,
    MODELS_INFO,
    OUTPUT_CLUSTERS,
    PROFILE_ID,
)
from zhaquirks.tuya import (
    TUYA_SEND_DATA,
#    TuyaLocalCluster,
)
from zhaquirks.tuya.mcu import (
    DPToAttributeMapping,
    EnchantedDevice,
    TuyaMCUCluster,
    TuyaOnOff,
    TuyaPowerConfigurationCluster,
)

class TuyaValveFamilyCluster(TuyaMCUCluster):
    """On/Off Tuya family cluster with extra device attributes"""

    attributes = TuyaMCUCluster.attributes.copy()
    attributes.update(
        {
            0xEF01: ("irrigation_time", t.uint32_t, True),
            0xEF02: ("dp_110", t.uint32_t, True),
            0xEF03: ("error_status", t.uint32_t, True),
        }
    )
    
    async def command(
        self,
        command_id: Union[foundation.GeneralCommand, int, t.uint8_t],
        *args,
        manufacturer: Optional[Union[int, t.uint16_t]] = None,
        expect_reply: bool = True,
        tsn: Optional[Union[int, t.uint8_t]] = None,
        **kwargs: Any,
    ):
        """Override the default Cluster command."""
        self.debug("Setting the NO manufacturer id in command: %s", command_id)
        return await super().command(
            TUYA_SEND_DATA,
            *args,
            manufacturer=foundation.ZCLHeader.NO_MANUFACTURER_ID,
            expect_reply=expect_reply,
            tsn=tsn,
            **kwargs,
        )    

    dp_to_attribute: Dict[int, DPToAttributeMapping] = {
        26: DPToAttributeMapping(
            TuyaMCUCluster.ep_attribute,
            "error_status",
        ),
        101: DPToAttributeMapping(
            TuyaOnOff.ep_attribute,
            "on_off",
        ),
        110: DPToAttributeMapping(
            TuyaMCUCluster.ep_attribute,
            "dp_110",
        ),        
        111: DPToAttributeMapping(
            TuyaMCUCluster.ep_attribute,
            "irrigation_time",
        ),
        115: DPToAttributeMapping(
            TuyaPowerConfigurationCluster.ep_attribute,
            "battery_percentage_remaining",
        ),
    }

    data_point_handlers = {
        26: "_dp_2_attr_update",
        101: "_dp_2_attr_update",
        110: "_dp_2_attr_update",
        111: "_dp_2_attr_update",
        115: "_dp_2_attr_update",
    }

class TuyaIrrigationValve(EnchantedDevice):
    """Tuya green irrigation valve device."""
    signature = {
        MODELS_INFO: [("_TZ3210_0jxeoadc", "TS0049")],
        ENDPOINTS: {
            # <SimpleDescriptor endpoint=1 profile=260 device_type=0
            # device_version=1
            # input_clusters=[0, 61184]
            # output_clusters=[10, 25]>
            1: {
                PROFILE_ID: zha.PROFILE_ID,
                DEVICE_TYPE: zha.DeviceType.ON_OFF_SWITCH,
                INPUT_CLUSTERS: [
                    Basic.cluster_id,
                    TuyaValveFamilyCluster.cluster_id,
                ],
                OUTPUT_CLUSTERS: [Time.cluster_id, Ota.cluster_id],
            },
        },
    }

    replacement = {
        ENDPOINTS: {
            1: {
                PROFILE_ID: zha.PROFILE_ID,
                DEVICE_TYPE: zha.DeviceType.ON_OFF_SWITCH,
                INPUT_CLUSTERS: [
                    Basic.cluster_id,
                    TuyaOnOff,
                    TuyaPowerConfigurationCluster,
                    TuyaValveFamilyCluster
                ],
                OUTPUT_CLUSTERS: [Time.cluster_id, Ota.cluster_id],
            },
        },
    }

@pnneil
Copy link

pnneil commented Aug 9, 2023

Hi danpeig, After reloading, the new quirk, I didn't see any difference but after deleting the device and re-adding it I am getting a Battery reading, although it is only 2% (seems very low). I haven't seen any additional Entities exposed regarding the Irrigation timer, or is this meant to be controlled another way? The switch is definitely still working :)
Thanks for your help!

@MiguelAngelLV
Copy link

The battery value is not a percentage. it have 3 values:

Low = 0x00
Medium = 0x01
High = 0x02

So, is necessary a custom battery converter.

@pnneil
Copy link

pnneil commented Aug 9, 2023

The battery value is not a percentage. it have 3 values:

Low = 0x00 Medium = 0x01 High = 0x02

So, is necessary a custom battery converter.

Thanks, That explains why the battery values I was getting were 1 or 2.

@danpeig
Copy link
Contributor

danpeig commented Aug 9, 2023

Conversion from 0, 1, 2 to %:

115: DPToAttributeMapping(
            TuyaPowerConfigurationCluster.ep_attribute,
            "battery_percentage_remaining",
            converter=lambda x: x * 50,  # Adjust percen
tage
        ),

@MiguelAngelLV
Copy link

I would use (x+1)*33

HIGH = 99
MEDIUM = 66
LOW = 33

115: DPToAttributeMapping(
            TuyaPowerConfigurationCluster.ep_attribute,
            "battery_percentage_remaining",
            converter=lambda x: (x+1) * 33,  # Adjust percen
tage
        ),

@MiguelAngelLV
Copy link

A little improvement battery

from typing import Any, Dict, Optional, Union

import zigpy.types as t
from zhaquirks import DoublingPowerConfigurationCluster
from zhaquirks.const import (
    DEVICE_TYPE,
    ENDPOINTS,
    INPUT_CLUSTERS,
    MODELS_INFO,
    OUTPUT_CLUSTERS,
    PROFILE_ID,
)
from zhaquirks.tuya import (
    TUYA_SEND_DATA, TuyaLocalCluster,
)
from zhaquirks.tuya.mcu import (
    DPToAttributeMapping,
    EnchantedDevice,
    TuyaMCUCluster,
    TuyaOnOff,
)
from zigpy.profiles import zha
from zigpy.zcl import foundation
from zigpy.zcl.clusters.general import Basic, Ota, Time, PowerConfiguration


class TuyaValveFamilyBattery(TuyaLocalCluster, DoublingPowerConfigurationCluster):
    _values = [10, 50, 90]
    _CONSTANT_ATTRIBUTES = {
        PowerConfiguration.attributes_by_name["battery_quantity"].id: 4,
        PowerConfiguration.attributes_by_name["battery_size"].id: PowerConfiguration.BatterySize.AAA
    }

    def _update_attribute(self, attrid, value):
        if attrid == self.BATTERY_PERCENTAGE_REMAINING:
            value = self._values[value]
        super()._update_attribute(attrid, value)


class TuyaValveFamilyCluster(TuyaMCUCluster):
    """On/Off Tuya family cluster with extra device attributes"""

    attributes = TuyaMCUCluster.attributes.copy()
    attributes.update(
        {
            0xEF01: ("irrigation_time", t.uint32_t, True),
            0xEF02: ("dp_110", t.uint32_t, True),
            0xEF03: ("error_status", t.uint32_t, True),
        }
    )

    async def command(
            self,
            command_id: Union[foundation.GeneralCommand, int, t.uint8_t],
            *args,
            manufacturer: Optional[Union[int, t.uint16_t]] = None,
            expect_reply: bool = True,
            tsn: Optional[Union[int, t.uint8_t]] = None,
            **kwargs: Any,
    ):
        """Override the default Cluster command."""
        self.debug("Setting the NO manufacturer id in command: %s", command_id)
        return await super().command(
            TUYA_SEND_DATA,
            *args,
            manufacturer=foundation.ZCLHeader.NO_MANUFACTURER_ID,
            expect_reply=expect_reply,
            tsn=tsn,
            **kwargs,
        )

    dp_to_attribute: Dict[int, DPToAttributeMapping] = {
        26: DPToAttributeMapping(
            TuyaMCUCluster.ep_attribute,
            "error_status",
        ),
        101: DPToAttributeMapping(
            TuyaOnOff.ep_attribute,
            "on_off",
        ),
        110: DPToAttributeMapping(
            TuyaMCUCluster.ep_attribute,
            "dp_110",
        ),
        111: DPToAttributeMapping(
            TuyaMCUCluster.ep_attribute,
            "irrigation_time",
        ),
        115: DPToAttributeMapping(
            TuyaValveFamilyBattery.ep_attribute,
            "battery_percentage_remaining",
        ),
    }

    data_point_handlers = {
        26: "_dp_2_attr_update",
        101: "_dp_2_attr_update",
        110: "_dp_2_attr_update",
        111: "_dp_2_attr_update",
        115: "_dp_2_attr_update",
    }


class TuyaIrrigationValve(EnchantedDevice):
    """Tuya green irrigation valve device."""
    signature = {
        MODELS_INFO: [("_TZ3210_0jxeoadc", "TS0049")],
        ENDPOINTS: {
            # <SimpleDescriptor endpoint=1 profile=260 device_type=0
            # device_version=1
            # input_clusters=[0, 61184]
            # output_clusters=[10, 25]>
            1: {
                PROFILE_ID: zha.PROFILE_ID,
                DEVICE_TYPE: zha.DeviceType.ON_OFF_SWITCH,
                INPUT_CLUSTERS: [
                    Basic.cluster_id,
                    TuyaValveFamilyCluster.cluster_id,
                ],
                OUTPUT_CLUSTERS: [Time.cluster_id, Ota.cluster_id],
            },
        },
    }

    replacement = {
        ENDPOINTS: {
            1: {
                PROFILE_ID: zha.PROFILE_ID,
                DEVICE_TYPE: zha.DeviceType.ON_OFF_SWITCH,
                INPUT_CLUSTERS: [
                    Basic.cluster_id,
                    TuyaOnOff,
                    TuyaValveFamilyBattery,
                    TuyaValveFamilyCluster
                ],
                OUTPUT_CLUSTERS: [Time.cluster_id, Ota.cluster_id],
            },
        },
    }

I added a rule for battery (low => 10%, medium => 50%, high => 90%), they can be modified easily.

And added the battery size and quantity too.

@pnneil
Copy link

pnneil commented Aug 10, 2023

Thanks MiguelAngelLV. its working well!

@moryoav
Copy link

moryoav commented Sep 1, 2024

These are screenshots from my setup, maybe you'll spot something different:

zb3
zb2
zb1

@zaratustraelimpio
Copy link

Hi,

I have deleted the previous one and added it again, but still it doesn't work. I have everything the same as you, I don't understand anything, honestly...

image

image

@moryoav
Copy link

moryoav commented Sep 1, 2024

Then you need to carefully go over the logs, see if you're getting some error, you should find some line in the logs referring to this script.

@zaratustraelimpio
Copy link

Hi, this is the home-assistant.log.1 file, but I don't see any errors regarding this:

`2024-09-01 12:29:24.245 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration balance_neto which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2024-09-01 12:29:24.247 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration smartir which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2024-09-01 12:29:24.249 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration imou_life which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2024-09-01 12:29:24.250 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration sonoff which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2024-09-01 12:29:24.251 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration hacs which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2024-09-01 12:29:24.253 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration huawei_solar which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2024-09-01 12:29:24.254 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration tarifa_20td which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2024-09-01 12:29:24.256 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration xiaomi_airfryer which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2024-09-01 12:29:24.258 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration xiaomi_miot which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2024-09-01 12:29:28.219 WARNING (ImportExecutor_0) [homeassistant.components.climate.const] HVAC_MODE_OFF was used from smartir, this is a deprecated constant which will be removed in HA Core 2025.1. Use HVACMode.OFF instead, please report it to the author of the 'smartir' custom integration
2024-09-01 12:29:28.225 WARNING (ImportExecutor_0) [homeassistant.components.climate.const] HVAC_MODE_HEAT was used from smartir, this is a deprecated constant which will be removed in HA Core 2025.1. Use HVACMode.HEAT instead, please report it to the author of the 'smartir' custom integration
2024-09-01 12:29:28.231 WARNING (ImportExecutor_0) [homeassistant.components.climate.const] HVAC_MODE_COOL was used from smartir, this is a deprecated constant which will be removed in HA Core 2025.1. Use HVACMode.COOL instead, please report it to the author of the 'smartir' custom integration
2024-09-01 12:29:28.237 WARNING (ImportExecutor_0) [homeassistant.components.climate.const] HVAC_MODE_DRY was used from smartir, this is a deprecated constant which will be removed in HA Core 2025.1. Use HVACMode.DRY instead, please report it to the author of the 'smartir' custom integration
2024-09-01 12:29:28.242 WARNING (ImportExecutor_0) [homeassistant.components.climate.const] HVAC_MODE_FAN_ONLY was used from smartir, this is a deprecated constant which will be removed in HA Core 2025.1. Use HVACMode.FAN_ONLY instead, please report it to the author of the 'smartir' custom integration
2024-09-01 12:29:28.248 WARNING (ImportExecutor_0) [homeassistant.components.climate.const] HVAC_MODE_AUTO was used from smartir, this is a deprecated constant which will be removed in HA Core 2025.1. Use HVACMode.AUTO instead, please report it to the author of the 'smartir' custom integration
2024-09-01 12:29:28.254 WARNING (ImportExecutor_0) [homeassistant.components.climate.const] SUPPORT_TARGET_TEMPERATURE was used from smartir, this is a deprecated constant which will be removed in HA Core 2025.1. Use ClimateEntityFeature.TARGET_TEMPERATURE instead, please report it to the author of the 'smartir' custom integration
2024-09-01 12:29:28.260 WARNING (ImportExecutor_0) [homeassistant.components.climate.const] SUPPORT_FAN_MODE was used from smartir, this is a deprecated constant which will be removed in HA Core 2025.1. Use ClimateEntityFeature.FAN_MODE instead, please report it to the author of the 'smartir' custom integration
2024-09-01 12:29:28.266 WARNING (ImportExecutor_0) [homeassistant.components.climate.const] SUPPORT_SWING_MODE was used from smartir, this is a deprecated constant which will be removed in HA Core 2025.1. Use ClimateEntityFeature.SWING_MODE instead, please report it to the author of the 'smartir' custom integration
2024-09-01 12:29:28.931 WARNING (MainThread) [homeassistant.helpers.frame] Detected that custom integration 'xiaomi_airfryer' calls async_forward_entry_setup for integration, xiaomi_airfryer with title: Freidora de aire and entry_id: 01J5N03W7M1F7YDE1BBP54NKMV, which is deprecated and will stop working in Home Assistant 2025.6, await async_forward_entry_setups instead at custom_components/xiaomi_airfryer/init.py, line 112: hass.async_create_task(hass.config_entries.async_forward_entry_setup(, please create a bug report at https://github.com/tsunglung/XiaomiAirFryer/issues
2024-09-01 12:29:30.134 WARNING (MainThread) [homeassistant.util.loop] Detected blocking call to open with args ('/config/custom_components/smartir/codes/climate/1062.json',) inside the event loop by custom integration 'smartir' at custom_components/smartir/climate.py, line 85: with open(device_json_path) as j: (offender: /config/custom_components/smartir/climate.py, line 85: with open(device_json_path) as j:), please report it to the author of the 'smartir' custom integration
For developers, please see https://developers.home-assistant.io/docs/asyncio_blocking_operations/#open
Traceback (most recent call last):
File "", line 198, in _run_module_as_main
File "", line 88, in _run_code
File "/usr/src/homeassistant/homeassistant/main.py", line 223, in
sys.exit(main())
File "/usr/src/homeassistant/homeassistant/main.py", line 209, in main
exit_code = runner.run(runtime_conf)
File "/usr/src/homeassistant/homeassistant/runner.py", line 190, in run
return loop.run_until_complete(setup_and_run_hass(runtime_config))
File "/usr/local/lib/python3.12/asyncio/base_events.py", line 674, in run_until_complete
self.run_forever()
File "/usr/local/lib/python3.12/asyncio/base_events.py", line 641, in run_forever
self._run_once()
File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1990, in _run_once
handle._run()
File "/usr/local/lib/python3.12/asyncio/events.py", line 88, in _run
self._context.run(self._callback, *self._args)
File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 318, in async_setup_platform
await self._platforms[key].async_setup(platform_config, discovery_info)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 301, in async_setup
await self._async_setup_platform(async_create_setup_awaitable)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 361, in async_setup_platform
awaitable = create_eager_task(awaitable, loop=hass.loop)
File "/usr/src/homeassistant/homeassistant/util/async
.py", line 37, in create_eager_task
return Task(coro, loop=loop, name=name, eager_start=True)
File "/config/custom_components/smartir/climate.py", line 85, in async_setup_platform
with open(device_json_path) as j:

2024-09-01 12:29:30.137 WARNING (MainThread) [homeassistant.helpers.entity] Entity None (<class 'custom_components.smartir.climate.SmartIRClimate'>) is using deprecated supported features values which will be removed in HA Core 2025.1. Instead it should use <ClimateEntityFeature.TARGET_TEMPERATURE|FAN_MODE: 9>, please report it to the author of the 'smartir' custom integration and reference https://developers.home-assistant.io/blog/2023/12/28/support-feature-magic-numbers-deprecation
2024-09-01 12:29:30.138 WARNING (MainThread) [homeassistant.components.climate] Entity None (<class 'custom_components.smartir.climate.SmartIRClimate'>) does not set ClimateEntityFeature.TURN_OFF but implements the turn_off method. Please report it to the author of the 'smartir' custom integration
2024-09-01 12:29:30.138 WARNING (MainThread) [homeassistant.components.climate] Entity None (<class 'custom_components.smartir.climate.SmartIRClimate'>) does not set ClimateEntityFeature.TURN_ON but implements the turn_on method. Please report it to the author of the 'smartir' custom integration
2024-09-01 12:29:30.139 WARNING (MainThread) [homeassistant.components.climate] Entity None (<class 'custom_components.smartir.climate.SmartIRClimate'>) implements HVACMode(s): off, cool, heat, dry, heat_cool, fan_only and therefore implicitly supports the turn_on/turn_off methods without setting the proper ClimateEntityFeature. Please report it to the author of the 'smartir' custom integration
2024-09-01 12:29:30.150 WARNING (MainThread) [homeassistant.helpers.frame] Detected that custom integration 'smartir' calls async_track_state_change instead of async_track_state_change_event which is deprecated and will be removed in Home Assistant 2025.5 at custom_components/smartir/climate.py, line 175: async_track_state_change(self.hass, self._temperature_sensor,, please report it to the author of the 'smartir' custom integration
2024-09-01 12:29:30.157 WARNING (MainThread) [homeassistant.helpers.frame] Detected that custom integration 'smartir' calls async_track_state_change instead of async_track_state_change_event which is deprecated and will be removed in Home Assistant 2025.5 at custom_components/smartir/climate.py, line 183: async_track_state_change(self.hass, self._humidity_sensor,, please report it to the author of the 'smartir' custom integration
2024-09-01 12:29:30.167 WARNING (MainThread) [homeassistant.helpers.entity] Entity None (<class 'custom_components.smartir.climate.SmartIRClimate'>) is using deprecated supported features values which will be removed in HA Core 2025.1. Instead it should use <ClimateEntityFeature.TARGET_TEMPERATURE|FAN_MODE: 9>, please report it to the author of the 'smartir' custom integration and reference https://developers.home-assistant.io/blog/2023/12/28/support-feature-magic-numbers-deprecation
2024-09-01 12:29:30.168 WARNING (MainThread) [homeassistant.components.climate] Entity None (<class 'custom_components.smartir.climate.SmartIRClimate'>) does not set ClimateEntityFeature.TURN_OFF but implements the turn_off method. Please report it to the author of the 'smartir' custom integration
2024-09-01 12:29:30.169 WARNING (MainThread) [homeassistant.components.climate] Entity None (<class 'custom_components.smartir.climate.SmartIRClimate'>) does not set ClimateEntityFeature.TURN_ON but implements the turn_on method. Please report it to the author of the 'smartir' custom integration
2024-09-01 12:29:30.169 WARNING (MainThread) [homeassistant.components.climate] Entity None (<class 'custom_components.smartir.climate.SmartIRClimate'>) implements HVACMode(s): off, cool, heat, dry, heat_cool, fan_only and therefore implicitly supports the turn_on/turn_off methods without setting the proper ClimateEntityFeature. Please report it to the author of the 'smartir' custom integration
2024-09-01 12:29:34.674 WARNING (MainThread) [homeassistant.components.fan] Entity sonoff.sonoff_1001e7e412 (<class 'custom_components.sonoff.fan.XFanDualR3'>) does not set FanEntityFeature.TURN_OFF but implements the turn_off method. Please create a bug report at https://github.com/AlexxIT/SonoffLAN/issues
2024-09-01 12:29:34.675 WARNING (MainThread) [homeassistant.components.fan] Entity sonoff.sonoff_1001e7e412 (<class 'custom_components.sonoff.fan.XFanDualR3'>) does not set FanEntityFeature.TURN_ON but implements the turn_on method. Please create a bug report at https://github.com/AlexxIT/SonoffLAN/issues
2024-09-01 12:29:34.676 WARNING (MainThread) [homeassistant.components.fan] Entity sonoff.sonoff_1001ebd88c (<class 'custom_components.sonoff.fan.XFanDualR3'>) does not set FanEntityFeature.TURN_OFF but implements the turn_off method. Please create a bug report at https://github.com/AlexxIT/SonoffLAN/issues
2024-09-01 12:29:34.676 WARNING (MainThread) [homeassistant.components.fan] Entity sonoff.sonoff_1001ebd88c (<class 'custom_components.sonoff.fan.XFanDualR3'>) does not set FanEntityFeature.TURN_ON but implements the turn_on method. Please create a bug report at https://github.com/AlexxIT/SonoffLAN/issues
2024-09-01 12:29:34.686 WARNING (MainThread) [homeassistant.components.fan] Entity sonoff.sonoff_1001ebd88e (<class 'custom_components.sonoff.fan.XFanDualR3'>) does not set FanEntityFeature.TURN_OFF but implements the turn_off method. Please create a bug report at https://github.com/AlexxIT/SonoffLAN/issues
2024-09-01 12:29:34.687 WARNING (MainThread) [homeassistant.components.fan] Entity sonoff.sonoff_1001ebd88e (<class 'custom_components.sonoff.fan.XFanDualR3'>) does not set FanEntityFeature.TURN_ON but implements the turn_on method. Please create a bug report at https://github.com/AlexxIT/SonoffLAN/issues
2024-09-01 12:29:34.687 WARNING (MainThread) [homeassistant.components.fan] Entity sonoff.sonoff_1001ebc9ee (<class 'custom_components.sonoff.fan.XFanDualR3'>) does not set FanEntityFeature.TURN_OFF but implements the turn_off method. Please create a bug report at https://github.com/AlexxIT/SonoffLAN/issues
2024-09-01 12:29:34.688 WARNING (MainThread) [homeassistant.components.fan] Entity sonoff.sonoff_1001ebc9ee (<class 'custom_components.sonoff.fan.XFanDualR3'>) does not set FanEntityFeature.TURN_ON but implements the turn_on method. Please create a bug report at https://github.com/AlexxIT/SonoffLAN/issues
2024-09-01 12:29:36.603 WARNING (MainThread) [homeassistant.helpers.frame] Detected code that calls async_forward_entry_setup for integration xiaomi_airfryer with title: Freidora de aire and entry_id: 01J5N03W7M1F7YDE1BBP54NKMV, during setup without awaiting async_forward_entry_setup, which can cause the setup lock to be released before the setup is done. This will stop working in Home Assistant 2025.1. Please report this issue.
Stack (most recent call last):
File "", line 198, in _run_module_as_main
File "", line 88, in _run_code
File "/usr/src/homeassistant/homeassistant/main.py", line 223, in
sys.exit(main())
File "/usr/src/homeassistant/homeassistant/main.py", line 209, in main
exit_code = runner.run(runtime_conf)
File "/usr/src/homeassistant/homeassistant/runner.py", line 190, in run
return loop.run_until_complete(setup_and_run_hass(runtime_config))
File "/usr/local/lib/python3.12/asyncio/base_events.py", line 674, in run_until_complete
self.run_forever()
File "/usr/local/lib/python3.12/asyncio/base_events.py", line 641, in run_forever
self._run_once()
File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1990, in _run_once
handle._run()
File "/usr/local/lib/python3.12/asyncio/events.py", line 88, in _run
self._context.run(self._callback, *self._args)
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 2161, in async_forward_entry_setup
_report_non_awaited_platform_forwards(entry, "async_forward_entry_setup")
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 1201, in _report_non_awaited_platform_forwards
report(
File "/usr/src/homeassistant/homeassistant/helpers/frame.py", line 151, in report
_LOGGER.warning(msg, stack_info=True)
2024-09-01 12:29:36.696 WARNING (MainThread) [homeassistant.helpers.frame] Detected code that calls async_forward_entry_setup for integration xiaomi_airfryer with title: Freidora de aire and entry_id: 01J5N03W7M1F7YDE1BBP54NKMV, during setup without awaiting async_forward_entry_setup, which can cause the setup lock to be released before the setup is done. This will stop working in Home Assistant 2025.1. Please report this issue.
Stack (most recent call last):
File "", line 198, in _run_module_as_main
File "", line 88, in _run_code
File "/usr/src/homeassistant/homeassistant/main.py", line 223, in
sys.exit(main())
File "/usr/src/homeassistant/homeassistant/main.py", line 209, in main
exit_code = runner.run(runtime_conf)
File "/usr/src/homeassistant/homeassistant/runner.py", line 190, in run
return loop.run_until_complete(setup_and_run_hass(runtime_config))
File "/usr/local/lib/python3.12/asyncio/base_events.py", line 674, in run_until_complete
self.run_forever()
File "/usr/local/lib/python3.12/asyncio/base_events.py", line 641, in run_forever
self._run_once()
File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1990, in _run_once
handle._run()
File "/usr/local/lib/python3.12/asyncio/events.py", line 88, in _run
self._context.run(self._callback, *self._args)
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 2161, in async_forward_entry_setup
_report_non_awaited_platform_forwards(entry, "async_forward_entry_setup")
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 1201, in _report_non_awaited_platform_forwards
report(
File "/usr/src/homeassistant/homeassistant/helpers/frame.py", line 151, in report
_LOGGER.warning(msg, stack_info=True)
2024-09-01 12:29:36.970 WARNING (MainThread) [homeassistant.util.loop] Detected blocking call to import_module with args ('holidays.countries.spain',) inside the event loop by custom integration 'tarifa_20td' at custom_components/tarifa_20td/sensor.py, line 81: Tariff20TD(p1, p2, p3) (offender: /usr/local/lib/python3.12/site-packages/holidays/registry.py, line 238: self.entity = getattr(importlib.import_module(self.module_name), self.entity_name)), please create a bug report at https://github.com/MiguelAngelLV/tarifa_20td/issues
For developers, please see https://developers.home-assistant.io/docs/asyncio_blocking_operations/#import_module
Traceback (most recent call last):
File "", line 198, in _run_module_as_main
File "", line 88, in _run_code
File "/usr/src/homeassistant/homeassistant/main.py", line 223, in
sys.exit(main())
File "/usr/src/homeassistant/homeassistant/main.py", line 209, in main
exit_code = runner.run(runtime_conf)
File "/usr/src/homeassistant/homeassistant/runner.py", line 190, in run
return loop.run_until_complete(setup_and_run_hass(runtime_config))
File "/usr/local/lib/python3.12/asyncio/base_events.py", line 674, in run_until_complete
self.run_forever()
File "/usr/local/lib/python3.12/asyncio/base_events.py", line 641, in run_forever
self._run_once()
File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1990, in _run_once
handle._run()
File "/usr/local/lib/python3.12/asyncio/events.py", line 88, in _run
self._context.run(self._callback, *self._args)
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 752, in async_setup_locked
await self.async_setup(hass, integration=integration)
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 604, in async_setup
result = await component.async_setup_entry(hass, self)
File "/config/custom_components/tarifa_20td/init.py", line 34, in async_setup_entry
await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 2098, in async_forward_entry_setups
await self._async_forward_entry_setups_locked(entry, platforms)
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 2109, in async_forward_entry_setups_locked
await asyncio.gather(
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 2111, in
create_eager_task(
File "/usr/src/homeassistant/homeassistant/util/async
.py", line 37, in create_eager_task
return Task(coro, loop=loop, name=name, eager_start=True)
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 2191, in _async_forward_entry_setup
await entry.async_setup(self.hass, integration=integration)
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 604, in async_setup
result = await component.async_setup_entry(hass, self)
File "/usr/src/homeassistant/homeassistant/components/sensor/init.py", line 130, in async_setup_entry
return await component.async_setup_entry(entry)
File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 195, in async_setup_entry
return await self._platforms[key].async_setup_entry(config_entry)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 331, in async_setup_entry
return await self._async_setup_platform(async_create_setup_awaitable)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 361, in async_setup_platform
awaitable = create_eager_task(awaitable, loop=hass.loop)
File "/usr/src/homeassistant/homeassistant/util/async
.py", line 37, in create_eager_task
return Task(coro, loop=loop, name=name, eager_start=True)
File "/config/custom_components/tarifa_20td/sensor.py", line 81, in async_setup_entry
Tariff20TD(p1, p2, p3)

2024-09-01 12:29:37.806 ERROR (MainThread) [homeassistant.components.device_tracker] Platform mobile_app does not generate unique IDs. ID 6fdc80abe2c33c9c already exists - ignoring device_tracker.poco_f5
2024-09-01 12:29:37.938 WARNING (MainThread) [homeassistant.components.ezviz.camera] Found camera with serial BA7352935 without configuration. Please go to integration to complete setup
2024-09-01 12:29:37.938 WARNING (MainThread) [homeassistant.components.ezviz.camera] Found camera with serial K68926368 without configuration. Please go to integration to complete setup
2024-09-01 12:29:37.939 WARNING (MainThread) [homeassistant.components.ezviz.camera] Found camera with serial K28042170 without configuration. Please go to integration to complete setup
2024-09-01 12:29:37.947 ERROR (MainThread) [homeassistant.components.image] Error while setting up ezviz platform for image
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 372, in _async_setup_platform
await asyncio.gather(*pending)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 631, in async_add_entities
for entity in new_entities:
File "/usr/src/homeassistant/homeassistant/components/ezviz/image.py", line 39, in
EzvizLastMotion(hass, coordinator, camera) for camera in coordinator.data
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/ezviz/image.py", line 60, in init
camera.data[CONF_PASSWORD] if camera is not None else None
~~~~~~~~~~~^^^^^^^^^^^^^^^
KeyError: 'password'
2024-09-01 12:29:38.001 WARNING (ImportExecutor_0) [py.warnings] :117: RuntimeWarning: coroutine 'EntityPlatform._async_add_entity' was never awaited

2024-09-01 12:29:38.473 WARNING (MainThread) [custom_components.xiaomi_miot.sensor] Get xiaomi scene history for 193087879 272001000690 failed: {'code': 0, 'message': '成功', 'result': {'history': []}}
2024-09-01 12:29:38.587 WARNING (MainThread) [custom_components.xiaomi_miot.sensor] Get xiaomi scene history for 193087879 272001006103 failed: {'code': 0, 'message': '成功', 'result': {'history': []}}
2024-09-01 12:29:41.718 WARNING (SyncWorker_3) [zhaquirks] Loaded custom quirks. Please contribute them to https://github.com/zigpy/zha-device-handlers
2024-09-01 12:36:06.224 WARNING (Recorder) [homeassistant.components.recorder.entity_registry] Cannot migrate history for entity_id update.riego_auto_firmware to update.riego_firmware because the new entity_id is already in use
2024-09-01 12:36:17.009 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry Juanita for xiaomi_miio
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 604, in async_setup
result = await component.async_setup_entry(hass, self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/xiaomi_miio/init.py", line 135, in async_setup_entry
or await async_setup_device_entry(hass, entry)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/xiaomi_miio/init.py", line 468, in async_setup_device_entry
await async_create_miio_device_and_coordinator(hass, entry)
File "/usr/src/homeassistant/homeassistant/components/xiaomi_miio/init.py", line 395, in async_create_miio_device_and_coordinator
await coordinator.async_config_entry_first_refresh()
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 281, in async_config_entry_first_refresh
await self._async_refresh(
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 354, in _async_refresh
self.data = await self._async_update_data()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 271, in _async_update_data
return await self.update_method()
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/xiaomi_miio/init.py", line 272, in update_async
return await execute_update()
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/xiaomi_miio/init.py", line 267, in execute_update
state = await hass.async_add_executor_job(update)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
asyncio.exceptions.CancelledError: Home Assistant is stopping
2024-09-01 12:36:19.502 WARNING (Thread-11 (_do_shutdown)) [homeassistant.util.executor] Thread[SyncWorker_21] is still running at shutdown: File "/usr/local/lib/python3.12/threading.py", line 1030, in _bootstrap
self._bootstrap_inner()
File "/usr/local/lib/python3.12/threading.py", line 1073, in _bootstrap_inner
self.run()
File "/usr/local/lib/python3.12/threading.py", line 1010, in run
self._target(*self._args, **self._kwargs)
File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 92, in _worker
work_item.run()
File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/src/homeassistant/homeassistant/components/xiaomi_miio/init.py", line 249, in update
fan_speeds = device.fan_speed_presets()
File "/usr/local/lib/python3.12/site-packages/miio/click_common.py", line 183, in _wrap
self._fetch_info()
File "/usr/local/lib/python3.12/site-packages/miio/integrations/vacuum/roborock/vacuum.py", line 260, in _fetch_info
info = super()._fetch_info()
File "/usr/local/lib/python3.12/site-packages/miio/device.py", line 153, in _fetch_info
devinfo = DeviceInfo(self.send("miIO.info"))
File "/usr/local/lib/python3.12/site-packages/miio/device.py", line 107, in send
return self._protocol.send(
File "/usr/local/lib/python3.12/site-packages/miio/miioprotocol.py", line 161, in send
self.send_handshake()
File "/usr/local/lib/python3.12/site-packages/miio/miioprotocol.py", line 65, in send_handshake
m = MiIOProtocol.discover(self.ip)
File "/usr/local/lib/python3.12/site-packages/miio/miioprotocol.py", line 119, in discover
data, recv_addr = s.recvfrom(1024)
2024-09-01 12:36:19.899 ERROR (MainThread) [homeassistant.components.ezviz.coordinator] Unexpected error fetching ezviz data
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 354, in _async_refresh
self.data = await self._async_update_data()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/ezviz/coordinator.py", line 42, in _async_update_data
return await self.hass.async_add_executor_job(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/core.py", line 878, in async_add_executor_job
task = self.loop.run_in_executor(None, target, *args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/asyncio/base_events.py", line 856, in run_in_executor
self._check_default_executor()
File "/usr/local/lib/python3.12/asyncio/base_events.py", line 545, in _check_default_executor
raise RuntimeError('Executor shutdown has been called')
RuntimeError: Executor shutdown has been called
2024-09-01 12:36:20.501 WARNING (Thread-11 (_do_shutdown)) [homeassistant.util.executor] Thread[SyncWorker_21] is still running at shutdown: File "/usr/local/lib/python3.12/threading.py", line 1030, in _bootstrap
self._bootstrap_inner()
File "/usr/local/lib/python3.12/threading.py", line 1073, in _bootstrap_inner
self.run()
File "/usr/local/lib/python3.12/threading.py", line 1010, in run
self._target(*self._args, **self._kwargs)
File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 92, in _worker
work_item.run()
File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/src/homeassistant/homeassistant/components/xiaomi_miio/init.py", line 249, in update
fan_speeds = device.fan_speed_presets()
File "/usr/local/lib/python3.12/site-packages/miio/click_common.py", line 183, in _wrap
self._fetch_info()
File "/usr/local/lib/python3.12/site-packages/miio/integrations/vacuum/roborock/vacuum.py", line 260, in _fetch_info
info = super()._fetch_info()
File "/usr/local/lib/python3.12/site-packages/miio/device.py", line 153, in _fetch_info
devinfo = DeviceInfo(self.send("miIO.info"))
File "/usr/local/lib/python3.12/site-packages/miio/device.py", line 107, in send
return self._protocol.send(
File "/usr/local/lib/python3.12/site-packages/miio/miioprotocol.py", line 161, in send
self.send_handshake()
File "/usr/local/lib/python3.12/site-packages/miio/miioprotocol.py", line 65, in send_handshake
m = MiIOProtocol.discover(self.ip)
File "/usr/local/lib/python3.12/site-packages/miio/miioprotocol.py", line 119, in discover
data, recv_addr = s.recvfrom(1024)
`

@zaratustraelimpio
Copy link

Hi,

I have decided to return the device. Mine is this one:

Screenshot_2024-09-01-13-50-09-437_com alibaba aliexpresshd

maybe it is a different model or there is something that is causing this problem, so I am going to buy the one from the link on your website and I will try it, to see if I can get it to work...

@zaratustraelimpio
Copy link

Hi,

I bought the device from your link (https://es.aliexpress.com/item/1005007314262302.html?aff_fcid=827a1992be684615b51f8b4c46aa4c6f-1725782864569-00173-_DmIrhDD&tt=CPS_NORMAL&aff_fsk=_DmIrhDD&aff_platform=shareComponent-detail&sk=_DmIrhDD&aff_trace_key=827a1992be684615b51f8b4c46aa4c6f-1725782864569-00173-_DmIrhDD&terminal_id=9863ad270f9c41b78137d8733f57b3a6&afSmartRedirect=y) and now when I try to pair it as a zigbee device in HA it doesn't do it, it doesn't find it. However, if I try to pair it with the Tuya app it does find it and works correctly... any ideas to solve this?,

thanks,

regards.

@moryoav
Copy link

moryoav commented Sep 8, 2024

Hi,

I bought the device from your link (https://es.aliexpress.com/item/1005007314262302.html?aff_fcid=827a1992be684615b51f8b4c46aa4c6f-1725782864569-00173-_DmIrhDD&tt=CPS_NORMAL&aff_fsk=_DmIrhDD&aff_platform=shareComponent-detail&sk=_DmIrhDD&aff_trace_key=827a1992be684615b51f8b4c46aa4c6f-1725782864569-00173-_DmIrhDD&terminal_id=9863ad270f9c41b78137d8733f57b3a6&afSmartRedirect=y) and now when I try to pair it as a zigbee device in HA it doesn't do it, it doesn't find it. However, if I try to pair it with the Tuya app it does find it and works correctly... any ideas to solve this?,

thanks,

regards.

How does it get paired with the Tuya app? The only way your Tuya app will be able to find it is if you have a Zigbee hub connected to the Tuya app, but for Zigbee to work in Home Assistant you need a Zigbee hub connected to Home Assistant. Do you have a Zigbee hub? Do you have other Zigbee devices that do work in Home Assistant?

@zaratustraelimpio
Copy link

How does it get paired with the Tuya app? The only way your Tuya app will be able to find it is if you have a Zigbee hub connected to the Tuya app, but for Zigbee to work in Home Assistant you need a Zigbee hub connected to Home Assistant. Do you have a Zigbee hub? Do you have other Zigbee devices that do work in Home Assistant?

Hi, yes, I have a zigbee hub, the sonoff (https://www.amazon.es/dp/B09KXTCMSC?ref=ppx_yo2ov_dt_b_fed_asin_title). No, I do not have another zigbee device connected to this hub,

thanks,

regards.

@moryoav
Copy link

moryoav commented Sep 8, 2024

How does it get paired with the Tuya app? The only way your Tuya app will be able to find it is if you have a Zigbee hub connected to the Tuya app, but for Zigbee to work in Home Assistant you need a Zigbee hub connected to Home Assistant. Do you have a Zigbee hub? Do you have other Zigbee devices that do work in Home Assistant?

Hi, yes, I have a zigbee hub, the sonoff (https://www.amazon.es/dp/B09KXTCMSC?ref=ppx_yo2ov_dt_b_fed_asin_title). No, I do not have another zigbee device connected to this hub,

thanks,

regards.

I don't understand how are you successfully pairing it with the Tuya App. Either you have a Zigbee hub that's connected to the Tuya app or you accidentally bought a Wifi irrigation valve and not zigbee.
If you have a Zigbee hub connected to Home Assistant, and you have the Zigbee Home Automation (ZHA) integration installed, and that integration has the Zigbee hub configured in it, then through the ZHA integration you can search for devices, click on that, put the valve in pairing mode by long pressing the button for a few seconds, and it'll be detected. Note that the Zigbee range isn't that great, if your Home Assistant computer + Zigbee Hub are far away from the valve then it won't find it, you'll need to build your Zigbee network first with Zigbee extenders.

@zaratustraelimpio
Copy link

How does it get paired with the Tuya app? The only way your Tuya app will be able to find it is if you have a Zigbee hub connected to the Tuya app, but for Zigbee to work in Home Assistant you need a Zigbee hub connected to Home Assistant. Do you have a Zigbee hub? Do you have other Zigbee devices that do work in Home Assistant?

Hi, yes, I have a zigbee hub, the sonoff (https://www.amazon.es/dp/B09KXTCMSC?ref=ppx_yo2ov_dt_b_fed_asin_title). No, I do not have another zigbee device connected to this hub,
thanks,
regards.

I don't understand how are you successfully pairing it with the Tuya App. Either you have a Zigbee hub that's connected to the Tuya app or you accidentally bought a Wifi irrigation valve and not zigbee. If you have a Zigbee hub connected to Home Assistant, and you have the Zigbee Home Automation (ZHA) integration installed, and that integration has the Zigbee hub configured in it, then through the ZHA integration you can search for devices, click on that, put the valve in pairing mode by long pressing the button for a few seconds, and it'll be detected. Note that the Zigbee range isn't that great, if your Home Assistant computer + Zigbee Hub are far away from the valve then it won't find it, you'll need to build your Zigbee network first with Zigbee extenders.

I have a tuya zigbee hub and I also have the sonoff hub connected to the Raspberry pi with HA. The irrigation valve is the one I bought from the purchase link on your website. Is it possible that they gave me a valve that is not zigbee and is only BT? My tuya hub supports both zigbee and BT, maybe that's why it is able to recognize it and the sonoff doesn't? There is only one purchase option and it says zigbee on the box but I don't understand it. When I try to pair the valve with my HA I have it close, 1 meter away, so I don't think this is the problem.

@moryoav
Copy link

moryoav commented Sep 8, 2024

How does it get paired with the Tuya app? The only way your Tuya app will be able to find it is if you have a Zigbee hub connected to the Tuya app, but for Zigbee to work in Home Assistant you need a Zigbee hub connected to Home Assistant. Do you have a Zigbee hub? Do you have other Zigbee devices that do work in Home Assistant?

Hi, yes, I have a zigbee hub, the sonoff (https://www.amazon.es/dp/B09KXTCMSC?ref=ppx_yo2ov_dt_b_fed_asin_title). No, I do not have another zigbee device connected to this hub,
thanks,
regards.

I don't understand how are you successfully pairing it with the Tuya App. Either you have a Zigbee hub that's connected to the Tuya app or you accidentally bought a Wifi irrigation valve and not zigbee. If you have a Zigbee hub connected to Home Assistant, and you have the Zigbee Home Automation (ZHA) integration installed, and that integration has the Zigbee hub configured in it, then through the ZHA integration you can search for devices, click on that, put the valve in pairing mode by long pressing the button for a few seconds, and it'll be detected. Note that the Zigbee range isn't that great, if your Home Assistant computer + Zigbee Hub are far away from the valve then it won't find it, you'll need to build your Zigbee network first with Zigbee extenders.

I have a tuya zigbee hub and I also have the sonoff hub connected to the Raspberry pi with HA. The irrigation valve is the one I bought from the purchase link on your website. Is it possible that they gave me a valve that is not zigbee and is only BT? My tuya hub supports both zigbee and BT, maybe that's why it is able to recognize it and the sonoff doesn't? There is only one purchase option and it says zigbee on the box but I don't understand it. When I try to pair the valve with my HA I have it close, 1 meter away, so I don't think this is the problem.

Since you say you do not have any other Zigbee devices connected to Home Assistant then I think the most logical thing to do now is to try to pair a different Zigbee device to Home Assistant. If it works then it's an issue with the valve, if it doesn't then it's an issue in Home Assistant.

@zaratustraelimpio
Copy link

How does it get paired with the Tuya app? The only way your Tuya app will be able to find it is if you have a Zigbee hub connected to the Tuya app, but for Zigbee to work in Home Assistant you need a Zigbee hub connected to Home Assistant. Do you have a Zigbee hub? Do you have other Zigbee devices that do work in Home Assistant?

Hi, yes, I have a zigbee hub, the sonoff (https://www.amazon.es/dp/B09KXTCMSC?ref=ppx_yo2ov_dt_b_fed_asin_title). No, I do not have another zigbee device connected to this hub,
thanks,
regards.

I don't understand how are you successfully pairing it with the Tuya App. Either you have a Zigbee hub that's connected to the Tuya app or you accidentally bought a Wifi irrigation valve and not zigbee. If you have a Zigbee hub connected to Home Assistant, and you have the Zigbee Home Automation (ZHA) integration installed, and that integration has the Zigbee hub configured in it, then through the ZHA integration you can search for devices, click on that, put the valve in pairing mode by long pressing the button for a few seconds, and it'll be detected. Note that the Zigbee range isn't that great, if your Home Assistant computer + Zigbee Hub are far away from the valve then it won't find it, you'll need to build your Zigbee network first with Zigbee extenders.

I have a tuya zigbee hub and I also have the sonoff hub connected to the Raspberry pi with HA. The irrigation valve is the one I bought from the purchase link on your website. Is it possible that they gave me a valve that is not zigbee and is only BT? My tuya hub supports both zigbee and BT, maybe that's why it is able to recognize it and the sonoff doesn't? There is only one purchase option and it says zigbee on the box but I don't understand it. When I try to pair the valve with my HA I have it close, 1 meter away, so I don't think this is the problem.

Since you say you do not have any other Zigbee devices connected to Home Assistant then I think the most logical thing to do now is to try to pair a different Zigbee device to Home Assistant. If it works then it's an issue with the valve, if it doesn't then it's an issue in Home Assistant.

Hi, ok I'm going to try to pair another zigbee device with ha to identify where the problem is,

thanks.

@zaratustraelimpio
Copy link

How does it get paired with the Tuya app? The only way your Tuya app will be able to find it is if you have a Zigbee hub connected to the Tuya app, but for Zigbee to work in Home Assistant you need a Zigbee hub connected to Home Assistant. Do you have a Zigbee hub? Do you have other Zigbee devices that do work in Home Assistant?

Hi, yes, I have a zigbee hub, the sonoff (https://www.amazon.es/dp/B09KXTCMSC?ref=ppx_yo2ov_dt_b_fed_asin_title). No, I do not have another zigbee device connected to this hub,
thanks,
regards.

I don't understand how are you successfully pairing it with the Tuya App. Either you have a Zigbee hub that's connected to the Tuya app or you accidentally bought a Wifi irrigation valve and not zigbee. If you have a Zigbee hub connected to Home Assistant, and you have the Zigbee Home Automation (ZHA) integration installed, and that integration has the Zigbee hub configured in it, then through the ZHA integration you can search for devices, click on that, put the valve in pairing mode by long pressing the button for a few seconds, and it'll be detected. Note that the Zigbee range isn't that great, if your Home Assistant computer + Zigbee Hub are far away from the valve then it won't find it, you'll need to build your Zigbee network first with Zigbee extenders.

I have a tuya zigbee hub and I also have the sonoff hub connected to the Raspberry pi with HA. The irrigation valve is the one I bought from the purchase link on your website. Is it possible that they gave me a valve that is not zigbee and is only BT? My tuya hub supports both zigbee and BT, maybe that's why it is able to recognize it and the sonoff doesn't? There is only one purchase option and it says zigbee on the box but I don't understand it. When I try to pair the valve with my HA I have it close, 1 meter away, so I don't think this is the problem.

Since you say you do not have any other Zigbee devices connected to Home Assistant then I think the most logical thing to do now is to try to pair a different Zigbee device to Home Assistant. If it works then it's an issue with the valve, if it doesn't then it's an issue in Home Assistant.

Hi,
you were right, there was a problem with the HA zigbee hub, I have deleted it and configured it again and it now detects the valve (maybe it is due to the recent HA update). Now it recognizes the valve and I can control it, with the previous one it seems that there is some problem because it is not compatible but with the one in the link on your website it works correctly :-) Now I have another problem, and it is that I think the zigbee network signal does not reach the garden where I have the valve. I understand that there must be a line between the devices so that they can be controlled, right? as shown in this image:

image

If there is no line between the two that connects it, it doesn't work, right?
I understand that I will have to buy signal repeaters, right? Any recommendations?

Thank you very much again for your help,

regards.

@moryoav
Copy link

moryoav commented Sep 8, 2024

Right, so your signal is just very weak. I think this could be an issue for many users, who put this irrigation valve outside of their homes, not realizing that Zigbee signal has trouble crossing through walls and such. I bought 6 units of these extenders:
https://s.click.aliexpress.com/e/_DF4BE1d
That work great for me. Just plug them with a USB adapter, like a phone charger, to sockets.
I had a bunch of these that I used:
https://s.click.aliexpress.com/e/_DFIKOsL

@zaratustraelimpio
Copy link

Right, so your signal is just very weak. I think this could be an issue for many users, who put this irrigation valve outside of their homes, not realizing that Zigbee signal has trouble crossing through walls and such. I bought 6 units of these extenders: https://s.click.aliexpress.com/e/_DF4BE1d That work great for me. Just plug them with a USB adapter, like a phone charger, to sockets. I had a bunch of these that I used: https://s.click.aliexpress.com/e/_DFIKOsL

Hi,
I see that the range is really very short, I'm going to have to buy several repeaters to try to get the signal to the garden because otherwise it won't work. On the other hand, the battery sensor doesn't work, it doesn't give me the value of the battery, is this normal? Is there a tool to see the topology of the zigbee network and refresh it? I'm trying to move the zigbee devices to see if the signal arrives and I see that it doesn't refresh,

thanks,

regards

@Hedda
Copy link
Contributor

Hedda commented Sep 11, 2024

Right, so your signal is just very weak. I think this could be an issue for many users, who put this irrigation valve outside of their homes, not realizing that Zigbee signal has trouble crossing through walls and such. I bought 6 units of these extenders:
https://s.click.aliexpress.com/e/_DF4BE1d

Warning! It is not recommended to buy any Tuya repeaters as they are infamously known to have bad firmware that do not always route all communcations and as such can act like a black-hole for some messages:

Instead suggest check out the dedicated Zigbee Router devices that are recommended in this thread:

@moryoav
Copy link

moryoav commented Sep 14, 2024

To do the zigbee Tuya valve community here... :), One of the issues I found, a bit rare but they do happen, is that the valve reports being on but it's not really on. To turn it on I end up turning it off and on again. Sometimes more than once. I suspect something in this quirk doesn't correctly report the actual status of the valve. To solve it, I found a solution I'm really happy about, placing vibration sensor on top of the valve and using an automation to detect with it if it's on or not, restart it if not.

These exact sensors:
https://s.click.aliexpress.com/e/_oDX9z5p

And the automation for it is here:
https://smarthome.yoavmor.com/home-assistant/ensuring-zigbee-valve-reliability-with-vibration-sensors-in-home-assistant/

@zaratustraelimpio
Copy link

Hi,

a perhaps silly question: are these valves installable via zigbee mqtt? or is it not possible?,

thanks,

regards.

@moryoav
Copy link

moryoav commented Sep 16, 2024

Hi,

a perhaps silly question: are these valves installable via zigbee mqtt? or is it not possible?,

thanks,

regards.

They're supposed to work also with zigbee2mqtt but with that you will probably need a different quirk than the one you find in this thread. I'm working with ZHA and I'm happy with it.

@coutadeurf
Copy link

These valves works out of the box in Z2M: this is the reason why I changed to Z2M (and because of 2 others devices that had better support in Z2M)

@Hedda
Copy link
Contributor

Hedda commented Sep 16, 2024

These valves works out of the box in Z2M: this is the reason why I changed to Z2M (and because of 2 others devices that had better support in Z2M)

For the record, they did not initially work ”out-of-the-box” with with Zigbee2MQTT, instead they work now because someone wrote a converter for zigbee-herdsman, and their converters are Z2M's equivalent to ZHA Device Handlers (quirks), both "parser" and ”translate”. Zigbee2MQTT might have a larger community that activly contributing such device handler quirks/converters ("parsers" / ”translators”) and therefore sometimes get them before ZHA. As both are free and open-source projects will probably considered in good faith posting here in this zigpy repository for ZHA Device Handlers trying to convince users to migrate to Zigbee2MQTT instead, which can possible make ZHA community grown even less. Regardless, just recommending people to abandon ZHA and instead use Zigbee2MQTT is the opposite to contributing and is off-topic for this ZHA Device Handler (zha quirk) repository. That approach will cause brain-drain in the long run. Personally I would think that all Home Assistant users would want to help improve ZHA for everyone as it is the native Zigbee Gateway that is built-into Home Assistant as the official default. If you are not willing to actively help the community fix the ZHA shortcomming then at least not try to convince other users to simply stop using it.

@coutadeurf
Copy link

These valves works out of the box in Z2M: this is the reason why I changed to Z2M (and because of 2 others devices that had better support in Z2M)

For the record, they did not initially work ”out-of-the-box” with with Zigbee2MQTT, instead they work now because someone wrote a converter for zigbee-herdsman, and converters is their equivalent to ZHA Device Handlers (quirks), both acts as ”translators”. Zigbee2MQTT might have a larger community that activly contributing such ”translators” and therefor sometimes get them before ZHA. As both are free and open-source projects will probably considered in good faith posting here in this zigpy repository for ZHA Device Handlers trying to convince users to migrate to Zigbee2MQTT instead, which can possible make ZHA community grown even less. Regardless, just recommending people to use Zigbee2MQTT is the opposite to contributing and is off-topic for this ZHA Device Handler (zha quirk) repository.

You're right and this was not my intention. Sorry for that. I tried to delete my comment but it seems to be bugged

@zaratustraelimpio
Copy link

Hi,

I have finally managed to get the irrigation valve to work correctly through both ZHA and Z2M, using another coordinator, the SMLIGHT SLZB-06p7, whose range is greater, without the need for repeaters, thank you very much to everyone for the help and especially to @moryoav.
I have another question about local zigbee in HA: is it possible to migrate all the zigbee devices that I have in the Tuya cloud to ZHA, and once this is done be able to continue controlling these devices by voice with my Google Home voice assistant? Currently I also have them associated with Google Home with the integration it has with Tuya, but if I delete them from Tuya, I will no longer be able to manage them with Google Home, right? Would there be a solution to not lose this functionality other than having to create scripts one by one for each of these devices?

thanks,

regards

@moryoav
Copy link

moryoav commented Sep 17, 2024

You will not be able to do it like that, once you pair a device with zha, it'll get disconnected from smartlife, a device can't have a link to two hubs. What you need to do is move everything to zha by repairing all of them, then install the integration for emulated hue, Google it, and through that expose all your devices, I'm using Alexa, that's how I do it, don't know if it works the same with Google home. Alternatively, get a subscription to Nabu Casa cloud and it'll allow you to control your home with Google home as well.

@yulasinio
Copy link

Hi all,

Are there any plans on supporting this valve natively in HA? Is there anything we can do to help getting it fully integrated?
Currently using the quirk but it doesn't have the ability to change the default 1 minute ON setting. I'm no coder but I can help testing/validating code if needed.

Thanks,
Julian

@moryoav
Copy link

moryoav commented Oct 6, 2024

Hi all,

Are there any plans on supporting this valve natively in HA? Is there anything we can do to help getting it fully integrated? Currently using the quirk but it doesn't have the ability to change the default 1 minute ON setting. I'm no coder but I can help testing/validating code if needed.

Thanks, Julian

You can bypass the 1 minute default setting, either manually or with an easy automation. It's explained here:
https://smarthome.yoavmor.com/zigbee/bypassing-the-zigbee-irrigation-valves-internal-shutdown-timer/
obviously would have been better had it been a part of the device settings itself, but I also have no idea how to do that...

@PMSQuintas
Copy link

Does anyone know if is possible to add the summation sensor (sensor.ts0049_summation_delivered) to this device?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Tuya Request/PR regarding a Tuya device
Projects
None yet
Development

Successfully merging a pull request may close this issue.