GithubHelp home page GithubHelp logo

nickduino / pi-somfy Goto Github PK

View Code? Open in Web Editor NEW
424.0 424.0 104.0 1.64 MB

A script to open and close your Somfy (and SIMU) blinds with a Raspberry Pi and an RF emitter.

License: Other

Python 42.15% CSS 9.15% HTML 15.84% JavaScript 32.72% Shell 0.14%

pi-somfy's People

Contributors

ajmawer avatar dennis-q avatar firewiremb avatar fraboch avatar gkfr avatar huanvu avatar incub77 avatar koddsson avatar lepirlouit avatar mahallon avatar markgodwin avatar metbosch avatar michaelb2018 avatar nickduino avatar nungesser avatar plicplocplicploc avatar rbswift avatar rosenpin avatar the-lazy-fox avatar timhannemann avatar tomschalld avatar vapouryh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pi-somfy's Issues

pigpiod constant cpu usage

Hi, is there any way to reduce the constant cpu usage by pigpiod? This process uses about 7-10% cpu on my pi constantly even when pi-somfy is not being used. Cheers

Improving the GUI

I've made a 3D render of a streamlined remote:
image

The objective is to replace this:
image

Any one has some knowledge of web designing and wants to help?
Possibly responsive design as well but not necessarily

Multiple remotes

Hi ! First of all, thank you very much for your work =)
I'd like to know if it's possible to keep the original remote. I mean, is it possible to open/close the blind with a virtual remote AND the "real remote" ?

Thanks !

Web GUI doesn’t work on iOS

On my iPhone running safari web browser I navigate to the web url and am unable to click the manual operation tab, so I can’t see the up/stop/down buttons. The only thing I see is +Add New for a new scheduled event. Clicking on settings or add/remove shutter doesn’t work either. Everything else works great on my laptop and with Alexa, just unable to use my iPhone browser. I also tried chrome on the iPhone with same results. Suggestions?

Stop doesn't work when blind is going up

Bit of an oddity. If I command the blind to go down, it does. If I try to stop it mid way, it stops fine. If I command the blind to go up, it does. If I try to stop it mid-way, nothing happens. If I use the remote to stop it after sending the up command via Pi-Somfy, it stops fine.

Within the log file for Pi-Somfy, the same button is showing as being pressed for stop whether the blind is going up or down and the rolling code sequence is correct.

Any suggestions?

Thanks

Chris

Help choosing supported hardware.

Hello, the technical specifications of my Somfy controller are the following:

Radio frecuency: 868.95 MHZ, io-homecontrol
Frecuency band of trasmission: 868.700 MHz - 869.200MHz
_

I been looking for a compatible crystal but I can't find anything on these frecuency.
Would the model that you are using works for me?
Where could I find something compatible?

Thank you in advance :)

additional antenna

Hi at no. 5
Solder an antenna to the ANT pad :
the link points to a 1 wire antenna ... do i need to bend it and solder both ends as in the image or it's ok one end only?
a bit confused ..
by the way thanks for the repo & instructions.
Flavius

Rolling code glitch

I don't know what happened:

image

The error:

image

I deleted line 108 and added 4 to the rolling code of line 98 for good measure. All seems well (the shutter works)

HomeKit support

Hi all,

This is an amazing app just wondered is there consideration for HomeKit development?

How to test if the emitter works?

I setup the software properly on my PI. Can't get my Awning (Markiluxx using Somfy) to pair though, even after putting it in programming mode. I have no clue whether or not the emitter works in the first place. Would appreciate any pointers.

Conflict with official remote?

Hi,
I was using the new webinterface and planification for weeks and now it just stopped working.
I touched nothing but I recently used the official remote manual.
Is there any kind of conflict possible?

Should I remove and reprogram it now to have it back working?

Thanks

Getting started

Hi,

I just found your repo and would be interested in some more details:

  1. How to set chambre.txt values?
  2. What kind of remote you are using, I have a "Somfy Smoove RTS" with three Buttons.
  3. What emitter you use, I have a cheap 433 MHz emitter from eBay.

Merci beaucoup in advance for your help,
Georg.

