Holman WiFi Tap timers intergration?

or… I could just not be lazy, doesnt look too hard

hmmm so cloud Tuya could work, but the cloud integration doesnt support WX1/2??

That’s how I understand it yes…

There must be an Australian plug version… I seem to remember seeing the BHyve in Bunnings before (and it’s listed on their website).

or… I could just not be lazy, doesnt look too hard

It needs to work for you, whichever way you go.

I had this issue too - currently have 3 x WX1’s on a single gateway. Not sure if this is best practice, though I wanted to get into HA dev so I forked the main localtuya and implemented darek’s additions for CID. I found where the issue was where data for the other hub connected devices were being overwritten when another CID was polled.

See my screenshot below and the independent values. This also doesn’t use configurations.yaml to add the devices and entities and can be done through the flows. If you use my fork, follow this readme

GitHub - NeriedAU/localtuya: local handling for Tuya devices is my fork.
Oh, there is also an issue that I haven’t looked into yet that seems to occur with more than 3 devices connected to the hub - note I haven’t got the power socket (on the gateway hub) added. As soon as I did that, one of the other devices becomes unavailable.

Another edit. Just fitted my 3rd WX1 - I’m really happy with these devices. Yeah, probably should have gone with another system like WX2 or WX8. Still many more taps I want to wire up. Now that I’ve fixed the overwriting data, I’ve got an automation that turns the next system on when the first is finished - the left most two are for my lawn watering system but don’t have enough pressure to run together or on one system.

3 Likes

ok so… massive issues with the BHyve - as soon as its done testing the manual watering both devices disconnect on the mobile app. Integration on HA doesnt even have a simple on/off for manual watering like I wanted. so ill be taking this back to Bunnings and going with the WX1… will see how I go


Just for reference - I snapped a pic of the B-Hyve while I was on the Bunnings sprinkler aisle the other day.

Also, while searching for this post I came across another B-Hyve thread that may relate to your issue - about the integration failing if the system isn’t already fully working before connecting to HA? I’ll post in response to the relevant comment.

Perhaps this may be relevant?

Recommend the WX1 mate. I’m thoroughly impressed with them, but that could just be my use case. Bit of mucking about to get them up and running in Tuya and then localtuya in HA. Issue I have at the moment is more than 3 devices on the one gateway will cause one to become unavailable. That’s on my to do list to look into - debug showing it just fails to connect.

Hello everyone,

Thanks for all the great information!
I have a WX2 but I cannot get the tap to actually switch on from HA (Works fine from Tuya app)
I linked entity 108 up as a switch in LocalTuya (When the tap is off it seems to be true, but I think this is because it is linked to the countdown timer?). When I toggle it in HA, it switches to the ‘off’ state for about 3 seconds then goes back to ‘on’ but the physical tap never actually does anything. It’s almost like HA only has read-only access to the device.

I had to set it up in the UI as LocalTuya does not support config.yaml any more, annoyingly.

If I switch it on or off via the LocalTuya app it all works as expected and HA reflects the correct statuses, flows, etc.

If it makes any difference, I had to add the device manually - i.e. LocalTuya did not discover it on my network.

Any advice appreciated

Yeh the switch state is negated so Irrigation tap (108) = true is Irrigation status (106) = 0.

What localtuya fork are you using?

  • This fork by darek-margas has the original and initial implementation of the Holman WX1/WX2 support for localtuya via the configuration.yaml.
  • My fork here takes darek’s work and aligns it with latest localtuya repo and supports the HA config flow to add subdevices with cid. Also fixes a bug with data overwriting across multiple hub connected devices. If you use this, follow this readme
  • Or are you using the rospogrigio/localtuya fork? This one won’t work as it doesn’t support cid

Another thing I’ve found is that if you have the localtuya app open, it won’t work in HA.
If you’ve updated to my fork from darek’s, make sure you remove the localtuya section from configuration.yaml as it still picks it up I’ve found.

Last thing to try is adding

