• 10 dec 2017: forum version update. In case of issues use this topic.
  • 30 nov 2017: pilight moved servers. In case of issues use this topic.
Hello There, Guest! Login Register


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Trigger a configured switch from other computer by CLI
#1
Hello!

I used to send my switch commands from one Raspberry Pi to another like this:

pilight-send -p intertechno_switch -i 1234 -u 5 -t -S 192.168.0.123 -P 5001

but since my update to stretch this produces the warning "WARNING: (webserver) could not read (null)" on the 192.168.0.123 pi.

Since I did not figure out how to correct this I moved to first naming the switch to be triggered in the config.json and tried the web UI - this works fine now.

Second I would like to also be able to trigger the web UI switch directly from the CLI - see if this is a work-around for my problem.

Is it possible to use pilight-send with the name of the switch and on/off?


this is my config.json:

Code:
{
       "devices": {
               "printer": {
                       "protocol": [ "intertechno_switch" ],
                       "id": [{
                               "id": 1234,
                               "unit": 5
                       }],
                       "state": "off"
               }
       },
       "rules": {},
       "gui": {
               "printer": {
                       "name": "Printers",
                       "group": [ "room1" ],
                       "media": [ "all" ]
               }
       },
       "settings": {
               "log-level": 6,
               "pid-file": "/var/run/pilight.pid",
               "log-file": "/var/log/pilight.log",
               "webserver-enable": 1,
               "webserver-root": "/usr/local/share/pilight/webgui",
               "webserver-http-port": 5001,
               "webserver-https-port": 5002,
               "webserver-cache": 1,
               "gpio-platform": "raspberrypi3"
       },
       "hardware": {
               "433gpio": {
                       "sender": 0,
                       "receiver": -1
               }
       },
       "registry": {
               "webserver": {
                       "ssl": {
                               "certificate": {
                                       "location": "/etc/pilight/pilight.pem"
                               }
                       }
               },
               "pilight": {
                       "version": {
                               "current": "8.1.5"
                       }
               },
               "hardware": {
                       "RF433": {
                               "mingaplen": 4420,
                               "maxgaplen": 72900,

                               "minrawlen": 26,
                               "maxrawlen": 400
                       }
               }
       }
}
 
Reply
#2
You're propably targetting the webgui port instead of the pilight daemon socket port
 
Reply
#3
thanks for the quick reply! You are right - I was trying to send to the web gui port...

so now - from the logfile of the server I found the port number and it works! Thanks so far!

Now I'd like to set it to a fixed port - but even if I start the daemon with the option --port=5000 I will still chose a random port.

Is there a way to set the listening port manually?
 
Reply
#4
Oh for *badword* sake!!

As an act of desperation I used pilight-send just with the server IP and no port - and it worked!

1) I don't get it why there is a random port if you don't need it to connect
2) I'm really glad it works now!

Thanks a lot for putting me on the right track!
 
Reply
  


Possibly Related Threads...
Thread Author Replies Views Last Post
  [SOLVED] Home Assistant switch gpio segalion 5 1,185 09-10-2018, 12:39 PM
Last Post: segalion
  pilight 8.1 and switch with date and time not working Pikeman 7 1,389 06-30-2018, 11:28 PM
Last Post: curlymo
  pilight-send for like rc-switch "send" mindau 1 1,667 01-18-2018, 07:46 AM
Last Post: madmoses
  [Fully Supported] Conrad RSL Switch Hexcode 137 51,097 12-02-2017, 08:48 AM
Last Post: Micha_123
  no gpio-platform configured hansrijn2 2 4,521 06-03-2017, 10:01 PM
Last Post: hansrijn2
  rev switch: maybe mismatch in sending on and off codes picrafter 2 1,776 04-15-2017, 02:49 PM
Last Post: redraid
  Problem with a Switch rule viper2035 2 1,535 01-12-2017, 04:33 PM
Last Post: viper2035
  Light Switch with integrated ON/OFF Button ilir@ademi.org 4 2,142 01-04-2017, 09:22 PM
Last Post: ilir@ademi.org
  All remotes should switch via pilight Laret 2 1,706 12-07-2016, 08:36 PM
Last Post: Laret
  Pollin Switches- one switch don't work soulrebell 11 2,940 11-13-2016, 02:59 PM
Last Post: wo_rasp

Forum Jump:


Browsing: 1 Guest(s)