Pi-Somfy icon indicating copy to clipboard operation
Pi-Somfy copied to clipboard

Alexa Discovery Temp Fix

Open vapouryh opened this issue 1 year ago • 1 comments

As known, Alexa is unable to discover the blinds when running operateShutters.py -e.

At the moment, I created a temporary fix to overcome this by using https://github.com/n8henrie/fauxmo simultaneously with Pi-Somfy. This works by calling the HTTP API from the webserver to open and shut the blinds. You will need to find your shutter id with the networking tools in your web browser when manually operating the blinds via the web UI. The payload will contain the shutters id which you can update in fauxmo_config.json. You will need to reinstall the daemon service to use the new start-up script. To use multiple blinds within the alexa integration, add more devices to the fauxmo_config.json. Hopefully OP (@Nickduino) implements the up-to-date fauxmo repo by @n8henrie and can properly integrate it within the program so the process is much more streamlined and works as it should. Unfortunately, I don't have to time to research further into the project to make this work seamlessly but from what I can gather, Alexa now requires some sort of byte response as mandatory and in it's current configuration, Alexa does not receive a discovery response from the program, it could be because of this? I also saw somewhere that Alexa needs the state of the device - with the current implementation it uses a fake state but when you call Alexa and tell her to open the blinds it will set the device on and off accordingly anyway, it's only really annoying if you use the Alexa app for example and see that the device is 'on' (blinds open) when they are shut; still - turn the device off and on with the app and it works as usual. I did look over and see if there was a state handler within the program but I myself am not very familiarised with OOP and so didn't spend much time investigating. But, for now, this works and is a suitable enough fix for me. Additionally, you will need to alter the https://github.com/n8henrie/fauxmo files. Please see: https://github.com/n8henrie/fauxmo/issues/122 where this seperate issue is documented. That said, I am grateful for this project as I can now control my blinds hands-free.

vapouryh avatar Feb 11 '24 01:02 vapouryh

This fix has the fauxmo service spitting out info into the terminal. Perhaps this is better by seperating the services and using a seperate, non-privileged user to run the fauxmo service.

vapouryh avatar Feb 11 '24 01:02 vapouryh

@vapouryh -- to be clear, it looks like this project is using the old makermusings fauxmo project that I forked, and not my project. I have rewritten almost all of the core logic of the library, so I wouldn't expect changes from n8henrie/fauxmo to be easily implemented here unless they rebased on my project.

YMMV!

n8henrie avatar Feb 19 '24 16:02 n8henrie

@MichaelB2018 What's your take?

Nickduino avatar Feb 19 '24 18:02 Nickduino

Thanks @vapouryh & @n8henrie . As you may have guessed, I took the code years ago and that time it was working. I'm aware that the code moved on (Thanks: @n8henrie !!!), but I stopped using it and so never got to clean it up. If anybody has some time to bring it up to the latest version, that would be great!

MichaelB2018 avatar Feb 20 '24 23:02 MichaelB2018