Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] dingz Lamella Wrong Angle value #555

Open
whos-c opened this issue Dec 26, 2022 · 8 comments
Open

[BUG] dingz Lamella Wrong Angle value #555

whos-c opened this issue Dec 26, 2022 · 8 comments

Comments

@whos-c
Copy link

whos-c commented Dec 26, 2022

homebridge-dingz crashes while moving the lamella blind due to miscalculated angle. If the lamella is set to 100% and 90°, Homebridge value is 100% and 111°. Identified the following two lines which lead to this error, could you take a look? Thanks!

Log:

[dingz] Blinds moving:  down --> 0
[dingz] Setting WindowCovering 1 to position 0 and angle 111°
[dingz] POST http://192.168.178.98/api/v1/shade/1
[dingz] Error: Request failed with status code 400 (POST http://192.168.178.98/api/v1/shade/1)
[dingz] HTTP undefined Request failed with status code 400 Bad Request--> 192.168.178.98

lamella: (windowCovering.lamella / 90) * 100, // FIXES #419, we must convert ° to %

lamella: ((angle as number) / 90) * 100, // FIXES #419, we must convert ° to %

@johannrichard johannrichard changed the title Dingz Lamella Wrong Angle value [BUG] dingz Lamella Wrong Angle value Dec 27, 2022
@johannrichard
Copy link
Owner

johannrichard commented Dec 27, 2022

🙈 Could you please provide additional information The dingz firmware versions are notorious for very varying "interpretations" of the lamella angle and how they report it, and what they expect when setting a value. I try (...) to somehow deal with this, but it's quite a mess ...

See for example the following lines just a bit further down.

// FIXES #371, #419: internally, it's % (but only in newer firmware, v1.2.0 and lower has ° as well), HomeKit expects °
const maxTiltValue = semver.lt(this.hw.fw_version, '1.2.0') ? 90 : 100;
callback(this.reachabilityState, (tiltAngle / maxTiltValue) * 90);

So, to look into it, I would need at least the version of your dingz' firmware and some additional status dumps. You can get the FW version and the lamella config & status by opening the following in your browser and posting the output here (obfuscate the MAC address from the info endpoint as this is potentially sensitive)

http://<IP>/info
http://<IP>/api/v1/blind_config
http://<IP>/api/v1/state

See #419, #371 for the never-ending story (different FW versions with very different behaviours).

@johannrichard
Copy link
Owner

Note to self: irrespective of the cause for the wrong values, some more sanity checks and edge-case provisions would be helpful here.

@pisarenko-net
Copy link

Can confirm that I'm seeing the same issue.

  • /info/
{"version":"1.3.30",...}
  • /api/v1/blind_config
{"blinds":[{"auto_calibration":true,"state":"Initialised","invert_direction":false,"lamella_time":1.8,"shade_up_time":34.12,"shade_down_time":33.78,"type":"lamella_90","min_value":0,"max_value":100,"name":"Motor"},{"auto_calibration":true,"state":"Initialised","invert_direction":false,"lamella_time":1.8,"shade_up_time":0,"shade_down_time":0,"type":"lamella_90","min_value":0,"max_value":100,"name":"Motor"}]}
  • /api/v1/state
{"dimmers":[],"blinds":[{"moving":"stop","position":100,"lamella":100,"readonly":false,"index":{"relative":0,"absolute":0}},{"moving":"stop","position":100,"lamella":0,"readonly":false,"index":{"relative":1,"absolute":1}}],"led":{"on":false,"hsv":"0;0;100","rgb":"FFFFFF","mode":"hsv","ramp":1023},"sensors":{"brightness":49,"light_state":"night","room_temperature":23,"uncompensated_temperature":40.875,"temp_offset":0,"cpu_temperature":56.11,"puck_temperature":37,"fet_temperature":37.2,"input_state":null,"person_present":0,"power_outputs":[{"value":0},{"value":0},{"value":0},{"value":0}]},"thermostat":{"active":false,"out":0,"on":false,"enabled":true,"target_temp":21,"mode":"heating","temp":23,"min_target_temp":17,"max_target_temp":31},"wifi":{"version":"1.3.30",...},"time":"2023-01-28 15:23:23","config":{"timestamp":1674914600}}

@pisarenko-net
Copy link

Interestingly, the control works from Homekit itself. It's just from the Homebridge UI itself that the functionality doesn't work correctly.

@johannrichard
Copy link
Owner

Interestingly, the control works from Homekit itself. It's just from the Homebridge UI itself that the functionality doesn't work correctly.

Just to be sure I understand correctly: if you use the Homebridge UI to control the blinds, then (and only then) Homebridge crashes?

@pisarenko-net
Copy link

Interestingly, the control works from Homekit itself. It's just from the Homebridge UI itself that the functionality doesn't work correctly.

Just to be sure I understand correctly: if you use the Homebridge UI to control the blinds, then (and only then) Homebridge crashes?

Yes. To be more precise Homebridge UI doesn’t crash: it logs a failed request with a 400 response code. It just fails to control blinds but keeps operating.

johannrichard added a commit that referenced this issue Jan 29, 2023
fix the issues in #555 with tilt angle,
only convert `°` to `%` in case values is set by HomeKit

Fixes #555
@johannrichard
Copy link
Owner

Thanks @pisarenko-net and @whos-c for the reporting and patience. The additional info helped me (finally) identify the culprit. An alpha-version with a fix should be out soon, followed by a beta a few days later. As I don't have all the different FW versions to test with, I will depend on you providing some input on the fix. You can wait for the beta if you wish.

@github-actions
Copy link
Contributor

🎉 This issue has been resolved in version 3.4.3-alpha.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: In progress
Development

No branches or pull requests

3 participants