weather integration for awnings

I'm starting work on a weather module - integrates with Yahoo weather, and allowing user to register for closing the awning in case of rain/strong wind (wind speed configurable).
I will add this to work together with the CLI shcedule, but would need help to integrate it into the GUI.

Timing and Frame repetition

Hello,

I used your code and succeeded in registering and controlling my Somfy shades using an Aurel Transceiver (433.42MHz). I also checked the PushStack blog with details about the RTS protocol your code is based on. I noticed that you use a different timing (640us per half bit instead of 604us documented in the PushStack blog). The PushStack blog mentions that the timing is not critical but I wonder if there a special reason for that?
I have a few open questions, maybe you can help me:

  • Is it necessary to repeat the frame 3 times as you do in your code?
  • Do you have an idea how to implement a long press of the prog button to register/de-register a remote? Is this established by often repetition of the frame?
  • My original Somfy remote has a separate wheel (additionally to the 3+1 buttons) to adjust the angle of the blinds. My Somfy Telis 6 Chronis remote does not have this wheel but the angle can be adjusted by long pressing up or down. Do you have an idea how to implement this function? Is this a separate control code or is this established through frame repetition?

Thank you in advance!

Where can I buy the emitter ?

Hi,

Do you have any recommendation about which emitter buy ?

I looked on Aliexpress but I don't know what to buy.

Thanks

Using MQTT to control

Hi guys - this is awesome Great work. Im able to control, via the WebUI my Somfy shutter without changing the crystal on the 433 transmitter..although i have ordered some!

Anyway , my issue is that i cannot control my blind via MQTT.
As mentioned i can control it fine using the WebUI, - UP/DOWN/STOP all work very responsively..now i want to integrate it into OpenHAB using MQTT.

Pi-Somfy is communicating with my Mosquito. Its published:
somfy/0x279621/level/set_state
with values of 0 and 100

I couldnt see in the README any doco on how to use MQTT, but did find the issue comment here:
#50 (comment)
showing how to use it...

So i tried publishing :
somfy/0x279621/level/cmd
setting values 0 and 100
i also tried STOP, UP,up,DOWN,down

There is no action from my blind and nothing logged.

What am i doing wrong?

sendCommand repetition for Li-ion battery motor support

Hi,

Great project!

Is there a reason the SendRepeat parameter in the conf file is not used by operateShutters.py? It looks like repetition is hardcoded at 2 (or 1 for programming).

I've found the only way to get Li-ion battery powered motors to reliably wake up and process a command is to repeat the command 5 times. The genuine somfy remote also seems a bit less responsive with battery motors so I guess this is just a 'feature' :)

Even better, would it be possible to add a repetition parameter for each motor? Wired RTS motors don't seem to need repetition as much as battery powered motors.

Cheers,
Richard

Latest master (5b80b56) is broken

pi@raspberrypi ~/Pi-Somfy $ sudo python /home/pi/Pi-Somfy/operateShutters.py -a


This program requires the modules located from the same github repository that are not present.

Error: Non-ASCII character '\xc2' in file /home/pi/Pi-Somfy/myalexa.py on line 74, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details (myalexa.py, line 74)

The offending line is:

            self.LogInfo ("Remote address in dec: " + str(int(shutterId,16)) + ", WeMo port will be n°" + str(portId))

Should be easily fixable.

Problem with Ephem dependency on Aarch64

Can't install Ephem on Aarch64 through pip. Exits with:

unable to execute 'aarch64-linux-gnu-gcc': No such file or directory
error: command 'aarch64-linux-gnu-gcc' failed with exit status 1

I am on Debian Buster. I installed "python-ephem" through apt instead, but the script says "No module name 'ephem'".

Manual commands when WebUI is running

Hello,

Is there a way to be able to use manual commands like
sudo /home/pi/Pi-Somfy/operateShutters.py livingRoom -c /home/pi/Pi-Somfy/operateShutters.conf -d
when the WebUi is running?
I would like to call it from other systems.
Or is there anyway to send cli instructions to the webinterface?

Best

Choosing a licence

Michael, now that we are several (2>>1 :-D) working on the project, I believe we should choose a licence.

