rospogrigio / localtuya

local handling for Tuya devices
GNU General Public License v3.0
2.93k stars 563 forks source link

Problem Diivoo-Sprinkler-Timer- #1327

Open maury77 opened 1 year ago

maury77 commented 1 year ago

The problem

I try to connect device WiFi Water Timer 2 Zone for Garden

https://www.amazon.com/Diivoo-Sprinkler-Timer-WT-03W-Bluetooth/dp/B0B4HG71X8/ref=sr_1_9?keywords=diivoo&qid=1678399147&sprefix=diivoo%2Caps%2C438&sr=8-9

 "xxxxxx": {
    "active_time": 1678016527,
    "biz_type": 18,
    "category": "ggq",
    "create_time": 1678016527,
    "icon": "smart/icon/ay1547018215107OLzeG/9e86c5dd3434c7a966ae5c8bc2ab8c0b.png",
    "id": "xxxxx",
    "ip": "",
    "lat": "44.7151",
    "local_key": "f66...064",
    "lon": "8.2985",
    "model": "WT-05",
    "name": "Irrigatore",
    "node_id": "700c99823e2d86f9",
    "online": true,
    "owner_id": "2549584",
    "product_id": "fdrbxxbg",
    "product_name": "Diivoo smart dual water timer",
    "status": [
      {
        "code": "battery_percentage",
        "value": 100
      },
      {
        "code": "normal_timer",
        "value": "AA=="
      },
      {
        "code": "countdown_2",
        "value": 0
      },
      {
        "code": "switch_2",
        "value": false
      },
      {
        "code": "switch_1",
        "value": false
      },
      {
        "code": "countdown_1",
        "value": 0
      },
      {
        "code": "use_time_2",
        "value": 11
      },
      {
        "code": "use_time_1",
        "value": 180
      }
    ],
    "sub": true,
    "time_zone": "+01:00",
    "uid": "xxxxx",
    "update_time": 1678050832,
    "uuid": "xxxx"
  },

Environment

Home Assistnat 2023.3.1 con dietpi distribtuon

Steps to reproduce

I try to add a new device from

image

image

image

DP dump

