Page 3 of 8

Re: Gigaset Elements Cli - domoticz support

Posted: Monday 09 May 2016 19:54
by micbou
I got everything up and working. I see my Base (red, because I need to set one of my sensors back up) and motion in the log from the motion detector. The motion switch doesn't change color on motion, right? Im planning to let the switch change to 'away' when the last person leaves the house (using the BT Beacon from this topic (index.php?mark_notification=29483&hash=6a92d7e0) and send me a Telegram message when a alert is triggered.

Any advice on how to get the 'mode' switch in there?

Again, thanks a lot. Really appreciate all the help and I learned a lot from all the steps you guided me through.

Re: Gigaset Elements Cli - domoticz support

Posted: Monday 09 May 2016 20:24
by dynasticorpheus
Create a new selector switch:

Image

Set it up like this:

Image


The actions are:

script:///usr/local/bin/gigasetelements-cli -m home
script:///usr/local/bin/gigasetelements-cli -m custom
script:///usr/local/bin/gigasetelements-cli -m away

also in your /etc/gigasetelements-cli.conf change:

modus: home

into

modus:

Otherwise every time you run the cli it will change the modus into home
micbou wrote:I got everything up and working. I see my Base (red, because I need to set one of my sensors back up) and motion in the log from the motion detector. The motion switch doesn't change color on motion, right? Im planning to let the switch change to 'away' when the last person leaves the house (using the BT Beacon from this topic (index.php?mark_notification=29483&hash=6a92d7e0) and send me a Telegram message when a alert is triggered.

Any advice on how to get the 'mode' switch in there?

Again, thanks a lot. Really appreciate all the help and I learned a lot from all the steps you guided me through.

Re: Gigaset Elements Cli - domoticz support

Posted: Monday 09 May 2016 21:43
by dynasticorpheus
micbou wrote:I got everything up and working. I see my Base (red, because I need to set one of my sensors back up) and motion in the log from the motion detector. The motion switch doesn't change color on motion, right? Im planning to let the switch change to 'away' when the last person leaves the house (using the BT Beacon from this topic (index.php?mark_notification=29483&hash=6a92d7e0) and send me a Telegram message when a alert is triggered.

Any advice on how to get the 'mode' switch in there?

Again, thanks a lot. Really appreciate all the help and I learned a lot from all the steps you guided me through.
I actually already have added telegram support in the cli itself but need to refine this a bit more before I push it to github.

Re: Gigaset Elements Cli - domoticz support

Posted: Sunday 15 May 2016 13:18
by micbou
Great!

How do I set an action w/ Blocky? I want to play a voice command and send a message via telegram.

Re: Gigaset Elements Cli - domoticz support

Posted: Monday 16 May 2016 10:00
by dynasticorpheus
micbou wrote:Great!

How do I set an action w/ Blocky? I want to play a voice command and send a message via telegram.
Still need to work a bit more on the native Telegram support in my cli but Domoticz can also do this for you by calling a simple bash script in the on/off action field of a device:

Follow step 1, 2, 3, and 5 of below instructable to get an authorization token and chat ID. (step 4 not needed)

http://www.instructables.com/id/Telegra ... /?ALLSTEPS

Create telegram-cli.sh with below code and replace TOKEN / CHATID with those you got from doing above steps.

Code: Select all

#!/bin/sh -e

# Telegram token
TOKEN=bot*************************************************

# Telegram chat ID
CHATID=12345678

curl -o /dev/null -s -X POST "https://api.telegram.org/$TOKEN/sendMessage" -F chat_id=$CHATID -F text="$1 $2 $3 $4 $5 $6 $7 $8 $9 $10"
Now you can call this script in the on/off action field in a device but first make sure it works by testing it in your terminal first. Use correct path of script but it should look like something below.

script:///home/user/script/telegram-cli.sh Hoi, dit is een TEST!

Re: Gigaset Elements Cli - domoticz support

Posted: Monday 16 May 2016 15:38
by micbou
I got the Telegram service up, but I want to trigger it when the alarm goes of or even when motion is detected..

Re: Gigaset Elements Cli - domoticz support

Posted: Sunday 29 May 2016 22:47
by micbou
hi, I was forced to clean install my Domoticz/RPi3 today. I tried working through the installation again and it seemed to work, but I ran into this error running gigasetelements-cli -tt

Code: Select all

root@raspberrypi:/etc# gigasetelements-cli -tt

Gigaset Elements - Command-line Interface v1.5.0b1

