dresden-elektronik / deconz-rest-plugin

deCONZ REST-API plugin to control ZigBee devices
BSD 3-Clause "New" or "Revised" License
1.89k stars 498 forks source link

ZHAThermostat change schedule is using wrong http method #6501

Closed luka6000 closed 1 year ago

luka6000 commented 1 year ago

Describe the bug

ZHAThermostat sensor is using method POST to configure schedule but the docs says it should be PUT as described here https://dresden-elektronik.github.io/deconz-rest-doc/endpoints/sensors/#change-sensor-config Method POST is not documented at all.

Steps to reproduce the behavior

I'm trying to update Danfoss Ally thermostats schedule with HA deconz.configure service. This service is using PUT method to update sensor config. And I get error from deconz

pydeconz.errors.RequestError: 4 /sensors/86/config/schedule/W124 method, PUT, not available for resource, /sensors/86/config/schedule/W124

This can also be replicated with POSTMAN image

Works ok with POST but this is not documented so not implemented in HA service image

Expected behavior

Sensor schedule configuration (and all configurations) should be possible with PUT method

Screenshots

Environment

deCONZ Logs

Additional context

Smanar commented 1 year ago

Ha right and it's alone

    // POST, DELETE /api/<apikey>/sensors/<id>/config/schedule/Wbbb
    else if ((req.path.size() == 7) && (req.hdr.method() == QLatin1String("POST") || req.hdr.method() == QLatin1String("DELETE")) && (req.path[4] == QLatin1String("config")) && (req.path[5] == QLatin1String("schedule")))
    {
        return changeThermostatSchedule(req, rsp);
    }
github-actions[bot] commented 1 year ago

As there has not been any response in 21 days, this issue has been automatically marked as stale. At OP: Please either close this issue or keep it active It will be closed in 7 days if no further activity occurs.

luka6000 commented 1 year ago

@Smanar would you allow something non breaking, like

    // PUT, POST, DELETE /api/<apikey>/sensors/<id>/config/schedule/Wbbb
    else if ((req.path.size() == 7) && (req.hdr.method() == QLatin1String("PUT") || req.hdr.method() == QLatin1String("POST") || req.hdr.method() == QLatin1String("DELETE")) && (req.path[4] == QLatin1String("config")) && (req.path[5] == QLatin1String("schedule")))
    {
        return changeThermostatSchedule(req, rsp);
    }

?

Smanar commented 1 year ago

Long story, but for the moment it will not move. For @ebaauw this request is used only to add or remove a day, not to change it, so for him it's POST or DELETE but not PUT

github-actions[bot] commented 1 year ago

As there has not been any response in 21 days, this issue has been automatically marked as stale. At OP: Please either close this issue or keep it active It will be closed in 7 days if no further activity occurs.

github-actions[bot] commented 1 year ago

As there has not been any response in 28 days, this issue will be closed. @ OP: If this issue is solved post what fixed it for you. If it is not solved, request to get this opened again.