mar 09 22:56:28 sdomotica Home Assistant[3888]: 2023-03-09 22:56:28.300 WARNING (MainThread) [custom_components.localtuya.pytuya] [bf5...8mj] Command 13 timed out waiting for sequence number 11619 mar 09 22:56:28 sdomotica Home Assistant[3888]: 2023-03-09 22:56:28.304 ERROR (MainThread) [custom_components.localtuya.pytuya] [bf5...8mj] Failed to get status: mar 09 22:56:28 sdomotica Home Assistant[3888]: Traceback (most recent call last): mar 09 22:56:28 sdomotica Home Assistant[3888]: File "/home/homeassistant/.pyenv/versions/3.10.9/lib/python3.10/asyncio/locks.py", line 390, in acquire mar 09 22:56:28 sdomotica Home Assistant[3888]: await fut mar 09 22:56:28 sdomotica Home Assistant[3888]: asyncio.exceptions.CancelledError mar 09 22:56:28 sdomotica Home Assistant[3888]: During handling of the above exception, another exception occurred: mar 09 22:56:28 sdomotica Home Assistant[3888]: Traceback (most recent call last): mar 09 22:56:28 sdomotica Home Assistant[3888]: File "/home/homeassistant/.pyenv/versions/3.10.9/lib/python3.10/asyncio/tasks.py", line 456, in wait_for mar 09 22:56:28 sdomotica Home Assistant[3888]: return fut.result() mar 09 22:56:28 sdomotica Home Assistant[3888]: asyncio.exceptions.CancelledError mar 09 22:56:28 sdomotica Home Assistant[3888]: The above exception was the direct cause of the following exception: mar 09 22:56:28 sdomotica Home Assistant[3888]: Traceback (most recent call last): mar 09 22:56:28 sdomotica Home Assistant[3888]: File "/mnt/dietpi_userdata/homeassistant/custom_components/localtuya/pytuya/init.py", line 863, in detect_available_dps mar 09 22:56:28 sdomotica Home Assistant[3888]: data = await self.status() mar 09 22:56:28 sdomotica Home Assistant[3888]: File "/mnt/dietpi_userdata/homeassistant/custom_components/localtuya/pytuya/init.py", line 795, in status mar 09 22:56:28 sdomotica Home Assistant[3888]: status = await self.exchange(DP_QUERY) mar 09 22:56:28 sdomotica Home Assistant[3888]: File "/mnt/dietpi_userdata/homeassistant/custom_components/localtuya/pytuya/init.py", line 790, in exchange mar 09 22:56:28 sdomotica Home Assistant[3888]: return await self.exchange(command, dps) mar 09 22:56:28 sdomotica Home Assistant[3888]: File "/mnt/dietpi_userdata/homeassistant/custom_components/localtuya/pytuya/init.py", line 769, in exchange mar 09 22:56:28 sdomotica Home Assistant[3888]: msg = await self.dispatcher.wait_for(seqno, payload.cmd) mar 09 22:56:28 sdomotica Home Assistant[3888]: File "/mnt/dietpi_userdata/homeassistant/custom_components/localtuya/pytuya/init.py", line 450, in wait_for mar 09 22:56:28 sdomotica Home Assistant[3888]: await asyncio.wait_for(self.listeners[seqno].acquire(), timeout=timeout) mar 09 22:56:28 sdomotica Home Assistant[3888]: File "/home/homeassistant/.pyenv/versions/3.10.9/lib/python3.10/asyncio/tasks.py", line 458, in wait_for mar 09 22:56:28 sdomotica Home Assistant[3888]: raise exceptions.TimeoutError() from exc mar 09 22:56:28 sdomotica Home Assistant[3888]: asyncio.exceptions.TimeoutError mar 09 22:56:40 sdomotica Home Assistant[3888]: 2023-03-09 22:56:40.025 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved mar 09 22:56:40 sdomotica Home Assistant[3888]: Traceback (most recent call last): mar 09 22:56:40 sdomotica Home Assistant[3888]: File "/home/homeassistant/.pyenv/versions/3.10.9/lib/python3.10/site-packages/homeassistant/helpers/update_coordinator.py", line 182, in _handle_refresh_interval mar 09 22:56:40 sdomotica Home Assistant[3888]: await self._async_refresh(log_failures=True, scheduled=True) mar 09 22:56:40 sdomotica Home Assistant[3888]: File "/home/homeassistant/.pyenv/versions/3.10.9/lib/python3.10/site-packages/homeassistant/helpers/update_coordinator.py", line 330, in _async_refresh mar 09 22:56:40 sdomotica Home Assistant[3888]: self.async_update_listeners() mar 09 22:56:40 sdomotica Home Assistant[3888]: File "/home/homeassistant/.pyenv/versions/3.10.9/lib/python3.10/site-packages/homeassistant/helpers/update_coordinator.py", line 135, in async_update_listeners mar 09 22:56:40 sdomotica Home Assistant[3888]: update_callback() mar 09 22:56:40 sdomotica Home Assistant[3888]: File "/mnt/dietpi_userdata/homeassistant/custom_components/hon/sensor.py", line 708, in _handle_coordinator_update mar 09 22:56:40 sdomotica Home Assistant[3888]: self._on = json["onOffStatus"]["parNewVal"] == "1" mar 09 22:56:40 sdomotica Home Assistant[3888]: KeyError: 'onOffStatus' mar 09 22:56:45 sdomotica Home Assistant[3888]: 2023-03-09 22:56:45.316 WARNING (MainThread)

capsel22 commented 1 year ago

Same issue "Connection to device succeeded but no datapoints found, please try again. Create a new issue and include debug logs if problem persists."

ThePirat91 commented 5 months ago

Hello, any news on this? Tks

andrus2049 commented 5 months ago

I have this exact sprinkler valve. But I use the https://github.com/xZetsubou/hass-localtuya

Switching your devices from rospogrigio's is transparent, no reconfiguration needed.

Follow the instruction for adding this device (Id, key, etc.), but of course you need these data from the Tuya IoT platform (register there as a developer) The critical point is when adding the subdevice (the bluetooth valve): follow the instruction or ask when you have the data from the IoT platform.

I have a template that can be used with that integration, with the most important settings preloaded. Copy the following content to a template file .yaml. and if needed ask here where to put the file and how to use it once you have that integration installed.

- switch:
    device_class: switch
    entity_category: None
    friendly_name: switch
    id: '1'
    is_passive_entity: false
    platform: switch
    restore_on_reconnect: false
- sensor:
    device_class: battery
    entity_category: diagnostic
    friendly_name: battery
    id: '7'
    platform: sensor
    unit_of_measurement: '%'
- number:
    device_class: duration
    entity_category: config
    friendly_name: duration
    id: '11'
    is_passive_entity: false
    max_value: 86400.0
    min_value: 0.0
    platform: number
    restore_on_reconnect: false
    step_size: 1.0
    unit_of_measurement: sec
- sensor:
    entity_category: diagnostic
    friendly_name: mode
    id: '12'
    platform: sensor
andrus2049 commented 5 months ago

See:

https://github.com/home-assistant/core/issues/72029

capsel22 commented 5 months ago

I was able to add it using the new Tuya integration built-in image

andrus2049 commented 5 months ago

Nice, but consider that the HA Tuya integration uses the cloud and requires a valid account and a permanent internet connection.

The problem for users here of the rospogrigio's localtuya integration (and others similar) is that they wish to use only true local connections to the tuya devices.