Page 2 of 2
Re: Adding Somfy blinds to domoticz using 433.92 crystal
Posted: Monday 20 April 2020 12:31
by FireWizard
@Havym
Hello,
Let us conclude first.
The fact that you get the log file means that the exec.sh script is executed.
It is the same, if you execute it from the command line. This was expected.
I assume that in case it is activated from Domoticz, the actions is not carried out.
Both closing and opening?
If you do it from the command line it is carried out?
What is the owner ship of the log files? (ls -l)
Can you try to modify the exec.sh script, so that the last line moves up?
Code: Select all
#!/bin/sh
/usr/bin/python /home/pi/domoticz/scripts/$1.py $2 $3 > /dev/null 2>&1 &
NOW=$(date +"%Y-%m-%d")
LOGFILE=/home/pi/controller.$NOW.log
echo $(date +"%Y-%m-%d %H:%M:%S") controller | tee -a $LOGFILE
Another question.
A directory called "remotes" is used. What are the ownership and access rights of this directory?
Awaiting your results.
Regards
Re: Adding Somfy blinds to domoticz using 433.92 crystal
Posted: Monday 20 April 2020 15:00
by Havym
FireWizard wrote: ↑Monday 20 April 2020 12:31
I assume that in case it is activated from Domoticz, the actions is not carried out.
Both closing and opening?
If you do it from the command line it is carried out?
What is the owner ship of the log files? (ls -l)
Can you try to modify the exec.sh script, so that the last line moves up?
Code: Select all
#!/bin/sh
/usr/bin/python /home/pi/domoticz/scripts/$1.py $2 $3 > /dev/null 2>&1 &
NOW=$(date +"%Y-%m-%d")
LOGFILE=/home/pi/controller.$NOW.log
echo $(date +"%Y-%m-%d %H:%M:%S") controller | tee -a $LOGFILE
Another question.
A directory called "remotes" is used. What are the ownership and access rights of this directory?
Awaiting your results.
Regards
Hi,
In command line i only tried the close action and nothing happend to the screen with this script in exec.sh.
The folder 'remotes' is owned by pi
Code: Select all
drwxr-xr-x 2 pi pi 4096 Apr 18 12:22 remotes
When i change the exec.sh in command line and nothing happens with the screen.
Code: Select all
pi@raspberrypi:~ $ /home/pi/domoticz/scripts/exec.sh Overkapping close
2020-04-20 14:55:21 controller
The log file:
First 2 are made in commandline and second 2 in domoticz
Code: Select all
2020-04-20 14:54:49 controller
2020-04-20 14:55:21 controller
2020-04-20 14:57:01 controller
2020-04-20 14:57:06 controller
Re: Adding Somfy blinds to domoticz using 433.92 crystal
Posted: Monday 20 April 2020 16:43
by FireWizard
Hi,
@Havym
We keep on trying
You wrote:
When i change the exec.sh in command line and nothing happens with the screen.
This means that using the latest exec.sh file both Domoticz and the command line are not able to open/close the screen?
If you run the following command as user pi, the screen should open/close
Code: Select all
/usr/bin/python /home/pi/domoticz/scripts/controller.py Overkapping open > /dev/null 2>&1 &
or
Code: Select all
/usr/bin/python /home/pi/domoticz/scripts/controller.py Overkapping close > /dev/null 2>&1 &
If this is the case, we should try to modify the script to:
Code: Select all
#!/bin/sh
/usr/bin/python /home/pi/domoticz/scripts/controller.py Overkapping close > /dev/null 2>&1 &
NOW=$(date +"%Y-%m-%d")
LOGFILE=/home/pi/controller.$NOW.log
echo $(date +"%Y-%m-%d %H:%M:%S") controller | tee -a $LOGFILE
Let us try
Regards
Re: Adding Somfy blinds to domoticz using 433.92 crystal
Posted: Monday 20 April 2020 17:08
by Havym
Thank you for you patience
This works!
Code: Select all
/usr/bin/python /home/pi/domoticz/scripts/controller.py Overkapping close > /dev/null 2>&1 &
Code: Select all
pi@raspberrypi:~ $ /usr/bin/python /home/pi/domoticz/scripts/controller.py Overkapping close > /dev/null 2>&1 &
[1] 28694
pi@raspberrypi:~ $ /usr/bin/python /home/pi/domoticz/scripts/controller.py Overkapping open > /dev/null 2>&1 &
[2] 30027
[1] Done /usr/bin/python /home/pi/domoticz/scripts/controller.py Overkapping close > /dev/null 2>&1
I changed the exec.sh file and now the screen closes!
Code: Select all
pi@raspberrypi:~ $ /home/pi/domoticz/scripts/exec.sh
2020-04-20 17:04:17 controller
I even tried it in domoticz as i would expect you ask me to try. Unfortunate in domoticz it doenst work.
Code: Select all
2020-04-20 17:06:48.624 Status: User: Admin initiated a switch command (153/Zonnescherm/Off)
2020-04-20 17:06:48.858 Status: Executing script: /home/pi/domoticz/scripts/exec.sh
Re: Adding Somfy blinds to domoticz using 433.92 crystal
Posted: Monday 20 April 2020 18:28
by FireWizard
@Havym
So the command
/usr/bin/python /home/pi/domoticz/scripts/controller.py Overkapping close > /dev/null 2>&1 &
works.
I assume that
/usr/bin/python /home/pi/domoticz/scripts/controller.py Overkapping open > /dev/null 2>&1 &
also works.
If you control it via the exec.sh script with the contents of "close", it closes and creates a log file?
You should rename the exec.sh file to e.g. exec_close.sh.
Similar create an identical file e.g exec_open.sh with the second command (open) in it.
Run it first from the command line and test that both commands function, if you run ./exec_close.sh or ./exec_open.sh from the scripts directory.
Next try to control it from Domoticz: with the ON and OFF scripts.
1. ON: ///home/pi/domoticz/scripts/exec_close.sh
2. OFF: ///home/pi/domoticz/scripts/exec_open.sh
Check also that a log file is created.
Lets try
Regards
Re: Adding Somfy blinds to domoticz using 433.92 crystal
Posted: Monday 20 April 2020 22:08
by Havym
Correct both commands worked and creates a log line in the file of today.
Code: Select all
pi@raspberrypi:~ $ /usr/bin/python /home/pi/domoticz/scripts/controller.py Overkapping close > /dev/null 2>&1 &
[1] 28694
Line in log file:
Code: Select all
pi@raspberrypi:~ $ /usr/bin/python /home/pi/domoticz/scripts/controller.py Overkapping open > /dev/null 2>&1 &
[2] 30027
[1] Done /usr/bin/python /home/pi/domoticz/scripts/controller.py Overkapping close > /dev/null 2>&1
But '/home/pi/domoticz/scripts/controller.py Overkapping close' workes too, the screen closes because i moved the 'remotes' folder:
Code: Select all
pi@raspberrypi:~ $ /home/pi/domoticz/scripts/controller.py Overkapping close
Action : close
Room : Overkapping
Remote : 0x267043
Button : 0x04
Rolling code : 287
Frame : 0xA7 0x40 0x01 0x1F 0x26 0x70 0x43
With cks : 0xA7 0x42 0x01 0x1F 0x26 0x70 0x43
Obfuscated : 0xA7 0xE5 0xE4 0xFB 0xDD 0xAD 0xEE
But moving on with your suggestion.
I changed the file exec.sh to exec_close.sh and created exec_open.sh
Running the command with ./exec_close.sh gives me a log file but the screen wont work.
Code: Select all
pi@raspberrypi:~/domoticz/scripts $ ./exec_close.sh
2020-04-20 21:43:31 controller
Running the command with /home/pi/domoticz/scripts/exec_close.sh give me the same log file and the screen works.
Code: Select all
pi@raspberrypi:~ $ /home/pi/domoticz/scripts/exec_close.sh
2020-04-20 21:45:30 controller
The open command gives me an error.
pi@raspberrypi:~ $ /home/pi/domoticz/scripts/exec_open.sh
/home/pi/domoticz/scripts/exec_open.sh: 2: /home/pi/domoticz/scripts/exec_open.sh: cannot create /de$: Permission denied
Never mind.... typo
I think there something with the 'remote' folder. In the beginning i had to bind the sending code to the Somfy device and the code is stored in the 'remotes' folder.
Re: Adding Somfy blinds to domoticz using 433.92 crystal
Posted: Monday 20 April 2020 22:49
by FireWizard
Hi,
@Havym
If you suspect the remotes folder, I suggest that you remove the Sompi and remotes folder out of the Domoticz scripts folder.
A good place will be the pi home folder, so /home/pi/Sompi and /home/pi/Sompi/remotes.
Try to pair again and then we will look again.
Regards
Re: Adding Somfy blinds to domoticz using 433.92 crystal
Posted: Tuesday 21 April 2020 0:40
by Havym
Ok, so i deleted everything and started over.
The script and the remotes folder like
https://github.com/alxlaxv/SomPi are in /home/pi/SomPi and the controller is paired using
Code: Select all
./controller.py Overkapping register
Using in command line
gives me the following and the screens goes down.
Code: Select all
pi@raspberrypi:~/SomPi $ ./controller.py Overkapping close
Action : close
Room : Overkapping
Remote : 0x267043
Button : 0x02
Rolling code : 226
Frame : 0xA7 0x20 0x00 0xE2 0x26 0x70 0x43
With cks : 0xA7 0x27 0x00 0xE2 0x26 0x70 0x43
Obfuscated : 0xA7 0x80 0x80 0x62 0x44 0x34 0x77
Using in command line
Code: Select all
/home/pi/SomPi/controller.py Overkapping close
gives me this ..... and nothing happens to the screen.
Code: Select all
pi@raspberrypi:~ $ /home/pi/SomPi/controller.py Overkapping close
Action : close
Room : Overkapping
Traceback (most recent call last):
File "/home/pi/SomPi/controller.py", line 164, in <module>
send(sys.argv[1], sys.argv[2])
File "/home/pi/SomPi/controller.py", line 43, in send
with open("remotes/" + room + ".txt", 'r') as file:
IOError: [Errno 2] No such file or directory: 'remotes/Overkapping.txt'
The error is there because there is no 'remotes' folder in /home/pi from which the command is run from.
When i copy the 'remotes' folder to /home/pi i need to repair Somfy and the other paired one doenst work anymore.
So i think its in the script that causes issues from running in Domoticz
Re: Adding Somfy blinds to domoticz using 433.92 crystal
Posted: Tuesday 21 April 2020 20:00
by FireWizard
Hi,
This means that the "remotes" directory has to be in the same directory as where the command is run? I thought, it was a subdir in Sompi.
Let think about it.
Regards
Re: Adding Somfy blinds to domoticz using 433.92 crystal
Posted: Tuesday 21 April 2020 21:50
by Havym
Correct, remotes is a subdir in Sompi and the script refers to Overkapping.txt where the Somfy code is stored.
Verstuurd vanaf mijn ONEPLUS A6013 met Tapatalk
Re: Adding Somfy blinds to domoticz using 433.92 crystal
Posted: Tuesday 21 April 2020 22:02
by FireWizard
Hi,
@Havym
Is this something, you did look at?
https://github.com/Nickduino/Pi-Somfy
Regards
Re: Adding Somfy blinds to domoticz using 433.92 crystal
Posted: Wednesday 22 April 2020 0:12
by Havym
Yes i tried that one and it worked for a short time, but my raspberry crashed using this script.
This one is more complex then the SomPi scripts... but i can try again.
But i havent got any idea how to implement this one into domoticz either.
Re: Adding Somfy blinds to domoticz using 433.92 crystal
Posted: Wednesday 22 April 2020 12:00
by FireWizard
Hi,
@Havym
The last script looks more advanced and with much more possibilities, but we try once more.
Let's summing up:
The script runs as being executed as pi user and only from the directory (in this case) /home/pi/Sompi.
Let us try to modify the exec_open.sh and exec_close.sh by adding (both): cd /home/pi/Sompi
Code: Select all
#!/bin/sh
cd /home/pi/Sompi
/usr/bin/python ./controller.py Overkapping close > /dev/null 2>&1 &
NOW=$(date +"%Y-%m-%d")
LOGFILE=/home/pi/controller.$NOW.log
echo $(date +"%Y-%m-%d %H:%M:%S") controller | tee -a $LOGFILE
Regards
Re: Adding Somfy blinds to domoticz using 433.92 crystal
Posted: Wednesday 22 April 2020 17:13
by Havym
Thank again.... i created the exec_open and exec_close.sh files with you comments.
Close works!
Code: Select all
pi@raspberrypi:~/SomPi $ ./exec_close.sh
2020-04-22 17:04:39 controller
Open works too!
Code: Select all
pi@raspberrypi:~/SomPi $ ./exec_open.sh
2020-04-22 17:04:45 controller
And now.... the great finale.....
This one works too!
Code: Select all
pi@raspberrypi:~ $ /home/pi/SomPi/exec_close.sh
2020-04-22 17:07:42 controller
And i put in domoticz... script:///home/pi/SomPi/exec_close.sh
And it works!!!!
Thank you very much for you patience with me and figuring out this problem.
To skip the log part i should just delete this part from exec_open.sh?
Code: Select all
NOW=$(date +"%Y-%m-%d")
LOGFILE=/home/pi/controller.$NOW.log
echo $(date +"%Y-%m-%d %H:%M:%S") controller | tee -a $LOGFILE
Re: Adding Somfy blinds to domoticz using 433.92 crystal
Posted: Wednesday 22 April 2020 17:26
by FireWizard
Hi,
@Havym
Great. It was a lot of try and error.
And it was more or less my last guess.
You can now clean-up the directories.
Remove all created log files, that has been created during all the tests.
Indeed, you can also remove the log lines from both scripts.
Code: Select all
NOW=$(date +"%Y-%m-%d")
LOGFILE=/home/pi/controller.$NOW.log
echo $(date +"%Y-%m-%d %H:%M:%S") controller | tee -a $LOGFILE
Otherwise a lot of log files will be created, if you use it.
Have a lot of fun, with your Blinds.
Best regards