logger:
  default: warning
  logs:
    custom_components.localtuya: debug

to your configuration.yaml, restarting HA, toggling the switch (108) and seeing what the output is in home-assistant.log

Ahhhh! I am using the rospogrigio fork - that explains it :slight_smile:

Thanks! That’s given me a little task for this evening :slight_smile:

@NeriedAU great job on the fork! Your post got me to pull my finger out and switch to yours to get to v4. Your setup is great, that’s roughly what I am working towards, but I think I might go for a WX2 and a WX1 noting the limit of three sub-devices per gateway.

Thanks! Had some time over Christmas break to pull my own finger out and get into the code a bit. Has been on my todo list forever to get a dev environment going to play around with some integrations.

Yeh, the WX2 is looking pretty appealing. I may grab one of them as well.

Ok Guys,

I’ve tried to revisit this intergration again… (Especially with the recent comments above)
However i cannot for the life of me get the Intergration to work with @NeriedAU 's fork?

Everytime i add the Device via Web everything just comes up unavailable?

Am i adding the correct device as the gateway? As with the WX2 setup there is 3 things listed all with seperate Device ID’s (I’ve tried The WX2 Tap Timer and the Wifi Hub)

My Debug Config

{
  "home_assistant": {
    "installation_type": "Home Assistant OS",
    "version": "2023.1.0",
    "dev": false,
    "hassio": true,
    "virtualenv": false,
    "python_version": "3.10.7",
    "docker": true,
    "arch": "x86_64",
    "timezone": "Australia/Perth",
    "os_name": "Linux",
    "os_version": "5.15.80",
    "supervisor": "2022.12.1",
    "host_os": "Home Assistant OS 9.4",
    "docker_version": "20.10.19",
    "chassis": "vm",
    "run_as_root": true
  },
  "custom_components": {
    "midea_ac": {
      "version": "0.2.3",
      "requirements": [
        "msmart==0.2.3",
        "pycryptodome",
        "pycryptodomex",
        "click"
      ]
    },
    "bhyve": {
      "version": "3.0.0",
      "requirements": []
    },
    "hacs": {
      "version": "1.29.0",
      "requirements": [
        "aiogithubapi>=22.10.1"
      ]
    },
    "smartthinq_sensors": {
      "version": "0.28.4",
      "requirements": [
        "pycountry>=20.7.3",
        "xmltodict>=0.12.0",
        "cchardet>=2.1.7"
      ]
    },
    "localtuya": {
      "version": "4.1.1",
      "requirements": []
    },
    "huawei_solar": {
      "version": "1.1.6",
      "requirements": [
        "huawei-solar==2.1.6"
      ]
    }
  },
  "integration_manifest": {
    "domain": "localtuya",
    "name": "LocalTuya integration",
    "version": "4.1.1",
    "documentation": "https://github.com/rospogrigio/localtuya/",
    "dependencies": [],
    "codeowners": [
      "@rospogrigio",
      "@postlund"
    ],
    "issue_tracker": "https://github.com/rospogrigio/localtuya/issues",
    "requirements": [],
    "config_flow": true,
    "iot_class": "local_push",
    "is_built_in": false
  },
  "data": {
    "device_config": {
      "friendly_name": "WX2 Tap Timer",
      "local_key": "BLAH",
      "host": "10.50.3.55",
      "device_id": "BLAH",
      "protocol_version": "3.3",
      "manual_dps_strings": "101,102,103,106,107,108,125,150,151,152,153,154,155",
      "model": "Wi-Fi Hub",
      "dps_strings": [
        "101 (value: -1)",
        "102 (value: -1)",
        "103 (value: -1)",
        "106 (value: -1)",
        "107 (value: -1)",
        "108 (value: -1)",
        "125 (value: -1)",
        "150 (value: -1)",
        "151 (value: -1)",
        "152 (value: -1)",
        "153 (value: -1)",
        "154 (value: -1)",
        "155 (value: -1)"
      ],
      "entities": [
        {
          "id": 101,
          "friendly_name": "WX2 Zone 1 Soil Temperature",
          "unit_of_measurement": "\u00b0C",
          "device_class": "temperature",
          "platform": "sensor"
        },
        {
          "id": 102,
          "friendly_name": "WX2 Zone 1 Soil Moisture",
          "unit_of_measurement": "%",
          "device_class": "humidity",
          "platform": "sensor"
        },
        {
          "id": 103,
          "friendly_name": "WX2 Zone 1 Water spent",
          "unit_of_measurement": "litres",
          "platform": "sensor"
        },
        {
          "id": 106,
          "friendly_name": "WX2 Zone 1 Irrigation status",
          "platform": "sensor"
        },
        {
          "id": 107,
          "friendly_name": "WX2 Zone 1 Countdown Minutes",
          "min_value": 0.0,
          "max_value": 60.0,
          "step_size": 1.0,
          "restore_on_reconnect": false,
          "is_passive_entity": false,
          "platform": "number"
        },
        {
          "id": 108,
          "friendly_name": "WX2 Zone 1 Irrigation Tap (negated)",
          "restore_on_reconnect": false,
          "is_passive_entity": false,
          "platform": "switch"
        },
        {
          "id": 125,
          "friendly_name": "WX2 Zone 1 Postponed due to moisture",
          "state_on": "True",
          "state_off": "False",
          "platform": "binary_sensor"
        },
        {
          "id": 150,
          "friendly_name": "WX2 Zone 2 Soil Temperature",
          "unit_of_measurement": "\u00b0C",
          "device_class": "temperature",
          "platform": "sensor"
        },
        {
          "id": 151,
          "friendly_name": "WX2 Zone 2 Soil Moisture",
          "unit_of_measurement": "%",
          "device_class": "humidity",
          "platform": "sensor"
        },
        {
          "id": 152,
          "friendly_name": "WX2 Zone 2 Water Spent",
          "unit_of_measurement": "litres",
          "platform": "sensor"
        },
        {
          "id": 153,
          "friendly_name": "WX2 Zone 2 Irrigation status",
          "platform": "sensor"
        },
        {
          "id": 154,
          "friendly_name": "WX2 Zone 2 Tap Countdown Minutes",
          "min_value": 0.0,
          "max_value": 60.0,
          "step_size": 1.0,
          "restore_on_reconnect": false,
          "is_passive_entity": false,
          "platform": "number"
        },
        {
          "id": 155,
          "friendly_name": "WX2 Zone 2 Irrigation Tap (negated)",
          "restore_on_reconnect": false,
          "is_passive_entity": false,
          "platform": "switch"
        }
      ],
      "product_key": ""BLAH","
    },
    "device_cloud_info": {
      "active_time": 1643170531,
      "biz_type": 0,
      "category": "wg2",
      "create_time": 1643169319,
      "icon": "smart/icon/ay1556838860681oKmdO/e47c08d07b3801b3ea8890b3f548bc7f.png",
      "id": ""BLAH",",
      "ip": ""BLAH",",
      "lat": "-30.7702",
      "local_key": "BLAH",
      "lon": "121.4872",
      "model": "EMateGateWay",
      "name": "Wi-Fi Hub",
      "online": true,
      "owner_id": "11662001",
      "product_id": "lzjw7vgzngzrzy74",
      "product_name": "Wi-Fi Hub",
      "status": [],
      "sub": false,
      "time_zone": "+08:00",
      "uid": "BLAH",
      "update_time": 1654402954,
      "uuid": "BLAH"
    }
  }
}

