make-all / tuya-local

Local support for Tuya devices in Home Assistant
MIT License
1.28k stars 505 forks source link

Request support for GeyserWise WIFI geyser Timer #765

Closed McAllstar closed 1 year ago

McAllstar commented 1 year ago

Log Message

This error originated from a custom integration.

Logger: custom_components.tuya_local.device
Source: custom_components/tuya_local/device.py:81
Integration: Tuya Local (documentation, issues)
First occurred: 4:40:00 PM (2 occurrences)
Last logged: 4:40:31 PM

<class 'Exception'>: Unable to find device on network (specify IP address) while initialising device bfef070f306077e6e4pw83

Information about DPS mappings

curl  --request GET "https://openapi.tuyaeu.com/v1.1/devices/bfef070f306077e6e4pw83/specifications" --header "sign_method: HMAC-SHA256" --header "client_id: rp3jve4rh3qnwfys4ssk" --header "t: 1685976264787" --header "mode: cors" --header "Content-Type: application/json" --header "sign: 71186FD12CF89C988C665D7D3B55086A6F6F9F093344BD0DB3C69D859DC9032B" --header "access_token: 7a8a4d06485ea2310df8ddfee6392334" 

{ "result": { "category": "rs", "functions": [ { "code": "switch", "dp_id": 1, "type": "Boolean", "values": "{}" } ], "status": [ { "code": "switch", "dp_id": 1, "type": "Boolean", "values": "{}" }, { "code": "temp_current", "dp_id": 10, "type": "Integer", "values": "{\"unit\":\"℃\",\"min\":0,\"max\":125,\"scale\":0,\"step\":1}" }, { "code": "fault", "dp_id": 20, "type": "bitmap", "values": "{\"label\":[\"Earth_leakge\",\"Dry_burn\",\"Wt_sensor_fault\",\"Heating_loss\",\"Over_temp\",\"Water_leak\",\"Comm_failure\",\"Ct_probe_fault\",\"Pump_failure\"]}" } ] }, "success": true, "t": 1685976265137, "tid": "77521b7403af11eebfbfa24bf1d21c99" }

<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns="http://www.w3.org/TR/REC-html40">

DPID | Description | Example | Unit -- | -- | -- | -- 1 | Power | boolean | on/off 2 | Mode |   | 2 options? Normal/Holiday 10 | Geyser Temp. | 48℃ | ℃ 13 | Element | boolean | on/off 20 | Fault | - | - 101 | Pump | boolean | on/off 102 | Solar Differential | between 7 & 15 (slider) | ℃ 103 | Block1 | slider with selection between 30 & 75 | ℃ 103 | Block2 | slider with selection between 30 & 75 | ℃ 105 | Block3 | slider with selection between 30 & 75 | ℃ 106 | Block4 | slider with selection between 30 & 75 | ℃ 107 | Anti Freeze Temp | selection between 0 &10 (slider) | ℃ 108 | Collector | 51℃ | ℃

Product ID

ox9jyuavu5v78o2y

Information about how the device functions

McAllstar commented 1 year ago

here is a link to more info, it's used to control the hot water boiler or geyser (as we call it in South Africa.) for our showers/baths and hot water taps/ https://www.livestainable.co.za/product/geyserwise-tuya-module-tse-geyser-timer-and-controller/ https://youtu.be/O3Yk7HID7f4 https://community.home-assistant.io/t/geyserwise-wifi-module-integration-request/305103/20

make-all commented 1 year ago

Unable to find device on network (specify IP address)

This log message indicates that a connection to the device could not be made, but it is likely that it is only the Auto IP detection that is failing (having localtuya installed will do this) and specifying the IP address (which you can probably find in your router admin pages somewhere, or maybe even in the localtuya logs if you do have that installed) will work.

The log message that appears after the connection has been made is the one that is needed to gather info on what data is being sent in what format (which should mostly match the info you collected already, but it is good to be sure and may fill some gaps).

McAllstar commented 1 year ago

Thanks, I realised that they were on my guest network. It picks the controller up as one of the following.

make-all commented 1 year ago