I don't have much of a personal preference, although I quite like the idea of allowing only non-commercial uses of the project.

IndentationError in somfy.py

Hello,

thank you for your code example to show how one can control somfy blinds.

I just tried to register my raspberry as a new remote. But when I execute the somfy.py I get an IndentationError in the sending function.

It seems to me that the problem is in that area:


.
.
.
wf.append(pigpio.pulse(0, 1<<TXGPIO, 30415)) # interframe gap

  for j in range(1,repetition): # repeating frames
        for i in range(7): # hardware synchronization
              wf.append(pigpio.pulse(1<<TXGPIO, 0, 2560))
              wf.append(pigpio.pulse(0, 1<<TXGPIO, 2560))
        wf.append(pigpio.pulse(1<<TXGPIO, 0, 4550)) # software synchronization
        wf.append(pigpio.pulse(0, 1<<TXGPIO,  640))

        for i in range (0, 56): # manchester enconding of payload data
              if ((frame[i/8] >> (7 - (i%8))) & 1):
              wf.append(pigpio.pulse(0, 1<<TXGPIO, 640))
              wf.append(pigpio.pulse(1<<TXGPIO, 0, 640))
              else:
              wf.append(pigpio.pulse(1<<TXGPIO, 0, 640))
              wf.append(pigpio.pulse(0, 1<<TXGPIO, 640))

        wf.append(pigpio.pulse(0, 1<<TXGPIO, 30415)) # interframe gap

pi.wave_add_generic(wf)
.
.
.

The number of blanks in front of the "for j in range(1,repetition)... could be the problem.

Could you please check the code and/or give me a hint how to use it in a correct way.

Thanks a lot!
Uwe

Web Gui an Comandline together

Hi,
how can I use Web Gui an Comandline together?
If Webgui is started, comands from comandline didn´t work.
Kind regards

Alexa integration: only up/down is possible

Hi guys,

