Skip to content

ScratMan/SomfyProtect2MQTT

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SomfyProtect2MQTT

Somfy Protect to MQTT

What is Working

This an alpha dev version

  • Retreive some status of the alarm and his devices.
  • Set security level: armed, disarmed, partial.
  • HA MQTT Discovery.
  • Stop the Alarm
  • Trigger the Alarm
  • Update Device Settings
  • Send Action to device (Open/Close Camera Shutter)
  • Get lastest Camera snapshot
  • Retrieve Smoke Detector status

Ex:

SomfyProtect

TODO

  • Test all things (/)
  • Validate Somfy OutDoor Camera (/)
  • Try to retreive Camera Stream
  • TBD

Installation

Easy Mode (via HomeAssistant Supervisor)

Open your Home Assistant instance and show the add add-on repository dialog with a specific repository URL pre-filled.

In HomeAssistant, go to Supervisor > Add-on Store > Repositories Add this repo: https://github.com/minims/homeassistant-addons/

Configure it with you credentials Then all Devices will appaears in MQTT integration

Easy Mode (Running in Docker Container)

Add docker container docker run -v <PATH-TO-CONFIG-FOLDER>:/usr/src/SomfyProtect2MQTT/somfyProtect2Mqtt/config treynaer/somfyprotect2mqtt

Add config to <PATH-TO-CONFIG-FOLDER>

Manual Mode

Clone the repo Go to dev branch

cd /opt/
git clone https://github.com/Minims/SomfyProtect2MQTT.git
git checkout dev # if you want the dev branch
cd /opt/SomfyProtect2MQTT/

Install Python3 dependencies

pip3 install -r  somfyProtect2Mqtt/requirements.txt

Copy config file and setup your own credentials for SomfyProtect & MQTT.

cd /opt/SomfyProtect2MQTT/somfyProtect2Mqtt
cp config/config.yaml.example config/config.yaml

Running

cd SomfyProtect2MQTT/somfyProtect2Mqtt
python3 main.py

Systemd (Running in background on boot)

5. (Optional) Running as a daemon with systemctl

To run SomfyProtect2MQTT as daemon (in background) and start it automatically on boot we will run SomfyProtect2MQTT with systemctl.

# Create a systemctl configuration file for SomfyProtect2MQTT
sudo nano /etc/systemd/system/somfyProtect2mqtt.service

Add the following to this file:

[Unit]
Description=somfyProtect2mqtt
After=network.target

[Service]
WorkingDirectory=/opt/SomfyProtect2MQTT/somfyProtect2Mqtt
ExecStart=/usr/bin/python3 /opt/SomfyProtect2MQTT/somfyProtect2Mqtt/main.py
StandardOutput=inherit
# Or use StandardOutput=null if you don't want SomfyProtect2MQTT messages filling syslog, for more options see systemd.exec(5)
StandardError=inherit
Restart=always
User=pi

[Install]
WantedBy=multi-user.target

Save the file and exit.

Verify that the configuration works:

# Start SomfyProtect2MQTT
sudo systemctl start somfyProtect2mqtt

# Show status
systemctl status somfyProtect2mqtt.service

Now that everything works, we want systemctl to start SomfyProtect2MQTT automatically on boot, this can be done by executing:

sudo systemctl enable somfyProtect2mqtt.service

Done! 😃

Some tips that can be handy later:

# Stopping SomfyProtect2MQTT
sudo systemctl stop somfyProtect2mqtt

# Starting SomfyProtect2MQTT
sudo systemctl start somfyProtect2mqtt

# View the log of SomfyProtect2MQTT
sudo journalctl -u somfyProtect2mqtt.service -f

Developement

This code is base on reverse engineering of the Android Mobile App.

python3 -O -m enjarify.main ../com-myfox-android-mss1610600400.apk
ls
com-myfox-android-mss1610600400-enjarify.jar

So if you want to contribue, have knowledge in JAVA / APK, you can help to find all API calls used in the APP. We can integrate here (https://github.com/Minims/somfy-protect-api) to use it.

  • Use APKTool to get smali files and all available API Endpoints

About

Somfy Protect to MQTT

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 99.0%
  • Dockerfile 1.0%