milo526 / homebridge-tuya-web

Hoobs and Homebridge plugin for Tuya devices using Home Assistant Tuya Web Api
MIT License
219 stars 95 forks source link

Target temperature mis-reporting with configured target-temperature-factor #146

Closed sgruzlewski closed 3 years ago

sgruzlewski commented 3 years ago

Describe the bug

Target temperature is displayed incorrectly at random moments. If target temperature factor is set to 0.1 Minimal config temperature is displayed, if temp factor is set to 1, max config temp is shown.

Steps To Reproduce

  1. Go to Apple Home
  2. Set some target temp
  3. Go to home screen (minimize home app)
  4. Go back to apple home - it is possible that at this point already incorrect target temp is shown
  5. Kill home app, switch on home app again - it is possible that at this point already incorrect target temp is shown

Sometimes it just works fine, sometimes it shows incorrect target temp

Plugin Version

@milo526/homebridge-tuya-web v0.7.0

Homebridge Config

{
            "name": "TuyaWebPlatform",
            "options": {
                "username": "*****",
                "password": "****",
                "countryCode": "48",
                "platform": "smart_life",
                "pollingInterval": 600
            },
            "defaults": [
                {
                    "id": "Salon",
                    "device_type": "climate",
                    "min_temper": "12",
                    "max_temper": "28",
                    "current_temperature_factor": "0.1",
                    "target_temperature_factor": "0.1"
                },
                {
                    "id": "Lazienka",
                    "device_type": "climate",
                    "min_temper": "12",
                    "max_temper": "28",
                    "current_temperature_factor": "0.1",
                    "target_temperature_factor": "0.1"
                },
                {
                    "id": "Kuchnia",
                    "device_type": "climate",
                    "min_temper": "12",
                    "max_temper": "28",
                    "current_temperature_factor": "0.1",
                    "target_temperature_factor": "0.1"
                },
                {
                    "id": "Sypialnia",
                    "device_type": "climate",
                    "min_temper": "12",
                    "max_temper": "28",
                    "current_temperature_factor": "0.1",
                    "target_temperature_factor": "0.1"
                },
                {
                    "id": "Pieczara",
                    "device_type": "climate",
                    "min_temper": "12",
                    "max_temper": "28",
                    "current_temperature_factor": "0.1",
                    "target_temperature_factor": "0.1"
                }
            ],
            "scenes": false,
            "platform": "TuyaWebPlatform"
        }

Device Config

 {
   "header":{
      "code":"SUCCESS",
      "payloadVersion":1
   },
   "payload":{
      "devices":[
         {
            "data":{
               "current_temperature":205,
               "max_temper":700,
               "min_temper":10,
               "online":True,
               "temperature":200
            },
            "dev_type":"climate",
            "ha_type":"climate",
            "icon":"https://images.tuyaeu.com/smart/program_category_icon/wk.png",
            "id":"bf8669761d0e2c1e7df6mc",
            "name":"Kuchnia"
         },
         {
            "data":{
               "current_temperature":215,
               "max_temper":700,
               "min_temper":10,
               "online":True,
               "temperature":220
            },
            "dev_type":"climate",
            "ha_type":"climate",
            "icon":"https://images.tuyaeu.com/smart/program_category_icon/wk.png",
            "id":"bfe00ef9867413b1e2zxnd",
            "name":"Sypialnia"
         },
         {
            "data":{
               "current_temperature":225,
               "max_temper":700,
               "min_temper":10,
               "online":True,
               "temperature":220
            },
            "dev_type":"climate",
            "ha_type":"climate",
            "icon":"https://images.tuyaeu.com/smart/program_category_icon/wk.png",
            "id":"bf559fec6f868b67cavp9c",
            "name":"Salon"
         },
         {
            "data":{
               "current_temperature":225,
               "max_temper":700,
               "min_temper":10,
               "online":True,
               "temperature":220
            },
            "dev_type":"climate",
            "ha_type":"climate",
            "icon":"https://images.tuyaeu.com/smart/program_category_icon/wk.png",
            "id":"bfec60472454240230c5ec",
            "name":"Łazienka"
         },
         {
            "data":{
               "current_temperature":215,
               "max_temper":700,
               "min_temper":10,
               "online":True,
               "temperature":220
            },
            "dev_type":"climate",
            "ha_type":"climate",
            "icon":"https://images.tuyaeu.com/smart/program_category_icon/wk.png",
            "id":"bf8ee6cd43bc9d5b653tkw",
            "name":"Pieczara"
         }
      ],
      "scenes":[

      ]
   }
}

Additional Context

log from homebridge

[12/28/2020, 12:01:00 AM] [TuyaWebPlatform] [Salon] - Requesting device state [12/28/2020, 12:01:00 AM] [TuyaWebPlatform] [Salon] - Creating new debounced promise [12/28/2020, 12:01:00 AM] [TuyaWebPlatform] [Salon] - Triggering debouncedDeviceStateRequest [12/28/2020, 12:01:00 AM] [TuyaWebPlatform] [Salon] - Requesting device state [12/28/2020, 12:01:00 AM] [TuyaWebPlatform] [Salon] - Triggering debouncedDeviceStateRequest [12/28/2020, 12:01:00 AM] [TuyaWebPlatform] [Salon] - Requesting device state [12/28/2020, 12:01:00 AM] [TuyaWebPlatform] [Salon] - Triggering debouncedDeviceStateRequest [12/28/2020, 12:01:00 AM] [TuyaWebPlatform] [Salon] - Requesting device state [12/28/2020, 12:01:00 AM] [TuyaWebPlatform] [Salon] - Triggering debouncedDeviceStateRequest [12/28/2020, 12:01:00 AM] [Broadlink RM] pilotYamahaOptical getSwitchState: false [12/28/2020, 12:01:00 AM] [Yamaha RN-303D] HTTP GetStatus result:On [12/28/2020, 12:01:01 AM] [Yamaha RN-303D] HTTP GetStatus result:NaN [12/28/2020, 12:01:01 AM] [TuyaWebPlatform] [Salon] - Unsetting debouncedDeviceStateRequestPromise [12/28/2020, 12:01:01 AM] [TuyaWebPlatform] [Salon] - Renewing cache due to RateLimitError [12/28/2020, 12:01:01 AM] [TuyaWebPlatform] [Salon] Characteristic.TargetTemperature - [GET] 23 [12/28/2020, 12:01:01 AM] [TuyaWebPlatform] [Salon] Characteristic.TargetTemperature - [UPDATE] 2.3000000000000003 [12/28/2020, 12:01:01 AM] [TuyaWebPlatform] [Salon] Characteristic.CurrentHeatingCoolingState - [GET] [object Object] [12/28/2020, 12:01:01 AM] [TuyaWebPlatform] [Salon] Characteristic.CurrentHeatingCoolingState - [UPDATE] HEAT [12/28/2020, 12:01:01 AM] [TuyaWebPlatform] [Salon] Characteristic.TargetHeatingCoolingState - [GET] [object Object] [12/28/2020, 12:01:01 AM] [TuyaWebPlatform] [Salon] Characteristic.TargetHeatingCoolingState - [UPDATE] AUTO [12/28/2020, 12:01:01 AM] [TuyaWebPlatform] [Salon] Characteristic.CurrentTemperature - [GET] 225 [12/28/2020, 12:01:01 AM] [TuyaWebPlatform] [Salon] Characteristic.CurrentTemperature - [UPDATE] 22.5

milo526 commented 3 years ago

Thank you for reporting this once more.

This is fixed in v0.7.1 which is deploying as we speak.