I was wondering if you plan to enhance Alexa integration by adding the possibility to stop the blinds? At the moment I can only make them either completely opened or closed which is rather limited :-(
Thank a lot for your work! Great project!

Make it work

Hello,

I'm trying the code provided but nothing seems happening.
Python is pretty new to me.
I tried to close my shaders with this code:

#!/usr/bin/env python
# -*- coding: utf-8 -*-

import locale
import time
import datetime as dt
import ephem
import pigpio
import traceback

TXGPIO=4 # 433.42 MHz emitter on GPIO 4

#Button values
boutonHaut = 0x2
boutonStop = 0x1
boutonBas = 0x4

frame = bytearray(7)

homeLocation = ephem.Observer()
homeLocation.lat, homeLocation.lon = '42.764457', '5.066435' #PUT YOUR OWN COORDINATES HERE (check on Google Maps for instance)
locale.setlocale(locale.LC_TIME,'')


def envoi_commande(telco, bouton): #Sending a frame
   checksum = 0
   
   with open("somfy/" + telco + ".txt", 'r') as file:# the files are un a subfolder "somfy"
      data = file.readlines()

   teleco = int(data[0], 16)
   code = int(data[1])
   data[1] = str(code + 1)

   print hex(teleco)
   print code

   with open("somfy/" + telco + ".txt", 'w') as file:
      file.writelines(data)

   pi = pigpio.pi() # connect to Pi

   if not pi.connected:
      exit()

   pi.wave_add_new()
   pi.set_mode(TXGPIO, pigpio.OUTPUT)


   print "Remote  :      " + "0x%0.2X" % teleco
   print "Button  :      " + "0x%0.2X" % bouton
   print "Rolling code : " + str(code)
   print ""

   frame[0] = 0xA7;       # Encryption key. Doesn't matter much
   frame[1] = bouton << 4 # Which button did  you press? The 4 LSB will be the checksum
   frame[2] = code >> 8               # Rolling code (big endian)
   frame[3] = (code & 0xFF)           # Rolling code
   frame[4] = teleco >> 16            # Remote address
   frame[5] = ((teleco >>  8) & 0xFF) # Remote address
   frame[6] = (teleco & 0xFF)         # Remote address

   print "Frame  :    ",
   for octet in frame:
      print "0x%0.2X" % octet,
   print ""

   for i in range(0, 7):
      checksum = checksum ^ frame[i] ^ (frame[i] >> 4)

   checksum &= 0b1111; # We keep the last 4 bits only

   frame[1] |= checksum;

   print "With cks  : ",
   for octet in frame:
      print "0x%0.2X" % octet,
   print ""

   for i in range(1, 7):
      frame[i] ^= frame[i-1];

   print "Obfuscated :",
   for octet in frame:
      print "0x%0.2X" % octet,
   print ""

#This is where all the awesomeness is happening. You're telling the daemon what you wana send
   wf=[]
   wf.append(pigpio.pulse(1<<TXGPIO, 0, 9415))
   wf.append(pigpio.pulse(0, 1<<TXGPIO, 89565))
   for i in range(2):
      wf.append(pigpio.pulse(1<<TXGPIO, 0, 2560))
      wf.append(pigpio.pulse(0, 1<<TXGPIO, 2560))
   wf.append(pigpio.pulse(1<<TXGPIO, 0, 4550))
   wf.append(pigpio.pulse(0, 1<<TXGPIO,  640))

   for i in range (0, 56):
      if ((frame[i/8] >> (7 - (i%8))) & 1):
         wf.append(pigpio.pulse(0, 1<<TXGPIO, 640))
         wf.append(pigpio.pulse(1<<TXGPIO, 0, 640))
      else:
         wf.append(pigpio.pulse(1<<TXGPIO, 0, 640))
         wf.append(pigpio.pulse(0, 1<<TXGPIO, 640))

   wf.append(pigpio.pulse(0, 1<<TXGPIO, 30415))

   #2
   for i in range(7):
      wf.append(pigpio.pulse(1<<TXGPIO, 0, 2560))
      wf.append(pigpio.pulse(0, 1<<TXGPIO, 2560))
   wf.append(pigpio.pulse(1<<TXGPIO, 0, 4550))
   wf.append(pigpio.pulse(0, 1<<TXGPIO,  640))

   for i in range (0, 56):
      if ((frame[i/8] >> (7 - (i%8))) & 1):
         wf.append(pigpio.pulse(0, 1<<TXGPIO, 640))
         wf.append(pigpio.pulse(1<<TXGPIO, 0, 640))
      else:
         wf.append(pigpio.pulse(1<<TXGPIO, 0, 640))
         wf.append(pigpio.pulse(0, 1<<TXGPIO, 640))

   wf.append(pigpio.pulse(0, 1<<TXGPIO, 30415))

   #2
   for i in range(7):
      wf.append(pigpio.pulse(1<<TXGPIO, 0, 2560))
      wf.append(pigpio.pulse(0, 1<<TXGPIO, 2560))
   wf.append(pigpio.pulse(1<<TXGPIO, 0, 4550))
   wf.append(pigpio.pulse(0, 1<<TXGPIO,  640))

   for i in range (0, 56):
      if ((frame[i/8] >> (7 - (i%8))) & 1):
         wf.append(pigpio.pulse(0, 1<<TXGPIO, 640))
         wf.append(pigpio.pulse(1<<TXGPIO, 0, 640))
      else:
         wf.append(pigpio.pulse(1<<TXGPIO, 0, 640))
         wf.append(pigpio.pulse(0, 1<<TXGPIO, 640))

   wf.append(pigpio.pulse(0, 1<<TXGPIO, 30415))

   pi.wave_add_generic(wf)
   wid = pi.wave_create()
   pi.wave_send_once(wid)
   while pi.wave_tx_busy():
      pass
   pi.wave_delete(wid)

   pi.stop()
   

envoi_commande("salon", boutonBas)

sudo ./som.py

0x267043
124
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Can't connect to pigpio at localhost(8888)

Did you start the pigpio daemon? E.g. sudo pigpiod

Did you specify the correct Pi host/port in the environment
variables PIGPIO_ADDR/PIGPIO_PORT?
E.g. export PIGPIO_ADDR=soft, export PIGPIO_PORT=8888

Did you specify the correct Pi host/port in the
pigpio.pi() function? E.g. pigpio.pi('soft', 8888)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

sudo pigpiod
sudo ./som.py

0x267043
125
Remote  :      0x267043
Button  :      0x04
Rolling code : 125

Frame  :     0xA7 0x40 0x00 0x7D 0x26 0x70 0x43
With cks  :  0xA7 0x47 0x00 0x7D 0x26 0x70 0x43
Obfuscated : 0xA7 0xE0 0xE0 0x9D 0xBB 0xCB 0x88

But nothing happend.
Do I have to register the remote? Can you please provide some code examples?
Thanks!

Echo spot: ok; Echo 2: not ok

I have two Amazon devices : one echo spot (controlled from an Android device) and an Amazon echo 2 (paired with an iPhone and an iPad). The devices are configured on two different Amazon accounts but are connected through the same WiFi network.

The echo spot does find the fauxmo devices and controls them alright, its bigger brother doesn't

What to do if alexa doesn't discover shutters?

Hi, great project!
I tried to start the server multiple times with -a-e switches, but alexa doesn't seem to discover any shutter.
The webui works and operates well on my defined shutters. Any advice here?

stacktrace on stop command

hi!

when i issue a stop command like
/home/pi/Pi-Somfy/operateShutters.py b2 -c /home/pi/Pi-Somfy/operateShutters.conf -s

i get the following stacktrace:

Traceback (most recent call last):
  File "/home/pi/Pi-Somfy/operateShutters.py", line 533, in <module>
    MyShutter = operateShutters(args = args)
  File "/home/pi/Pi-Somfy/operateShutters.py", line 368, in __init__
    self.ProcessCommand(args);
  File "/home/pi/Pi-Somfy/operateShutters.py", line 427, in ProcessCommand
    self.shutter.stop(self.config.ShuttersByName[args.shutterName])
  File "/home/pi/Pi-Somfy/operateShutters.py", line 155, in stop
    secondsSinceLastCommand = int(round(time.monotonic() - state.lastCommandTime))
TypeError: unsupported operand type(s) for -: 'float' and 'NoneType'

the command still gets executed, though.

great project, btw. - thanks a lot for this!
best regards

Open-source license?

Hi @Nickduino, thanks so much for making this code public! Just wanted to ask if you'd be willing to throw some sort of a open-source license on the code—I'm hoping to publish a modification that integrates with Amazon Alexa, and I don't want to be stealing your work. 🍻

MQTT /Home Assistant integration

I have set up Home Assistant with hass,io and added in MQTT. I have gone through all the instructions in Pi-Somfy to set up integration with MQTT. I'm at the stage where I can send a an mosquitto command to open a blind, that shows up if I monitor the messages. In Home Assistant the MQTT log shows a connection and then a disconnection:

1580244209: New connection from 172.30.32.1 on port 1883.
1580244209: New client connected from 172.30.32.1 as mosqpub|3834-raspberryp (p2, c1, k60, u'neil').
1580244209: Client mosqpub|3834-raspberryp disconnected.

However, the blinds don't respond, and there are no Somfy devices showing in Home Assistant. What should I expect to see in HA, and why no response from the blinds. Is it normal for the client to connect to MQTT and then disconnect immediately (ie just passing a message and disconnecting) or should the connection to permanent?

Thanks

Reading normal Somfy Remotes

Hi guys,

I haven't tested yet this project, but I was using a simple one which could open and close my Somfy blinds. So, your project seems to better, congratulations!

I know that the somfy motors won't provide a feedback to allow us to know the blinds position, like 30% down. We can only request down, up and stop, but no feedback.

Using a timer, we can predict where the blinds are as the raspberry pi will send down/up and the code will know how long it takes to roll over. Easy I guess.

However, if someone has used the traditional remote control, the raspberry will be out of sync and it is not going to work.

I am planning to develop an extension of your code to use the receiver 433Mhz to receive the original somfy remotes input. So, if someone uses the remote to put the blinds down/up, the raspberry pi will be able to receive this information and track the blinds position. Have you guys tried to use the receiver that comes together with the transmitter?

I would like to have this feature as I will put the blinds down based on the sunlight coming from the window to ensure that I won't damage the furniture and at the same time keep a bright room .

What so you guys think?

I will also put this to work with HA, so everything will be manageable and automatized.

Thanks guys

Sunset-sunrise as argument

The way I see it, the day starts in the morning and end in the evening, I'd prefer it if the first argument passed was to open he blinds (accepting a negative value if you want to open them before sunrise) the the second to close them.

image

Moreover, we may want to use the astronomical data at night but not in the morning (open at 7 every day, close right after sunset) so I think we should seperate that in three arguments:

  • -t time
  • -m sunrise
  • -n sunset

persist shutter position

It might be nice to persist each shutter position perhaps in a [ShutterPositions] section of the .conf file similar to how the rolling codes are persisted. This would make the software more reliable for users who restart their raspberry Pi regularly or occasionally. The position could also then be represented in the Web UI.

This is a bit beyond my capabilities unfortunately but perhaps if I get more into python I will revisit this myself if nobody else beats me to it.

About changing the saw oscillator

Hi !

I'm pulling another issue because I don't know how to change the saw oscillator and i cant' find anything on google. Do i have to desolder the actual oscillator and solder the new one or is there something else I don't get ? :)

Anyway thanks for everything !

Can you help with a supported transmitter ?

I really like this project, but I cant get the pi to communicate with the blinds, I am new to this kind of stuff, but i am pretty sure that my problem is the transmitter.

I have bought this one:
http://www.ebay.com/itm/5x-433MHz-RF-Transmitter-Receiver-Kit-Module-Arduino-ARM-WL-MCU-Raspberry-PI-/162102463039?hash=item25be0f4a3f:g:xikAAOSwnNBXXm2E

and replaced the Crystal with this one:
http://www.ebay.com/itm/331637441887

but they don't respond at all

I have a working Telis 6 and Telis 5 remote for the system today

Could it be possible for me to buy a working transmitter module for the raspberry pi from you ?

How to reverse remote buttons

First of all, thank you for sharing your awesome work on this project!!!

This is exactly what I needed and saved me the pain of trying to figure it out. I have a Sunsetter Awning that has a Somfy remote control built in. I also run Home Assistant on a Pi (Hassbian) and got this up and running in no time at all. Great Read Me.

I have one issue with my Awning. I reverses the remote button function from "normal". Even though it's possible to reverse remote button operation programmatically between the remote and receiver, the Sunsetter Awning will not function properly with them reversed, it's strictly prohibited for some reason. So my Home Assistant UI shows the Awning OPEN all the time unless it's in the full open position, then it registers as CLOSED.

