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

Added state and position update for Somfy shutters #6

Open
wants to merge 68 commits into
base: master
Choose a base branch
from

Conversation

zapccu
Copy link

@zapccu zapccu commented Nov 13, 2024

Hi,
this PR contains a lot of changes to your repo. I - more or less - rewrote somfy_shutter.py to support updates via mqtt for state and position of a shutter. The position is calculated by measuring the drive time (either manually or automatically).

To determine the up and down time of a shutter I introduced a new CALIBRATE command, which must be published in the payload of a mqtt set. I updated the doc in somfy.md accordingly. I also changed the config message sent to Homeassistant when the program is started (added state and position, removed optimistic).

I also made some minor changes to almost all other python files:

  • Substituted some raise exception statements by logging statements to make the program more robust
  • Added exception handlers for file I/O errors
  • Handle signals to terminate the program gracefully when receiving a SIGTERM from systemd (prevent status "failed")
  • Added a command line option for specifying an ini file
  • Added a debug option to the ini file
  • Added a logfile option to the ini file (all logging messages are written to this file)
  • Fixed some bugs
  • Added install.md with a description on how to install the program on a Debian or Raspbian system

Unfortunately there's still a bug in handling the Somfy device address. Actually the address must be stored in little endian format, currently it's in big endian format. So byte 1 and 3 should be swapped when composing the message. Changing this would break all existing device pairings. That's why I didn't change it.

Running the new version now for some days with 2 Somfy shutters and everything is working as expected.

BR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant