rospogrigio / localtuya

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

Config flow with forced ID makes system broken #1563

Open joriws opened 10 months ago

joriws commented 10 months ago

The problem

At least "climate" type of config flow forces setting DP to UI's "ID*" field. Problem is that there is no DP with ID available. So cannot add multiple thermostats. And cannot set/delete anything.

ha_climate_climate

after submit the next screen:

ha_climate_config_entity

which proposes DP 2 as ID, because on this example screenshot session I had already DP 1 used as a switch-type for thermostat relay.

I strongly feel that ID should not be there or it should be free field or even better - the tuya fetched id.

Maybe the ID is set correctly if device is discovered. I needed to manually add my devices into localtuya. So "add device" screen only provided "..." -option.,

Environment

Steps to reproduce

  1. manually add device - by entering tuya id, tuya secret, host ip address
  2. add climate-type entity

DP dump

{ '1': false,
  '2': 'eco', # see additional information
  '3': 'standby', # see additional information
  '8': false,
  '10': true,
  '11': false,
  '18': 95,
  '19': 230,
  '21': '12k', # floor sensor kOhm
  '23': 'c', # celsius / fahrenheit
  '24': 195,
  '29': 671,
  '31': '5_1_1', # programmin mode 5_1_1|7
  '33': 10,
  '39': false,
  '40': false,
  '43': 'both', # sensed thermometer: both|room|floor
  '45': 0,
  '101': 2800, # power as W
  '102': 9, # energy as kWh
  '103': 0,
  '105': 0,
  '114': 'B' }

Provide Home Assistant traceback/logs

Additional information

For this device "Dunwore F60 wifi" climate.py could be patched with:

"Heating/Standby": { CURRENT_HVAC_HEAT: "heating", CURRENT_HVAC_IDLE: "standby", },

and

"Auto/Comfort/Eco/Holiday": { PRESET_AWAY: "holiday", PRESET_ECO: "eco", PRESET_COMFORT: "comfort", PRESET_HOME: "auto", },

also temperature_celsius/f is at DP23 c|f

joriws commented 10 months ago

So the issues is that I've 6x floor thermostat and I cannot install them because I cannot assign any DP really to ID.

With above "patch" for PRESET and CURRENT mode the HA climate card seemed to work ok.

janfromberlin commented 10 months ago

I am wondering if the label „ID“ is misleading? It is apparently to be assigned to the Main Power switch. And I agree: It should Not be mandatory.

joriws commented 10 months ago

I think this is not the case. If "ID" is set at DP 1 which is True/False the climate.py does not work. HA localtuya shown just Unknown. This what I initially tried, until mapping to power/kW DP which enabled the climate device.

joriws commented 9 months ago

I think this localtuya is abandoned. Is there any active repo?

clinke77 commented 2 months ago

Got the same problem with a TGM50-WIFI device