[-] Configuration     | LOADED   | /etc/gigasetelements-cli.conf
[-] Identity          | VERIFIED | User logged in successfully.
[-] Authentication    | SUCCESS  | 
[-] Basestation       | ONLINE   | E52C011F30C1BE84C86895D96C76D693
[-] Status            | GREEN    | Modus HOME

[-] ERROR             | UNKNOWN  | HTTPConnectionPool(host='192.68.1.112', port=8080): Max retries exceeded with url: /json.htm?type=command&param=addlogmessage&message=Gigaset%20Elements%20-%20Command-line%20Interface:%20Domoticz%20mode%20started (Caused by NewConnectionError('<requests.packages.urllib3.connection.HTTPConnection object at 0x763cd290>: Failed to establish a new connection: [Errno 101] Network is unreachable',))
when I switch mode in the selector the log shows:

Code: Select all

2016-05-29 22:46:53.652 (Gigaset Elements Modus) Light/Switch (Gigaset Elements Modus)
2016-05-29 22:46:54.445 Executing script: /usr/local/bin/gigasetelements-cli
2016-05-29 22:46:55.025 Error: Error executing script command (/usr/local/bin/gigasetelements-cli). returned: 512

Any idea?

Re: Gigaset Elements Cli - domoticz support

Posted: Monday 30 May 2016 9:32
by dynasticorpheus
micbou wrote:hi, I was forced to clean install my Domoticz/RPi3 today. I tried working through the installation again and it seemed to work, but I ran into this error running gigasetelements-cli -tt

Code: Select all

root@raspberrypi:/etc# gigasetelements-cli -tt

Gigaset Elements - Command-line Interface v1.5.0b1

[-] Configuration     | LOADED   | /etc/gigasetelements-cli.conf
[-] Identity          | VERIFIED | User logged in successfully.
[-] Authentication    | SUCCESS  | 
[-] Basestation       | ONLINE   | E52C011F30C1BE84C86895D96C76D693
[-] Status            | GREEN    | Modus HOME

[-] ERROR             | UNKNOWN  | HTTPConnectionPool(host='192.68.1.112', port=8080): Max retries exceeded with url: /json.htm?type=command&param=addlogmessage&message=Gigaset%20Elements%20-%20Command-line%20Interface:%20Domoticz%20mode%20started (Caused by NewConnectionError('<requests.packages.urllib3.connection.HTTPConnection object at 0x763cd290>: Failed to establish a new connection: [Errno 101] Network is unreachable',))
when I switch mode in the selector the log shows:

Code: Select all

2016-05-29 22:46:53.652 (Gigaset Elements Modus) Light/Switch (Gigaset Elements Modus)
2016-05-29 22:46:54.445 Executing script: /usr/local/bin/gigasetelements-cli
2016-05-29 22:46:55.025 Error: Error executing script command (/usr/local/bin/gigasetelements-cli). returned: 512

Any idea?
Best guess would be an authorization issue. In domoticz settings check the option Local Networks (no username/password) and add

Code: Select all

127.0.0.*;192.68.1.*
btw are you sure your ip is 192.68.1.112 and not 192.168.1.112 ???

Re: Gigaset Elements Cli - domoticz support

Posted: Monday 30 May 2016 17:32
by francocouly
Hi all,

I have some problems with the gigasetelements-cli.

I have created 3 .sh scripts that refer to the 5 actions from the Gigaset Elements System :
2016-05-30 17_24_25-Photos.png
2016-05-30 17_24_25-Photos.png (68.9 KiB) Viewed 4038 times
but impossible to have the Domoticz working. No errors, but no actions.

For example, the away.sh script contain :

#!/bin/bash

/etc/gigasetelements-cli/gigasetelements-cli.py -m away -q > /dev/null


However, my scripts runs well in putty, changing the mode of the Gigaset Elements System.

Can you help me please ? :)

For information, I run Domoticz and gigasetelements-cli on my Synology NAS.

Thanks

Re: Gigaset Elements Cli - domoticz support

Posted: Monday 30 May 2016 17:35
by micbou
dynasticorpheus wrote:
btw are you sure your ip is 192.68.1.112 and not 192.168.1.112 ???

:oops: embarrassing! Sorry for wasting your time on this one

Re: Gigaset Elements Cli - domoticz support

Posted: Monday 30 May 2016 17:37
by micbou
@francocouly, does below work?
Schermafbeelding 2016-05-30 om 17.36.27.png
Schermafbeelding 2016-05-30 om 17.36.27.png (269.64 KiB) Viewed 4035 times

Re: Gigaset Elements Cli - domoticz support

