rospogrigio / localtuya

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

[BOUNTY $50 USD] Add CLIMATE.SET_FAN_MODE, Attributes, and sensor to climate #1165

Closed zorrobyte closed 1 month ago

zorrobyte commented 1 year ago

I'd like to pay someone $50 (after completion) to write a PR to add fan control, matching attributes, and a sensor type (for power consumption). Swing control would be nice, but I don't fully have the DPS figured out yet. Please only write upstreamable code, meaning, no messy hacks, follow conventions, etc.

Here are my DPS (ignore "t" as it is timestamp)

Fan
{'dps': {'5': 'strong'}, 't': 1670388007}
{'dps': {'5': 'high'}, 't': 1670388016}
{'dps': {'5': 'mid_high'}, 't': 1670388026}
{'dps': {'5': 'mid'}, 't': 1670388073}
{'dps': {'5': 'mid_low'}, 't': 1670388084}
{'dps': {'5': 'low'}, 't': 1670388092}
{'dps': {'5': 'mute'}, 't': 1670388100}
{'dps': {'5': 'auto'}, 't': 1670388109}

Attributes mean : https://www.home-assistant.io/integrations/climate/#attributes This is to read the fan state from DPS

Sensor: electricity decimal DPS 116 : 248 - 20712 (integer)

I'd like to see DPS 116 in Home Assistant as a sensor, my HVAC reports back it's current energy usage (unknown value type, such as watts or kWh, but maybe divisible by 10, like other Tuya sensors (https://github.com/rospogrigio/localtuya/blob/master/custom_components/localtuya/switch.py#L64)

I tried manually adding the same HVAC as a "sensor" type, setting the DPS to 116, but localtuya errors out and refuses to have two devices set up as the same IP/ID.

I can pay via Cashapp/Venmo/Paypal. I don't care if it actually gets merged as I'm using it for my Pioneer Heat Pump fork, but I'm filing here so it could be merged if maintainer wishes: https://github.com/zorrobyte/localtuya

Here is a list of the DPS I have found, for other reference (Pioneer Diamante Ultra 22 SEER):

Current temp (C)
{'dps': {'3': 25}, 't': 1670388025}

Generator mode
{'120': 'off'}, 't': 1670387697}
{'dps': {'120': 'L1'}, 't': 1670387681}
{'dps': {'120': 'L2'}, 't': 1670387719}
{'dps': {'120': 'L3’}, 't': 1670387719}

Display on
{'dps': {'123': '0008'}, 't': 1670387747}
Display off
{'dps': {'123': '0000'}, 't': 1670387761}

Buzzer on
{'dps': {'123': '0010'}, 't': 1670387776}
Buzzer off
{'dps': {'123': '0000'}, 't': 1670387790}

Heat (F)
{'dps': {'2': 630}, 't': 1670387819}

Auto 79F
{'dps': {'4': 'auto', '2': 790}, 't': 1670387908}
{'dps': {'4': 'cold'}, 't': 1670387933}
{'dps': {'4': 'hot', '2': 630}, 't': 1670387951}
{'dps': {'5': 'low', '4': 'wet', '2': 790}, 't': 1670387964}
{'dps': {'5': 'auto', '4': 'wind'}, 't': 1670387982}

fan
{'dps': {'5': 'strong'}, 't': 1670388007}
{'dps': {'5': 'high'}, 't': 1670388016}
{'5': 'mid_high'}, 't': 1670388026}
{'dps': {'5': 'mid'}, 't': 1670388073}
{'dps': {'5': 'mid_low'}, 't': 1670388084}
{'dps': {'5': 'low'}, 't': 1670388092}
{'dps': {'5': 'mute'}, 't': 1670388100}
{'dps': {'5': 'auto'}, 't': 1670388109}

up-down flow
{'dps': {'133': '2', '113': '1'}, 't': 1670388164}

Sleep
{'dps': {'105': 'normal'}, 't': 1670388264}
The aged
{'dps': {'105': 'old'}, 't': 1670388274}
child
{'dps': {'105': 'child'}, 't': 1670388285}

{'dps': {'135': 1, '116': 248}, 't': 1670396949} ?

From IOT

Dirty filter
DPS 131 -- “off”

Horz/vert swing
DPS 133 -- Horizontal / Vertical / 0

Fault
DPS 20 -- 0/1

up/down flow
DPS 113 -- Up-Down Flow / Down Flow / 0

left/right flow
DPS 114 -- Left-Right Flow / 0

electricity decimal
DPS 116 -- 248 - 20712

GEN mode
DPS 120 -- off / 30% / 50% / 80%

Upper and lower rating
DPS 126 -- 0 / Down Fix

DPS 127 -- 0 / Left Fix

Error 2
DPS 122
zorrobyte commented 1 month ago

No longer own a minisplit, closing bounty