rospogrigio / daikin_residential

Cloud control of Daikin devices that are supported by Daikin Residential Controller app.
GNU General Public License v3.0
283 stars 37 forks source link

Swing mode doesn’t work with FVXM25A #48

Open gzeel opened 2 years ago

gzeel commented 2 years ago

I’ve got two FVXM25A‘s installed. When I want to change the swing mode in HA, I’m getting the following error. The FVXM25A has 2 (or 3) swing modes : None, Vertical and a option for Floor Heating. Floor Heating isn’t displayed as an option in HA.

Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 185, in handle_call_service await hass.services.async_call( File "/usr/src/homeassistant/homeassistant/core.py", line 1495, in async_call task.result() File "/usr/src/homeassistant/homeassistant/core.py", line 1530, in _execute_service await handler.job.target(service_call) File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 209, in handle_service await self.hass.helpers.service.entity_service_call( File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 663, in entity_service_call future.result() # pop exception if have File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 896, in async_request_call await coro File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 700, in _handle_entity_call await result File "/config/custom_components/daikin_residential/climate.py", line 237, in async_set_swing_mode await self._device.async_set_swing_mode(swing_mode) File "/config/custom_components/daikin_residential/daikin_base.py", line 264, in async_set_swing_mode await self.setValue(ATTR_HSWING_MODE, new_hMode) File "/config/custom_components/daikin_residential/daikin_base.py", line 126, in setValue return await self.set_data(cmd_set[0], cmd_set[1], cmd_set[2], value) File "/config/custom_components/daikin_residential/device.py", line 334, in set_data raise Exception( Exception: Please provide a valid datapoint definition that exists in the data structure

jwillemsen commented 2 years ago

Can you download and attach the integration diagnostics, please remove all your id's/keys from the file before attaching

trullock commented 1 year ago

Plus one for this

trullock commented 1 year ago

Diagnostics below

Note that the swing mode is different based on the HVAC mode, i.e. floor heating mode is only available when in heating mode.

Setting Swing on/off throws:

2022-11-29 16:02:15.464 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [140461669124992] Please provide a valid datapoint definition that exists in the data structure
Traceback (most recent call last):
  File "/workspaces/core/homeassistant/components/websocket_api/commands.py", line 200, in handle_call_service
    await hass.services.async_call(
  File "/workspaces/core/homeassistant/core.py", line 1745, in async_call
    task.result()
  File "/workspaces/core/homeassistant/core.py", line 1782, in _execute_service
    await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)(
  File "/workspaces/core/homeassistant/helpers/entity_component.py", line 213, in handle_service
    await service.entity_service_call(
  File "/workspaces/core/homeassistant/helpers/service.py", line 678, in entity_service_call
    future.result()  # pop exception if have
  File "/workspaces/core/homeassistant/helpers/entity.py", line 943, in async_request_call
    await coro
  File "/workspaces/core/homeassistant/helpers/service.py", line 715, in _handle_entity_call
    await result
  File "/workspaces/core/config/custom_components/daikin_residential/climate.py", line 247, in async_set_swing_mode
    await self._device.async_set_swing_mode(swing_mode)
  File "/workspaces/core/config/custom_components/daikin_residential/daikin_base.py", line 275, in async_set_swing_mode
    await self.setValue(ATTR_HSWING_MODE, new_hMode)
  File "/workspaces/core/config/custom_components/daikin_residential/daikin_base.py", line 135, in setValue
    return await self.set_data(cmd_set[0], cmd_set[1], cmd_set[2], value)
  File "/workspaces/core/config/custom_components/daikin_residential/device.py", line 334, in set_data
    raise Exception(
Exception: Please provide a valid datapoint definition that exists in the data structure
[
    {
      "_id": "xxxxx",
      "type": "dx4",
      "deviceModel": "dx4",
      "isCloudConnectionUp": {
        "settable": false,
        "value": true
      },
      "managementPoints": [
        {
          "embeddedId": "gateway",
          "managementPointType": "gateway",
          "managementPointCategory": "secondary",
          "daylightSavingTimeEnabled": {
            "settable": true,
            "value": true
          },
          "errorCode": {
            "settable": false,
            "value": ""
          },
          "firmwareVersion": {
            "settable": false,
            "value": "1_12_84"
          },
          "isInErrorState": {
            "settable": false,
            "value": false
          },
          "ledEnabled": {
            "settable": true,
            "value": true
          },
          "macAddress": {
            "settable": false,
            "value": "xxxxx"
          },
          "modelInfo": {
            "settable": false,
            "value": "BRP069C4x"
          },
          "regionCode": {
            "settable": false,
            "value": "eu"
          },
          "serialNumber": {
            "settable": false,
            "value": "xxxxx"
          },
          "ssid": {
            "settable": false,
            "value": "xxxxx"
          },
          "timeZone": {
            "settable": true,
            "value": "Europe/London"
          },
          "wifiConnectionSSID": {
            "settable": false,
            "value": "xxxxx"
          },
          "wifiConnectionStrength": {
            "settable": false,
            "value": -38,
            "maxValue": 0,
            "minValue": -90,
            "stepValue": 1
          }
        },
        {
          "embeddedId": "climateControl",
          "managementPointType": "climateControl",
          "managementPointSubType": "mainZone",
          "managementPointCategory": "primary",
          "consumptionData": {
            "ref": "#consumptionData",
            "settable": false,
            "value": {
              "electrical": {
                "unit": "kWh",
                "heating": {
                  "d": [
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0.6,
                    0,
                    0.1,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0
                  ],
                  "w": [
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0.7,
                    0,
                    null,
                    null,
                    null,
                    null,
                    null
                  ],
                  "m": [
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    3,
                    2.5,
                    1.8,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0.7,
                    0
                  ]
                },
                "cooling": {
                  "d": [
                    0.1,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0
                  ],
                  "w": [
                    0.1,
                    0.1,
                    0.2,
                    0.1,
                    0.1,
                    0.1,
                    0.1,
                    0.1,
                    0,
                    null,
                    null,
                    null,
                    null,
                    null
                  ],
                  "m": [
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0.4,
                    2,
                    2.5,
                    11.3,
                    34.1,
                    34.8,
                    3.7,
                    3.7,
                    3.3,
                    0
                  ]
                }
              }
            }
          },
          "demandControl": {
            "ref": "#demandControl",
            "settable": true,
            "value": {
              "currentMode": {
                "value": "off",
                "settable": true,
                "values": [
                  "off",
                  "auto",
                  "fixed",
                  "scheduled"
                ]
              },
              "modes": {
                "fixed": {
                  "stepValue": 5,
                  "value": 100,
                  "minValue": 40,
                  "maxValue": 100,
                  "settable": true
                },
                "scheduled": {
                  "settable": true,
                  "meta": {
                    "minIntervalBetweenActions": "00:01:00",
                    "maxActionsPerActionPeriod": 4,
                    "consecutiveActionsAllowed": true,
                    "actionPeriods": [
                      "monday",
                      "tuesday",
                      "wednesday",
                      "thursday",
                      "friday",
                      "saturday",
                      "sunday"
                    ],
                    "actionTypes": {
                      "currentMode": {
                        "settable": true,
                        "values": [
                          "off",
                          "fixed"
                        ]
                      },
                      "modes": {
                        "fixed": {
                          "stepValue": 5,
                          "minValue": 40,
                          "maxValue": 100,
                          "settable": true
                        }
                      }
                    }
                  },
                  "value": {
                    "actions": {}
                  }
                }
              }
            }
          },
          "econoMode": {
            "settable": true,
            "values": [
              "on",
              "off"
            ],
            "value": "off"
          },
          "errorCode": {
            "settable": false,
            "value": "00-"
          },
          "fanControl": {
            "ref": "#fanControl",
            "settable": true,
            "value": {
              "operationModes": {
                "heating": {
                  "fanSpeed": {
                    "currentMode": {
                      "value": "auto",
                      "settable": true,
                      "values": [
                        "auto",
                        "quiet",
                        "fixed"
                      ]
                    },
                    "modes": {
                      "fixed": {
                        "value": 5,
                        "stepValue": 1,
                        "minValue": 1,
                        "maxValue": 5,
                        "settable": true
                      }
                    }
                  },
                  "fanDirection": {
                    "vertical": {
                      "currentMode": {
                        "value": "stop",
                        "settable": true,
                        "values": [
                          "stop",
                          "swing",
                          "floorHeatingAirflow"
                        ]
                      }
                    }
                  }
                },
                "cooling": {
                  "fanSpeed": {
                    "currentMode": {
                      "value": "fixed",
                      "settable": true,
                      "values": [
                        "auto",
                        "quiet",
                        "fixed"
                      ]
                    },
                    "modes": {
                      "fixed": {
                        "value": 1,
                        "stepValue": 1,
                        "minValue": 1,
                        "maxValue": 5,
                        "settable": true
                      }
                    }
                  },
                  "fanDirection": {
                    "vertical": {
                      "currentMode": {
                        "value": "stop",
                        "settable": true,
                        "values": [
                          "stop",
                          "swing"
                        ]
                      }
                    }
                  }
                },
                "auto": {
                  "fanSpeed": {
                    "currentMode": {
                      "value": "auto",
                      "settable": true,
                      "values": [
                        "auto",
                        "quiet",
                        "fixed"
                      ]
                    },
                    "modes": {
                      "fixed": {
                        "value": 2,
                        "stepValue": 1,
                        "minValue": 1,
                        "maxValue": 5,
                        "settable": true
                      }
                    }
                  },
                  "fanDirection": {
                    "vertical": {
                      "currentMode": {
                        "value": "stop",
                        "settable": true,
                        "values": [
                          "stop",
                          "swing"
                        ]
                      }
                    }
                  }
                },
                "dry": {
                  "fanSpeed": {
                    "currentMode": {
                      "value": "auto",
                      "settable": true,
                      "values": [
                        "auto"
                      ]
                    }
                  },
                  "fanDirection": {
                    "vertical": {
                      "currentMode": {
                        "value": "stop",
                        "settable": true,
                        "values": [
                          "stop",
                          "swing"
                        ]
                      }
                    }
                  }
                },
                "fanOnly": {
                  "fanSpeed": {
                    "currentMode": {
                      "value": "auto",
                      "settable": true,
                      "values": [
                        "auto",
                        "quiet",
                        "fixed"
                      ]
                    },
                    "modes": {
                      "fixed": {
                        "value": 1,
                        "stepValue": 1,
                        "minValue": 1,
                        "maxValue": 5,
                        "settable": true
                      }
                    }
                  },
                  "fanDirection": {
                    "vertical": {
                      "currentMode": {
                        "value": "stop",
                        "settable": true,
                        "values": [
                          "stop",
                          "swing"
                        ]
                      }
                    }
                  }
                }
              }
            }
          },
          "holidayMode": {
            "ref": "#holidayMode",
            "settable": true,
            "value": {
              "enabled": false
            }
          },
          "iconId": {
            "settable": true,
            "maxValue": 255,
            "minValue": 0,
            "value": 15
          },
          "isCoolHeatMaster": {
            "settable": false,
            "value": true
          },
          "isHolidayModeActive": {
            "settable": false,
            "value": false
          },
          "isInCautionState": {
            "settable": false,
            "value": false
          },
          "isInErrorState": {
            "settable": false,
            "value": false
          },
          "isInModeConflict": {
            "settable": false,
            "value": false
          },
          "isInWarningState": {
            "settable": false,
            "value": false
          },
          "isLockFunctionEnabled": {
            "settable": false,
            "value": false
          },
          "name": {
            "settable": true,
            "maxLength": 20,
            "value": "xxxxx"
          },
          "onOffMode": {
            "settable": true,
            "values": [
              "on",
              "off"
            ],
            "value": "off"
          },
          "operationMode": {
            "settable": true,
            "value": "heating",
            "values": [
              "fanOnly",
              "heating",
              "cooling",
              "auto",
              "dry"
            ]
          },
          "outdoorSilentMode": {
            "settable": false,
            "values": [
              "on",
              "off"
            ],
            "value": "off"
          },
          "powerfulMode": {
            "settable": true,
            "values": [
              "on",
              "off"
            ],
            "value": "off"
          },
          "isPowerfulModeActive": {
            "settable": false,
            "value": false
          },
          "schedule": {
            "ref": "#schedule",
            "settable": true,
            "value": {
              "currentMode": {
                "value": "any",
                "settable": true,
                "values": [
                  "any"
                ]
              },
              "nextAction": {},
              "modes": {
                "any": {
                  "currentSchedule": {
                    "value": "0",
                    "settable": true,
                    "values": [
                      "0",
                      "1",
                      "2"
                    ]
                  },
                  "enabled": {
                    "value": false,
                    "settable": true
                  },
                  "meta": {
                    "minIntervalBetweenActions": "00:01:00",
                    "maxSchedules": 1,
                    "maxActionsPerActionPeriod": 6,
                    "consecutiveActionsAllowed": true,
                    "actionTypes": {
                      "operationMode": {
                        "settable": false,
                        "values": [
                          "fanOnly",
                          "heating",
                          "cooling",
                          "auto",
                          "dry",
                          "off"
                        ]
                      },
                      "roomTemperature": {
                        "heating": {
                          "settable": false,
                          "stepValue": 0.5,
                          "minValue": 10,
                          "maxValue": 30
                        },
                        "cooling": {
                          "settable": false,
                          "stepValue": 0.5,
                          "minValue": 18,
                          "maxValue": 32
                        },
                        "auto": {
                          "settable": false,
                          "stepValue": 0.5,
                          "minValue": 18,
                          "maxValue": 30
                        }
                      },
                      "fanSpeed": {
                        "heating": {
                          "currentMode": {
                            "settable": false,
                            "values": [
                              "auto",
                              "quiet",
                              "fixed"
                            ]
                          },
                          "modes": {
                            "fixed": {
                              "stepValue": 1,
                              "minValue": 1,
                              "maxValue": 5,
                              "settable": false
                            }
                          }
                        },
                        "cooling": {
                          "currentMode": {
                            "settable": false,
                            "values": [
                              "auto",
                              "quiet",
                              "fixed"
                            ]
                          },
                          "modes": {
                            "fixed": {
                              "stepValue": 1,
                              "minValue": 1,
                              "maxValue": 5,
                              "settable": false
                            }
                          }
                        },
                        "auto": {
                          "currentMode": {
                            "settable": false,
                            "values": [
                              "auto",
                              "quiet",
                              "fixed"
                            ]
                          },
                          "modes": {
                            "fixed": {
                              "stepValue": 1,
                              "minValue": 1,
                              "maxValue": 5,
                              "settable": false
                            }
                          }
                        },
                        "dry": {
                          "currentMode": {
                            "settable": false,
                            "values": [
                              "auto"
                            ]
                          }
                        },
                        "fanOnly": {
                          "currentMode": {
                            "settable": false,
                            "values": [
                              "auto",
                              "quiet",
                              "fixed"
                            ]
                          },
                          "modes": {
                            "fixed": {
                              "stepValue": 1,
                              "minValue": 1,
                              "maxValue": 5,
                              "settable": false
                            }
                          }
                        }
                      },
                      "econoMode": {
                        "settable": false,
                        "values": [
                          "on",
                          "off"
                        ]
                      }
                    }
                  },
                  "schedules": {
                    "0": {
                      "name": {
                        "settable": true,
                        "value": "",
                        "maxLength": 32
                      },
                      "meta": {
                        "isReadOnly": false,
                        "actionPeriods": [
                          "monday",
                          "tuesday",
                          "wednesday",
                          "thursday",
                          "friday",
                          "saturday",
                          "sunday"
                        ]
                      },
                      "actions": {},
                      "settable": true
                    },
                    "1": {
                      "name": {
                        "settable": true,
                        "value": "",
                        "maxLength": 32
                      },
                      "meta": {
                        "isReadOnly": false,
                        "actionPeriods": [
                          "monday",
                          "tuesday",
                          "wednesday",
                          "thursday",
                          "friday",
                          "saturday",
                          "sunday"
                        ]
                      },
                      "actions": {},
                      "settable": true
                    },
                    "2": {
                      "name": {
                        "settable": true,
                        "value": "",
                        "maxLength": 32
                      },
                      "meta": {
                        "isReadOnly": false,
                        "actionPeriods": [
                          "monday",
                          "tuesday",
                          "wednesday",
                          "thursday",
                          "friday",
                          "saturday",
                          "sunday"
                        ]
                      },
                      "actions": {},
                      "settable": true
                    }
                  }
                }
              }
            }
          },
          "sensoryData": {
            "ref": "#sensoryData",
            "settable": false,
            "value": {
              "roomTemperature": {
                "settable": false,
                "value": 20,
                "stepValue": 1,
                "minValue": -25,
                "maxValue": 48
              },
              "roomHumidity": {
                "settable": false,
                "value": 50,
                "stepValue": 1,
                "minValue": 25,
                "maxValue": 85
              },
              "outdoorTemperature": {
                "settable": false,
                "value": 5,
                "stepValue": 0.5,
                "minValue": -25,
                "maxValue": 48
              }
            }
          },
          "streamerMode": {
            "settable": true,
            "values": [
              "on",
              "off"
            ],
            "value": "off"
          },
          "temperatureControl": {
            "ref": "#temperatureControl",
            "settable": true,
            "value": {
              "operationModes": {
                "heating": {
                  "setpoints": {
                    "roomTemperature": {
                      "settable": true,
                      "value": 30,
                      "stepValue": 0.5,
                      "minValue": 10,
                      "maxValue": 30
                    }
                  }
                },
                "cooling": {
                  "setpoints": {
                    "roomTemperature": {
                      "settable": true,
                      "value": 18.5,
                      "stepValue": 0.5,
                      "minValue": 18,
                      "maxValue": 32
                    }
                  }
                },
                "auto": {
                  "setpoints": {
                    "roomTemperature": {
                      "settable": true,
                      "value": 25,
                      "stepValue": 0.5,
                      "minValue": 18,
                      "maxValue": 30
                    }
                  }
                }
              }
            }
          }
        },
        {
          "embeddedId": "indoorUnit",
          "managementPointType": "indoorUnit",
          "managementPointCategory": "secondary",
          "softwareVersion": {
            "settable": false,
            "value": "19015C02"
          },
          "eepromVersion": {
            "settable": false,
            "value": "12ED"
          },
          "dryKeepSetting": {
            "settable": false,
            "values": [
              "on",
              "off"
            ],
            "value": "on"
          }
        },
        {
          "embeddedId": "outdoorUnit",
          "managementPointType": "outdoorUnit",
          "managementPointCategory": "secondary",
          "errorCode": {
            "settable": false,
            "value": "00-"
          },
          "isInErrorState": {
            "settable": false,
            "value": false
          },
          "isInWarningState": {
            "settable": false,
            "value": false
          },
          "isInCautionState": {
            "settable": false,
            "value": false
          }
        }
      ],
      "embeddedId": "xxxxx",
      "timestamp": "2022-11-29T15:33:39.401Z",
      "id": "xxxxx",
      "lastUpdateReceived": "2022-11-29T15:33:39.401Z"
    }
]
trullock commented 1 year ago

First problem is that ATTR_HSWING_MODE is always None, so async_set_swing_mode in daikin_base.py is too naive and you end up on the wrong path and throwing an exception.

hMode is None and then new_hMode is "stop", which aren't equal and then it tries to set the horizontal swing mode

Crudely patching the above, and when you change from Off to Vertical in swing mode, async_set_swing_mode gets called twice, once to turn it on and then immediately again to turn it off again. The actions work to physically control the device. Need to find out why its firing twice. Presumably this is why the dropdown in the UI ends up blank, I imagine theres a dodgy value going on...

trullock commented 1 year ago

Right, this very crudely makes Swing Mode work for Off and Vertical:

image

The problem is the implicit belief that only horizontal and vertical swing mode are supported and both are expected at the same time.

I'm happy to patch this if I can get some guidance as to what you'd like me to do.

rospogrigio commented 1 year ago

A PR was already developed to support Floor Heating mode, can you check it? It is #105 . Thank you

trullock commented 1 year ago

@rospogrigio I've reviewed the PR, it looks good

jwillemsen commented 9 months ago

Can you try https://github.com/jwillemsen/daikin_residential_altherma/releases/tag/v3.1.0, made some changes to support more swing modes today