Posted: Monday 30 May 2016 17:48
by francocouly
No, it doesn't work, like the previous settings :
2016-05-30 17_47_17-Domoticz.png
2016-05-30 17_47_17-Domoticz.png (72.02 KiB) Viewed 4032 times
and nothing in the logs :
2016-05-30 17_45_30-TripAdvisor.png
2016-05-30 17_45_30-TripAdvisor.png (5.49 KiB) Viewed 4032 times
It's very weird, I don't understand :/

Re: Gigaset Elements Cli - domoticz support

Posted: Monday 30 May 2016 19:30
by dynasticorpheus
francocouly wrote:No, it doesn't work, like the previous settings :

2016-05-30 17_47_17-Domoticz.png

and nothing in the logs :

2016-05-30 17_45_30-TripAdvisor.png

It's very weird, I don't understand :/
There is really no need to create separate scripts if you do a regular install. Please run below code:

Code: Select all

pip install --upgrade https://github.com/dynasticorpheus/gigasetelements-cli/zipball/develop
and follow below instructions:

viewtopic.php?f=38&t=8404&start=40#p85496

EDIT:

Don't know if you can do a regular install on a NAS but if not than I would suggest you put "python" in front of your command:

Code: Select all

#!/bin/bash
python /etc/gigasetelements-cli/gigasetelements-cli.py -m away -q > /dev/null

Re: Gigaset Elements Cli - domoticz support

Posted: Monday 30 May 2016 23:08
by francocouly
Hi,

Here is my configuration :
Screen Shot 2016-05-30 at 23.02.28.png
Screen Shot 2016-05-30 at 23.02.28.png (230.5 KiB) Viewed 4005 times
And my switch :
Screen Shot 2016-05-30 at 23.02.44.png
Screen Shot 2016-05-30 at 23.02.44.png (272.33 KiB) Viewed 4005 times
The sensors are OK, but still not able to set the modus with the script. It's running well in cmd line :
Screen Shot 2016-05-30 at 23.06.17.png
Screen Shot 2016-05-30 at 23.06.17.png (108.05 KiB) Viewed 4005 times
Thank you for your help

Re: Gigaset Elements Cli - domoticz support

Posted: Tuesday 31 May 2016 8:46
by dynasticorpheus
francocouly wrote:Hi,

Here is my configuration :

Screen Shot 2016-05-30 at 23.02.28.png

And my switch :

Screen Shot 2016-05-30 at 23.02.44.png

The sensors are OK, but still not able to set the modus with the script. It's running well in cmd line :

Screen Shot 2016-05-30 at 23.06.17.png

Thank you for your help
I replicated your setup and it was working so we need to have a closer look, let's first route the output to a text file. Please share the output.

Code: Select all

script:///etc/gigasetelements-cli/gigasetelements-cli.py -m home >> /tmp/gigasetelements-cli.log

Re: Gigaset Elements Cli - domoticz support

Posted: Tuesday 31 May 2016 11:07
by francocouly
Hi,

thanks for your return !

when I add script:///etc/gigasetelements-cli/gigasetelements-cli.py -m home >> /tmp/gigasetelements-cli.log, no .log file can be found in my /tmp folder. Perhaps a problem of rights ?

Re: Gigaset Elements Cli - domoticz support

Posted: Tuesday 31 May 2016 13:40
by dynasticorpheus
francocouly wrote:Hi,

thanks for your return !

when I add script:///etc/gigasetelements-cli/gigasetelements-cli.py -m home >> /tmp/gigasetelements-cli.log, no .log file can be found in my /tmp folder. Perhaps a problem of rights ?
Can you try again using below .sh script? Perhaps you first need to "cd" into the correct directory due to environment constraints?

Code: Select all

#!/bin/bash
cd /etc/gigasetelements-cli
python gigasetelements-cli.py -m away

Re: Gigaset Elements Cli - domoticz support

Posted: Tuesday 31 May 2016 14:12
by francocouly
Still not working.

the log file is created but empty, even if I add a "sudo -u admin" before the python command in the .sh script, add all the rights to this file, and the same for the log file

Re: Gigaset Elements Cli - domoticz support

Posted: Tuesday 31 May 2016 15:06
by dynasticorpheus
francocouly wrote:Still not working.

the log file is created but empty, even if I add a "sudo -u admin" before the python command in the .sh script, add all the rights to this file, and the same for the log file
I needed to specify the full path to python to get it working. Can you try as well. First check if it is also /usr/bin/python for you.

Code: Select all

#!/bin/bash
cd /etc/gigasetelements-cli
/usr/bin/python gigasetelements-cli.py -m away

Re: Gigaset Elements Cli - domoticz support

Posted: Tuesday 31 May 2016 17:07
by francocouly
Yessss ! It works perfectly :)

Thank you very much for your support !