Mill-International-AS / Generation_3_REST_API

Local REST API documentation
37 stars 6 forks source link

EOprationMode"Off" is documented, but "OFF" is used by the heater #13

Open olavt opened 1 year ago

olavt commented 1 year ago

The documentation states that "Off" is a valid value for EOprationMode (which is also misspelled).

The heater actually does return "OFF" as a response to /control-status:

{ "ambient_temperature": 21.177026748657227, "current_power": 0, "control_signal": 0, "lock_active": "No lock", "open_window_active_now": "Enabled not active now", "raw_ambient_temperature": 21.177026748657227, "set_temperature": 0, "switched_on": false, "connected_to_cloud": true, "operation_mode": "OFF", "status": "ok" }

ismarslomic commented 1 year ago

The API is not case sensitive as far as I have seen so far

olavt commented 1 year ago

Ok, but it should be consistent according to the documentation. It gets error prone if one needs to make sure any comparison is done case insensitive.

ismarslomic commented 1 year ago

Its hard to dissagree that documentation and code should be consistent 😉 I just wanted to inform you about how the API behaves, but the documentation should be updated. You are free to make a PR with suggested modifications!

olavt commented 1 year ago

Btw, why is "status": "ok" returned when setting EOprationMode to invalid values? I also didn't understand the "Invalid" entry in the documentation for EOprationMode.

ismarslomic commented 1 year ago

Good point, setting invalid Operation Mode should lead to HTTP 400 and another status value. Im not sure why API has introduced a status property in response body, in stead of using standardised HTTP status codes. I made a issue on this: https://github.com/Mill-International-AS/Generation_3_REST_API/issues/10