I would like to reverse this behavior in this code. I think I might be able to configure some Cover Template in Home Assistant to revers it, but I'm not positive. I would rather mod this code to reverse the behavior at the source, rather than programming around the issue in Home Assistant. Maybe this could be a new option in the conf file? Could you point me to all the places I should touch to mod the code?

Thanks!

(NOT and issue) Not sure how to contact you.

I was wondering how/if it is possible to add IFTTT functionality to this. If possible I'm looking to get some small door sensors that will go on the blinds and will integrate with stringify.

Thanks.

additions to great project

Finally got my pi-somfy to run (issue #13 took me a while to resolve.) So I upgraded the script to Python 3, added a command line interface to it so that it can easily operate via cron, then added a flask based web-site to it that allows to program & configure multiple shutters to operate at a reasonable complex schedule (instead of hard coding the schedule) and finally built an Amazon Alexa interface, so shutters react to voice commands. Some screen shots are attached for your reference.

So the question is if you want to take my code and check it in in the main repository (preferred, I can send it over if you want). Alternatively if you prefer I could fork the project too.


p1

p2

p3

p4

Stop button press sends invalid level to MQTT

If I send a Stop button command to an already stopped blind I get what looks like an invalid level state message via MQTT. For example:

# mosquitto_sub -h localhost -t 'somfy/#' -v
somfy/0x279623/level/set_state 1204
somfy/0x279623/level/set_state 1041

I believe this should be 0-100

Running Pi-Somfy from another Python script linked to heating control

With help from others on this project I have my blinds controlled by Pi-Somfy and Alexa. I would now like to link this to information from my central heating program (tado) so that when everyone is out of the house the blinds will close (perhaps also subject to other conditions, but that's for another time). I have been able to access data from tado and download and save it in a text file on my Raspberry Pi, and create a Python script that will identify if the string that indicates whether the occupants are in (HOME or AWAY). I now want to use this IF statement to trigger Pi-Somfy to close my two blind, but this is where I am struggling, mainly because I am a virtual Python beginner.

The script I have below (HOME would be replaced with AWAY in the final version) checks if the word HOME is in the text file and then if so prints the text and confirms "True":

#!/usr/bin/python3
w = ("HOME") # For Python 3: use input() instead
with open('/home/pi/libtado/tadostate.txt') as f:
found = False
for line in f:
if w in line: # Key line: check if w is in the line.
print(line)
found = True
print (found)
if not found:
print('The word cannot be found!')

I have used various web resources to help me figure out the syntax I need to run the Pi-Somfy instruction to close a blind (replacing the three lines currently within the IF statement), but all attempts have not worked. I'm think that in part this is due to incorrect file structure and/or paths (relevant part of directory tree below)

  ├── myscheduler.pyc
│   ├── mywebserver.py
│   ├── mywebserver.pyc
│   ├── operateShutters.conf
│   ├── operateShutters.py
│   ├── pycache
│   │   ├── fauxmo.cpython-37.pyc
│   │   ├── myalexa.cpython-37.pyc
│   │   ├── myconfig.cpython-37.pyc
│   │   ├── mylog.cpython-37.pyc
│   │   ├── mymqtt.cpython-37.pyc
│   │   ├── myscheduler.cpython-37.pyc
│   │   └── mywebserver.cpython-37.pyc
│   └── README.md
├── Public
├── tado
├── tadoquery
│   ├── init.py
│   └── tadoquery4.py
├── tadoquery2.py
├── tadoquery3.py
├── tadoquery.py
├── Templates
└── Videos

Currently I have the above script (tadoquery4.py) in a home/pi/tadoquery directory together with a blanks init.py file and have used the line 'from .import operateShutters' really just to see if would recognise the operateShutters.py, but this returns 'cannot import name 'operateShutters' from 'main' (/home/pi/tadoquery/tadoquery4.py)'. I have previously had the tadoquery4.py file in the home/pi directory (ie the same directory as operateShutters.py) but that also did not work. Of course, import may be competely the wrong method for what I am trying to do!

So I am unclear how to run the operateShutters.py script from within my tadoquery4.py script and how to specify the parameters (blind name and open or close).

I would be very grateful for some help on this.

socket.error: [Errno 104] Connection reset by peer

Trying to use this library. The code seems to work fine is I call

def envoi_commande(telco, bouton, repetition):

with a repetition of 1. But as soon as I put repetition 2, I get the following error:

Traceback (most recent call last):
  File "./somfy.py", line 141, in <module>
    envoi_commande("chambre", buttonStop, 2)
  File "./somfy.py", line 132, in sendCommand
    pi.wave_add_generic(wf)
  File "/usr/lib/python2.7/dist-packages/pigpio.py", line 2120, in wave_add_generic
    self.sl, _PI_CMD_WVAG, 0, 0, len(pulses)*12, extents))
  File "/usr/lib/python2.7/dist-packages/pigpio.py", line 1007, in _pigpio_command_ext
    dummy, res = struct.unpack('12sI', sl.s.recv(_SOCK_CMD_LEN))
**socket.error: [Errno 104] Connection reset by peer**

Any ideas?

Update README with Getting Started

Great project! I want to use that as a starting point for my Somfy blinds as well.

Can you add a "Getting Started" section to the README, that explains for beginners how to get this basically working? I already have a transmitter and the custom crystals, and need to figure out the following:

  • Connect transmitter with replaced crystal to Raspberry Pi
  • Register transmitter as additional Remote for each blind
  • Actually control the different blinds, to see if everything is working

What I want to add then is:

  • Alexa integration

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.