The two comments you made via email seemed the same, so I deleted one, and also edited the other to remove all the previous comment quoting to make it clearer. But it seems something was missing (maybe stripped out by github's email processing).

McAllstar commented 1 year ago

Thanks and sorry about that. I think there was a screenshot so it got taken out. the options that were provided when it detected the device were as per the below image. The device I was trying to add is a water boiler or Geyser as we call it in South Africa. Is it possible to add that? displays the temp and has an option to toggle the water boilers on and off? image image

make-all commented 1 year ago

Can you include the log message you get after that first screenshot

Christiaan-Liebenberg commented 1 year ago

To @McAllstar, I was able to successfully integrate the Geyserwise Max Boiler / Geyser device with Tuya Local, It sounds like you're very close.

You need to add the Geyserwise device as a switch, then, edit it over and over adding the additional DPIDs (choosing the appropriate entity as per the table below:

image

I followed the article below which has 2 or 3 conversations going at the same time. I ignored any physical changes to the hardware, I was able to get everything working via software only.

In the same article you'll see mention of changing the instruction type in your Tuya Cloud project from 'Standard' to 'DP instruction'. If you do that, you can control temperatures for the geyser across multiple schedules as well.

Best of luck

https://community.home-assistant.io/t/geyserwise-wifi-module-integration-request/305103/112

McAllstar commented 1 year ago

Ah man what a legend, thanks so much. I’ll try figure it out and let you know.

make-all commented 1 year ago

I think @Christiaan-Liebenberg is not using tuya-local but localtuya. Those instructions sound like the steps for getting a device configured in localtuya, and the link is a mix of people using localtuya and reflashing the Tuya module with ESPHome (perhaps after soldering an ESP8066 module if the device comes with an RTL8710).

The steps to get it working in tuya-local will be to write a yaml config file for the device, and to do that, we need to collect some info first, some of which is already above, and some will be more obvious when we can see the log message referred to above.

Christiaan-Liebenberg commented 1 year ago

I think @Christiaan-Liebenberg is not using tuya-local but localtuya. Those instructions sound like the steps for getting a device configured in localtuya, and the link is a mix of people using localtuya and reflashing the Tuya module with ESPHome (perhaps after soldering an ESP8066 module if the device comes with an RTL8710).

The steps to get it working in tuya-local will be to write a yaml config file for the device, and to do that, we need to collect some info first, some of which is already above, and some will be more obvious when we can see the log message referred to above.

@make-all you are correct. I was able to get this working with LocalTuya...

I did a search for Geyserwise Max integration with Home Assistant and this post came up. After some more digging I was able to get the integration working albeit with TuyaLocal.

As the information online is so sparse for this use case specifically I wanted to answer this post to guide to resolution. Hopefully the information in the linked thread above helps in this regard.

My apologies for any confusion caused.

make-all commented 1 year ago

I think the only information missing is the exact strings used for mode. The original post said there are two modes, Normal and Holiday, and your post gives one of the strings: "Timer", hopefully seeing the other string will help to decode which one "Timer" is connected to.

McAllstar commented 1 year ago

Thanks for clearing that up. I’ll see if I can figure it out with the yaml etc.

mac-za commented 1 year ago

Hi

with respect to #1002, I'm not sure what extra info is required.

With respect to dp 2 the "Mode"; it has either Holiday or Normal as a status

I have included two screen shots

Thanks in advance

dp2 dp2 - pic 2

make-all commented 1 year ago

This looks like Cloud API documentation. Above there are links to forum posts, the only log I could find in there of local data had a value of "Timer", but there were others claiming "Normal" and "Holiday" or "normal" and "holiday".

To make this work, I need the exact strings used by the device in the local protocol, not just what the iot.tuya.com cloud API docs say.

mac-za commented 1 year ago

Hi

How would i go about extracting the exact strings?

I haven't thoroughly looked at the templates you have available, how would I go about adding a template (for Geyserwise) for testing purposes? Is it possible?

Thanks!

make-all commented 1 year ago

Since there are only 2 modes to figure out, it should be quite easy to start the process of adding the device using this integration in one mode, get up to the point where you "Choose the type of device", and cancel, switch modes using the app or other control method, and repeat the process. Each time you get up to the "Choose the type of device" step, there will be a warning level log message output to the Home Assistant log telling the closest imperfect match and the current dps values. The two messages together will give the remaining information that is needed.

make-all commented 1 year ago

Based on circumstantial evidence, I will go with "Timer" and "Holiday" for the mode values. If that is wrong, it can always be changed later.

0xa51f commented 1 year ago

Based on circumstantial evidence, I will go with "Timer" and "Holiday" for the mode values. If that is wrong, it can always be changed later.

The 2 modes are "Normal" and "Holiday" - see screenshot form Tuya app Screenshot_20230909_124251_Tuya Smart

make-all commented 1 year ago

I'm not interested in UI screenshots, I need the actual data from the device. Since nobody on this issue has sent any logs, I found one in the linked community.home-assistant.io thread, which had a value of "Timer". It is not unusual for protocol strings to differ from the UI like this. Based on someone who reportedly got this working on their own labelling the dp GW Timer Holiday (their table was included in a comment above), I assumed that Timer and Holiday are the two values used in the local protocol that correspond to Normal and Holiday in the app UI.

0xa51f commented 1 year ago

Apologies for misunderstanding - this is from the API Explorer > Device Control > Query Things Data Model

My Geyserwise is the TSE1 - slightly different from the Geyserwise MAX ( no Solar Collector as it uses PV and so does not have some of the DPs in the original post)


{
  "result": {
    "model": "{\"modelId\":\"000004bjgo\",\"services\":[{\"actions\":[],\"code\":\"\",\"description\":\"\",\"events\":[],\"name\":\"默认服务\",\"properties\":[
{\"abilityId\":1,\"accessMode\":\"rw\",\"code\":\"switch\",\"description\":\"\",\"extensions\":{\"iconName\":\"icon-dp_power2\",\"attribute\":\"1664\"},\"name\":\"Power\",\"typeSpec\":{\"type\":\"bool\",\"typeDefaultValue\":false}},
{\"abilityId\":2,\"accessMode\":\"rw\",\"code\":\"mode\",\"description\":\"\",\"extensions\":{\"iconName\":\"icon-dp_mode\",\"attribute\":\"1664\"},\"name\":\"Mode\",\"typeSpec\":{\"range\":[\"Holiday\",\"Timer\"],\"type\":\"enum\",\"typeDefaultValue\":\"Holiday\"}},
{\"abilityId\":10,\"accessMode\":\"ro\",\"code\":\"temp_current\",\"description\":\"water temp: 0-125\",\"extensions\":{\"iconName\":\"icon-dp_c\",\"attribute\":\"1152\"},\"name\":\"Temp Current\",\"typeSpec\":{\"max\":125,\"min\":0,\"scale\":0,\"step\":1,\"type\":\"value\",\"typeDefaultValue\":0,\"unit\":\"℃\"}},
{\"abilityId\":13,\"accessMode\":\"ro\",\"code\":\"work_state\",\"description\":\"\",\"extensions\":{\"iconName\":\"icon-zhuangtai\",\"attribute\":\"1152\"},\"name\":\"Element\",\"typeSpec\":{\"range\":[\"Off\",\"On\"],\"type\":\"enum\",\"typeDefaultValue\":\"Off\"}},
{\"abilityId\":20,\"accessMode\":\"ro\",\"code\":\"fault\",\"description\":\"\",\"extensions\":{\"iconName\":\"icon-baojing\",\"scope\":\"fault\",\"attribute\":\"1152\"},\"name\":\"Fault\",\"typeSpec\":{\"label\":[\"Earth_leakge\",\"Dry_burn\",\"Wt_sensor_fault\",\"Heating_loss\",\"Over_temp\",\"Water_leak\",\"Comm_failure\",\"Ct_probe_fault\",\"Pump_failure\"],\"maxlen\":9,\"type\":\"bitmap\",\"typeDefaultValue\":0}},
{\"abilityId\":101,\"accessMode\":\"ro\",\"code\":\"ptc_state\",\"description\":\"ptc on/off state\",\"name\":\"Ptc State\",\"typeSpec\":{\"range\":[\"Off\",\"On\"],\"type\":\"enum\",\"typeDefaultValue\":\"Off\"}},
{\"abilityId\":102,\"accessMode\":\"rw\",\"code\":\"ptc_temp_set\",\"description\":\"ptc heating settemp 50-75\",\"name\":\"Pv Temp Set\",\"typeSpec\":{\"max\":75,\"min\":50,\"scale\":0,\"step\":1,\"type\":\"value\",\"typeDefaultValue\":50,\"unit\":\"℃\"}},
{\"abilityId\":103,\"accessMode\":\"rw\",\"code\":\"Block1\",\"description\":\"00:00-6:00 set temp\",\"name\":\"Block1\",\"typeSpec\":{\"max\":75,\"min\":30,\"scale\":0,\"step\":1,\"type\":\"value\",\"typeDefaultValue\":30,\"unit\":\"℃\"}},
{\"abilityId\":104,\"accessMode\":\"rw\",\"code\":\"Block2\",\"description\":\"6:00-12:00 set temp\",\"name\":\"Block2\",\"typeSpec\":{\"max\":75,\"min\":30,\"scale\":0,\"step\":1,\"type\":\"value\",\"typeDefaultValue\":30,\"unit\":\"℃\"}},
{\"abilityId\":105,\"accessMode\":\"rw\",\"code\":\"Block3\",\"description\":\"12:00-18:00 set temp\",\"name\":\"Block3\",\"typeSpec\":{\"max\":75,\"min\":30,\"scale\":0,\"step\":1,\"type\":\"value\",\"typeDefaultValue\":30,\"unit\":\"℃\"}},
{\"abilityId\":106,\"accessMode\":\"rw\",\"code\":\"Block4\",\"description\":\"18:00-24:00 set temp\",\"name\":\"Block4\",\"typeSpec\":{\"max\":75,\"min\":30,\"scale\":0,\"step\":1,\"type\":\"value\",\"typeDefaultValue\":30,\"unit\":\"℃\"}}]}]}"
  },
  "success": true,
  "t": 1694257786832,
  "tid": "62c8744a4f0111eeb3f09e6a0abc163a"
}

Logs:

When Normal Mode Selected
Device matches cc_curtain with quality of 18%. DPS: {"updated_at": 1694258674.7262669, "1": false, "2": "Timer", "10": 61, "13": "Off", "20": 0, "101": "Off", "102": 60, "103": 50, "104": 50, "105": 55, "106": 50}

When Holiday Mode Selected
Device matches cc_curtain with quality of 18%. DPS: {"updated_at": 1694258796.2749264, "1": false, "2": "Holiday", "10": 61, "13": "Off", "20": 0, "101": "Off", "102": 60, "103": 50, "104": 50, "105": 55, "106": 50}
make-all commented 1 year ago

Thanks for that info. I have made some adjustments to the config based on that:

mac-za commented 1 year ago

Thanks for all the hard work.

I tried to add my Geyserwise Max, but it was not recognised. (

I opened the YAML file and found the following

I have confused myself and am unsure if the above number is one of the following:

I have the following for the Geyserwise max

if you could please offer your wisdom?

Thanks in advance

Kenneth

On Sat, 9 Sept 2023 at 15:02, Jason Rumney @.***> wrote:

Thanks for that info. I have made some adjustments to the config based on that:

  • dps above 106 marked as optional, as they are only available on the MAX.
  • Running sensors (dps 13, 101) changed from boolean to string, with values "Off" and "On"
  • "Pump" running sensor renamed to "Solar" so it is relevant to both models
  • Solar differential temperature renamed to Solar temperature, and range based on whether dp 108 is available, since the MAX wants a temperature difference between 7 and 15, while the TSE1 wants a target temperature between 50 and 75.

— Reply to this email directly, view it on GitHub https://github.com/make-all/tuya-local/issues/765#issuecomment-1712506564, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHGQ2VXHDMN5HF62Z6CUPEDXZRSG7ANCNFSM6AAAAAAY3DAS64 . You are receiving this because you commented.Message ID: @.***>

make-all commented 1 year ago

It is under products, it is the product id.

But detection of the device does not rely on the product id, it is matching the dps. I need to see the log from your device (Home Assistant log should have the details from when the device was not recognised) to see if it is either a completely different variant, or a minor tweak is able to get it to match.

cschutte commented 1 year ago

I tested this on my Geyserwise (the DeltaV model) - seems to work. Thanks! Will monitor and notify if something does not work.