Hey mate, just to confirm that the local_key you are using is the gateway’s local_key (bd03bfe66449#### that you posted earlier) and the device_id is the cid (851)? Sorry if that was suck eggs.

Config looks good at a glance. Could you chuck this into your configuration.yaml and reload it then watch your home-assistant.log. It should indicate where the issue is if its not connecting, or decoding the data etc.

logger:
  default: warning
  logs:
    custom_components.localtuya: debug

Should see stuff like this:

2023-01-05 08:23:10.323 DEBUG (MainThread) [custom_components.localtuya.common] [9CB...9CB] Connecting to 192.168.1.242
2023-01-05 08:23:10.334 DEBUG (MainThread) [custom_components.localtuya.common] [9CB...9CB] Retrieving initial state
2023-01-05 08:23:10.335 DEBUG (MainThread) [custom_components.localtuya.pytuya] [9CB...9CB] Sending command status (device type: type_0a)
2023-01-05 08:23:10.335 DEBUG (MainThread) [custom_components.localtuya.pytuya] [9CB...9CB] Send payload: b'{"gwId":"9CB","devId":"9CB","cid":"9CB"}'
2023-01-05 08:23:10.337 DEBUG (MainThread) [custom_components.localtuya.pytuya] [9CB...9CB] Waiting for sequence number 0
2023-01-05 08:23:10.346 DEBUG (MainThread) [custom_components.localtuya.pytuya] [9CB...9CB] Dispatching message TuyaMessage(seqno=0, cmd=10, retcode=0, payload=b'0(Y-.........

Few other things to suss out:

  • Do you have anything else connecting to the hub (not subdevices) like the Tuya app. It only supports one connection. I.e. I have my main home assistant system and it had the localtuya integration running and connected to my hub. Couldn’t figure out for the life of me why I wasn’t able to get anything with tuya-cli get … or why I was getting unavailable status (like you have now) on everything in my dev environment. Disabled the integration on my main HA and proved that.
  • Disable the integration in HA (Settings > Devices & Services). From tuya-cli can you switch your Wifi socket (cid 85B) on/off?
DEBUG=* tuya-cli set --ip "192.168.1.242" --id "gateway_id" --key "gateway_local_key" --cid "9CB" --dps 1 --set false (or true) --protocol-version 3.3

If above works, then I don’t think it’s network security related like firewall? Try:

  • Restart HA? :expressionless: gets me sometimes.
  • Did you have Darek’s fork? Did you:
    • Remove localtuya config from configuration.xaml?
    • Remove his fork from HACS, add mine and “Download” it via HACS? Again, suck eggs but its more often than not something small and dumb… I may have found this out the hard way. If you had this prompt, then you’re good. (I uncheck the "Do not configure Cloud API Account)

Hope something here works for you.

The comment here about the device_id being the CID made all the difference. Managed to get it working. Thanks.

AHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH

Yes - I was putting the Device Key Number from Tuya… (Not the CID 851)
Now it all works! Yay thanks

Thanks for the fork and work on this, NeriedAU.

One small issue, my WX1 switch appears to be reversed! The “Irrigation Tap (negated)” is on when there’s no water following, and off when there is water flowing. Has anyone come across this and fixed it?

1 Like

It is supposed to be like that because the switch is “Negated”

All i did was create a template and made another switch to swap it around…

switch:
  - platform: template
    switches:
      wx2_zone_1_irrigation_tap:
        value_template: "{{ not is_state('switch.wx2_zone_1_irrigation_tap_negated', 'on') }}"
        turn_on:
          service: switch.turn_off
          entity_id: switch.wx2_zone_1_irrigation_tap_negated
        turn_off:
          service: switch.turn_on
          entity_id: switch.wx2_zone_1_irrigation_tap_negated
      wx2_zone_2_irrigation_tap:
        value_template: "{{ not is_state('switch.wx2_zone_2_irrigation_tap_negated', 'on') }}"
        turn_on:
          service: switch.turn_off
          entity_id: switch.wx2_zone_2_irrigation_tap_negated
        turn_off:
          service: switch.turn_on
          entity_id: switch.wx2_zone_2_irrigation_tap_negated

4 Likes

For completeness;

‘106’: ‘1’, // 1 when runs water, 0 when stopped, 2 when started by a Tyua app automation, 3 when stoped and time/rain delay active

1 Like