make-all / tuya-local

Local support for Tuya devices in Home Assistant
MIT License
1.31k stars 516 forks source link

New Device Request: Wifi Electric Oil Radiator #303

Closed davidt94 closed 1 year ago

davidt94 commented 1 year ago

Hello, thanks for your great work on this project!

Would it be possible for you to add support for the following heater? (Amazon 1500W 7 Fin Wifi Electric Radiator) Currently it showing just as a standard switch. Cloud API and Home Assistant Diagnostics below.

https://www.amazon.co.uk/gp/product/B0BGHZJCMJ/ref=ppx_yo_dt_b_asin_title_o00_s00?ie=UTF8&th=1

Thanks in advance!

Tuya Cloud:

{ "result": { "category": "qn", "functions": [ { "code": "switch", "desc": "{}", "name": "开关", "type": "Boolean", "values": "{}" }, { "code": "temp_set", "desc": "{\"unit\":\"℃\",\"min\":15,\"max\":50,\"scale\":0,\"step\":1}", "name": "设置温度", "type": "Integer", "values": "{\"unit\":\"℃\",\"min\":15,\"max\":50,\"scale\":0,\"step\":1}" }, { "code": "lock", "desc": "{}", "name": "童锁", "type": "Boolean", "values": "{}" }, { "code": "light", "desc": "{}", "name": "灯光", "type": "Boolean", "values": "{}" }, { "code": "countdown_set", "desc": "{\"range\":[\"cancel\",\"1h\",\"2h\",\"3h\",\"4h\",\"5h\",\"6h\"]}", "name": "倒计时设置", "type": "Enum", "values": "{\"range\":[\"cancel\",\"1h\",\"2h\",\"3h\",\"4h\",\"5h\",\"6h\"]}" } ], "status": [ { "code": "switch", "name": "开关", "type": "Boolean", "values": "{}" }, { "code": "temp_set", "name": "目标温度C", "type": "Integer", "values": "{\"unit\":\"℃\",\"min\":15,\"max\":50,\"scale\":0,\"step\":1}" }, { "code": "lock", "name": "童锁", "type": "Boolean", "values": "{}" }, { "code": "light", "name": "灯光", "type": "Boolean", "values": "{}" }, { "code": "countdown_set", "name": "倒计时设置", "type": "Enum", "values": "{\"range\":[\"cancel\",\"1h\",\"2h\",\"3h\",\"4h\",\"5h\",\"6h\"]}" } ] }, "success": true, "t": 1670291457690, "tid": "6d885d74750811ed8cfe9edd9c9c26e5" }

Home Assistant Diagnostics:

}, "data": { "name": "Loft Heater", "type": "simple_switch", "device_id": "REDACTED", "local_key": "REDACTED", "host": "REDACTED", "api_version": 3.3, "status": {}, "cached_state": { "1": true, "2": 29, "4": "0", "7": false, "10": false, "19": "cancel", "21": 0, "updated_at": 1670291564.4266436 }, "pending_state": {}, "home_assistant": { "name": "Loft Heater", "name_by_user": null, "disabled": false, "disabled_by": null, "entities": [ { "disabled": false, "disabled_by": null, "entity_category": null, "device_class": null, "original_device_class": "switch", "icon": null, "unit_of_measurement": null, "state": { "entity_id": "switch.loft_heater", "state": "on", "attributes": { "device_class": "switch", "friendly_name": "Loft Heater" }, "last_changed": "2022-12-06T01:39:44.243215+00:00", "last_updated": "2022-12-06T01:39:44.243215+00:00" } } ] } } } IMG_4186 IMG_4187 IMG_4188 IMG_4189

make-all commented 1 year ago

Since the cloud data is missing the dp_id mappings, I have had to guess. And also some educated guesses at the remaining two unaccounted for dps "4" and "21" based on what is in the screenshots and other similar devices.

"1": true, = "code": "switch", "2": 29, = "code": "temp_set", "4": "0", = mode? ["0"=Comfort, "1"=Eco, "2"=Anti-frost]? "7": false, = "code": "lock" ?, "10": false, = "code": "light" ?, "19": "cancel", = "code": "countdown_set", "21": 0, = countdown_remain?

davidt94 commented 1 year ago

That’s great. Thanks for your quick response! How do I go about testing this to see if it works?

davidt94 commented 1 year ago

I reviewed the above mapping you suggested and confirm you have the mappings correct. Although "21":0 doesn't seem to have much use as it still shows 0 even when I have had a countdown set as below. So I don't think that its countdown_remain Maybe 21 is for something else but I am not sure what that could be, as I couldn't get it to show anything but 0. Could it simply be an 'online' status?

"cached_state": { "1": true, "2": 30, "4": "1", "7": false, "10": false, "19": "3h", "21": 0,

make-all commented 1 year ago

Fault code would be the other common usage. Is there anything showing in the device logs on iot.tuya.com? (You can find the logs under Cloud / Development / your project / Devices / Debug Device). Even if there are no logs for this dp, it should appear in the "Select DP ID" dropdown at top left, though the label may be in Chinese. The mention of "Tip-Over & Overheat Safety" on in the Amazon description probably points to fault code being available too.

davidt94 commented 1 year ago

Thanks for pointing me in the right direction! Just taken a look and you are again correct, its 'Fault Alarm'.

Screenshot 2022-12-06 at 22 19 27

I did just try to trip that alarm, by tipping over the heater. It seems the tip over feature completely cut power to the device including wifi access nothing was reported to the cloud other then a 'Device Restart'

Screenshot 2022-12-06 at 22 24 06
davidt94 commented 1 year ago

Thanks @make-all I have tested the above and confirm all is working perfectly! Really appreciate your work