• T
    temp

    I needed
    >/dev/null 2>&1

    But now everything is good

    posted in Plugins read more
  • T
    temp

    I created a button with a rule by pressing in it and now I geht

      error [pimatic-shell-execute]: [ShellActionHandler] Error: Command failed: /bin/sh -c ssh root@htpc shutdown -h now
      Connection to htpc closed by remote host.
      11:35:45error [pimatic]: rule rule_execute_htpcpoweroff error executing an action: undefined
      11:35:45error [pimatic]: Error on evaluation of rule  condition of rule rule_execute_htpcpoweroff: undefined

    posted in Plugins read more
  • T
    temp

    Not completely Solved
    Solution will be posted shortly

    on the system with pimatic you need to

    ssh-keygen -t rsa -b 4096 
    

    don’tadd any passphrase

    and then execute

    ssh-copy-id -i ~/.ssh/id_rsa.pub user@server 
    

    enter the password of the system and after that you can simple

      ssh user@server
    

    without entering a password

    but if you like to add this to the pimatic frontend

    Error: Command failed: /bin/sh -c ssh user@server shutdown -h now
    

    Host key verification failed.

    on the bash itself connect with putty it is working

    But why?

    posted in Plugins read more
  • T
    temp

    Sth linke this

    ssh user@192.168.1.2 sudo shutdown -h now
    

    possible?

    posted in Plugins read more
  • T
    temp

    @mwittig said in Bash command to update a variable:

    @Gleno0h said in Bash command to update a variable:

    @temp what @mwittig said and following line doesnt make sense to me…

    My comment was referring to the following error and the command snippets @temp sent in post 11, but I have been misled by the strange formatting he used in his post.

    curl: (3) [globbing] unmatched close brace/bracket in column 7
    SyntaxError: Unexpected end of input
    

    @temp Actually, I think the problem is bad quotation. The following modified command sequence based on post 11 works for me. See also 2nd post at https://superuser.com/questions/835587/how-to-include-environment-variable-in-bash-line-curl for details.

    pi@raspi3:~ $ stop_timestamp=1494910730
    # Space in the date format string below must be escaped
    pi@raspi3:~ $ t=`date -d@$stop_timestamp +%d-%m-%Y\ %H:%M`
    # Single quotes around shell variables must be quoted!
    pi@raspi3:~ $ curl -X PATCH --header "Content-Type:application/json" --data '{"type": "value", "valueOrExpression": "'"$t"'"}' --user "a:a" http://smarthome:5001/api/variables/variable_string_today
    {"variable":{"name":"variable_string_today","readonly":false,"type":"value","value":"16-05-2017 06:58","unit":""},"success":true}
    

    EDIT: @temp In your example the inner double quotes for the variable are missing which expands to the following as the shell with quote the space character for you.... "valueOrExpression": "16-05-2017' '06:58". That’s causing the syntax error. You can easily trace that yourself by setting set -x in your shell.

    pi@raspi3:~ $ set -x
    pi@raspi3:~ $ curl -X PATCH --header "Content-Type:application/json" --data '{"type": "value", "valueOrExpression": "'"$t"'"}' --user "a:a" http://smarthome:5001/api/variables/variable_string_today
    + curl -X PATCH --header Content-Type:application/json --data '{"type": "value", "valueOrExpression": "16-05-2017 06:58"}' --user a:a http://smarthome:5001/api/variables/variable_string_today
    {"variable":{"name":"variable_string_today","readonly":false,"type":"value","value":"16-05-2017 06:58","unit":""},"success":true}pi@raspi3:~ $
    pi@raspi3:~ $
    pi@raspi3:~ $ curl -X PATCH --header "Content-Type:application/json" --data '{"type": "value", "valueOrExpression": "'$t'"}' --user "a:a" http://smarthome:5001/api/variables/variable_string_today
    + curl -X PATCH --header Content-Type:application/json --data '{"type": "value", "valueOrExpression": "16-05-2017' '06:58"}' --user a:a http://smarthome:5001/api/variables/variable_string_today
    curl: (3) [globbing] unmatched close brace/bracket in column 7
    SyntaxError: Unexpected end of input
        at Object.parse (native)
        at parse (/home/pi/pimatic-dev/node_modules/pimatic/node_modules/body-parser/lib/types/json.js:88:17)
        at /home/pi/pimatic-dev/node_modules/pimatic/node_modules/body-parser/lib/read.js:116:18
        at invokeCallback (/home/pi/pimatic-dev/node_modules/pimatic/node_modules/body-parser/node_modules/raw-body/index.js:262:16)
        at done (/home/pi/pimatic-dev/node_modules/pimatic/node_modules/body-parser/node_modules/raw-body/index.js:251:7)
        at IncomingMessage.onEnd (/home/pi/pimatic-dev/node_modules/pimatic/node_modules/body-parser/node_modules/raw-body/index.js:307:7)
        at emitNone (events.js:67:13)
        at IncomingMessage.emit (events.js:166:7)
        at endReadableNT (_stream_readable.js:923:12)
        at nextTickCallbackWith2Args (node.js:458:9)
        at process._tickDomainCallback (node.js:413:17)pi@raspi3:~ $
    

    Use set +x to switch off the trace
    Hope, this helps

    –>Solved Thanks to everyone :)

    –>Next topic/question to solve everything https://forum.pimatic.org/topic/3047/kodi-shutdown-command

    posted in Rules and Scripts read more
  • T
    temp

    Hello I added the kodi Plugin with a user defined Commando accorfing to this

    http://kodi.wiki/view/list_of_built-in_functions

    host	:	htpc
    customOpenCommands		[1]
    0		{2}
    name	:	Shutdown
    command	:	shutdown
    plugin	:	kodi
    active	:	true
    

    Is this correct implemented? And how can I usw this now to shutdown kodi
    -from a simple button
    -from a rule

    ?

    Thanks

    posted in Plugins read more
  • T
    temp

    I get this error

    SyntaxError: Unexpected end of input
    at Object.parse (native)
    at parse (/home/pi/pimatic-     app/node_modules/pimatic/node_modules/body-parser/lib/types/json.js:88:17)
      at /home/pi/pimatic-   app/node_modules/pimatic/node_modules/body-   parser/lib/read.js:116:18
    at invokeCallback (/home/pi/pimatic-app/node_modules/pimatic/node_modules/body-parser/node_modules/raw-  
     body/index.js:262:16)
    at done (/home/pi/pimatic-app/node_modules/pimatic/node_modules/body-parser/node_modules/raw-body/index.js:251:7)
        at IncomingMessage.onEnd (/home/pi/pimatic-app/node_modules/pimatic/node_modules/body-parser/node_modules/raw-
    body/index.js:307:7)
    at emitNone (events.js:67:13)
    at IncomingMessage.emit (events.js:166:7)
    at endReadableNT (_stream_readable.js:913:12)
    at nextTickCallbackWith2Args (node.js:442:9)
    at process._tickCallback (node.js:356:17)
    

    If I am using this line for defining the Start time

    wake_start_time=`date -d@$wake_start_timestamp +%d-%m-%Y\ %H:%M`
    

    When I use this line

    wake_start_time=`date -d@$wake_start_timestamp +%d-%m-%Y/%H:%M`
    

    Everything is good

    But i like to see in the pimatic GUI the format

    16-05-2017 17:30
    

    And not

    16-05-2017/17:30

    posted in Rules and Scripts read more
  • T
    temp

    #!/bin/sh
    #
    
    echo z > /dev/serial/by-id/usb-Atric_Development_GbR_Atric_IR-Wakeup_USB-if00
    
    # bootup system 60 sec. before timer
    safe_margin=60
    
    # modyfy if different location for tvheadend dvr/log path
    cd /storage/.kodi/userdata/addon_data/service.tvheadend42/dvr/log/
    
    
    
    start_timestamp=0
    stop_timestamp=0
    current_timestamp=`date +"%s"`
    
    for i in $( ls ); do
        tmp_start="$(grep -o '"start": [0-9]*' "$i" | head -n 1 | grep -o '[0-9]*')"
        tmp_stop="$(grep -o '"stop": [0-9]*' "$i" | head -n 1 | grep -o '[0-9]*')"
        if [ "$tmp_stop" -gt "$current_timestamp" -a "$tmp_start" -gt "$current_timestamp" ]; then
                if [ "$start_timestamp" -eq 0 -o "$tmp_start" -lt "$start_timestamp" ]; then
                        start_timestamp=$tmp_start
                        stop_timestamp=$tmp_stop
                fi
        fi
    
    
    
    
    done
    
    wake_start_timestamp=$((start_timestamp-safe_margin))
    if [ "$wake_start_timestamp" -gt 0 ]; then
        wake_start_time=`date -d@$wake_start_timestamp +%y%m%d%H%M`
    
    
        actual_date=`date +"%y%m%d%H%M%S"`
        time_correction=0
        time_command=TSACS
        complete_command=$time_command$actual_date$time_correction
        #echo $actual_date
        echo $complete_command > /dev/serial/by-id/usb-Atric_Development_GbR_Atric_IR-Wakeup_USB-if00
    
        #echo $wake_start_time
        waketime_command=WSACS
        complete_command=$waketime_command$wake_start_time
        echo $complete_command > /dev/serial/by-id/usb-Atric_Development_GbR_Atric_IR-Wakeup_USB-if00
    
        wake_start_timestamp=$((start_timestamp-safe_margin-safe_margin))
        wake_start_time=`date -d@$wake_start_timestamp +%d-%m-%Y\ %H:%M`
        curl -X PATCH --silent --header "Content-Type:application/json" --data '{"type": "value", "valueOrExpression": "'$wake_start'"}' --user "a:a" http://smarthome:5001/api/variables/variable_string_htpc_startrecordingtime >/dev/null
    
        wake_stop_time=`date -d@$stop_timestamp +%d-%m-%Y\ %H:%M`
        curl -X PATCH --silent --header "Content-Type:application/json" --data '{"type": "value", "valueOrExpression": "'$wake_stop'"}' --user "a:a" http://smarthome:5001/api/variables/variable_string_htpc_startrecordingtime >/dev/null
    
    fi
    
    echo z > /dev/serial/by-id/usb-Atric_Development_GbR_Atric_IR-Wakeup_USB-if00
    

    and the files looks like:

    {
       "enabled": true,
       "start": 1493842500,
       "start_extra": 0,
       "stop": 1493844300,
       "stop_extra": 0,
       "channel": "d3751afe7fb68fb4a19fb1d482b52787",
       "channelname": "Das Erste HD",
       "title": {
         "ger": "Tagesthemen"
       },
       "subtitle": {
         "ger": "mit Wetter"
       },
       "description": {
         "ger": "Themen u.a.:\n* Vor der Wahl: TV-Duell in Frankreich\n* Unter Druck: Eingeschüchterte Journalisten\n* Auf der Hut: Cybercrime bedroht      Deutschland\n* Kommentar von Thomas Baumann (MDR) zum Tag der Pressefreiheit\n\nModeration: Caren Miosga\nProduziert in H"
       },
       "pri": 2,
       "retention": 2147483646,
       "removal": 92,
       "playposition": 0,
       "playcount": 0,
       "config_name": "8d0f5b7ae354d956d7fe5db25f5d0d24",
       "owner": "kodi",
       "creator": "kodi",
       "errorcode": 103,
       "errors": 1,
       "data_errors": 0,
       "dvb_eid": 22433,
       "noresched": false,
       "norerecord": false,
       "fileremoved": 0,
       "autorec": "",
       "timerec": "",
       "parent": "",
       "child": "",
       "content_type": 2,
       "broadcast": 37561,
       "files": [
         {
           "filename": "/storage/recordings/Tagesthemen/Tagesthemen-Das Erste HD2017-05-0322-15.ts",
           "info": [
             {
               "type": "H264",
               "width": 1280,
               "height": 720,
               "duration": 1800,
               "aspect_num": 0,
               "aspect_den": 0
             },
             {
               "type": "MPEG2AUDIO",
               "language": "ger",
               "audio_type": 0
             },
             {
               "type": "MPEG2AUDIO",
               "language": "mis",
               "audio_type": 0
             },
             {
               "type": "AC3",
               "language": "ger",
               "audio_type": 0
             },
             {
               "type": "TELETEXT"
             },
             {
               "type": "DVBSUB",
               "language": "ger",
               "composition_id": 1,
               "ancillary_id": 1
             }     
           ],
           "start": 1493842500,
           "stop": 1493844164
         }
           ]
         }
    

    everything is fine if I use

    wake_start_time=`date -d@$wake_start_timestamp +%d-%m-%Y/%H:%M`
    

    instead of

    wake_start_time=`date -d@$wake_start_timestamp +%d-%m-%Y\ %H:%M`

    posted in Rules and Scripts read more
  • T
    temp

    Hello,

      t=`date -d@$timestamp +%d-%m-%Y\ %H:%M`
     curl -X PATCH --header "Content-Type:application/json" --data '{"type": "value", "valueOrExpression": "'$t'"}' --user "a:a" http://smarthome:5001/api/variables/variable_string_today

    posted in Rules and Scripts read more

Looks like your connection to pimatic forum was lost, please wait while we try to reconnect.