• 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
pilight-control modify values
#1
I want to use the pilight-control program to change values on weather stations. The pilight manual says I should be able to modify values of a device:

Quote:pilight-control is a tool to control a device configured in a pilight daemon configuration. It supports switching the state and/or modifying other values (such as dimlevel, temperature, or humidity) of the device.

When I run
Code:
pilight-control -d Tempsens2 -v temperature=20
I would expect the temperature value of my weather station named Tempsens2 to be set to 20, but I get this error message as if I used the pilight-control program incorrectly:
Usage: pilight-control -d device -s state

When checking in the source code I see that the command line option "state" is mandatory, but a weather station does not have a state I can set:

Code:
if(device == NULL || state == NULL ||
       strlen(device) == 0 || strlen(state) == 0) {
        printf("Usage: %s -d device -s state\n", progname);
        goto close;
    }

How is this "modifying other values" supposed to work? Or did I just find a bug?
 
Reply
#2
Does it work when you remove that check in the source?
 
Reply
#3
(09-17-2019, 09:01 PM)curlymo Wrote: Does it work when you remove that check in the source?

Don't know. Would have to look into compiling this binary first....

I can test it if someone can send me the binary.
 
Reply
#4
I'm really not sure how to compile this source with the modification in a useful binary. Any one that can help out with testing this?
 
Reply
#5
Can you try the latest nightly tomorrow?
 
Reply
#6
(11-06-2019, 11:01 PM)curlymo Wrote: Can you try the latest nightly tomorrow?

Yes, works great! Thanks.
Tested with "generic_weather" = OK
My test with "alecto_ws1700" = NOK. I get: pilight-control: symbol lookup error: pilight-control: undefined symbol: _logprintf

Need to look into this as I just copied the pilight-control binary, none of the other files...
 
Reply
#7
You can't just use individual files. pilight should be used as the package.
 
Reply
#8
Ok, as said it works for the generic_weather protocol, but for "alecto_ws1700" I get this on the cli:

$ pilight-control -d Tempsens1 -v battery=0
[Nov 10 19:30:01:560421] ERROR: failed to control Tempsens1

Nothing in the pilight.err or pilight.log file. Log-level set to 6. I run:
INFO: version v8.1.5-nightly-1a19ab62
How can I further debug this?
 
Reply
#9
At least post your config.
 
Reply
#10
Ok, here's the config:

Code:
{
       "devices": {
               "slideshowdimmer": {
                       "protocol": [ "generic_dimmer" ],
                       "id": [{
                               "id": 100
                       }],
                       "state": "off",
                       "dimlevel": 2019
               },
               "slide2019script": {
                       "protocol": [ "program" ],
                       "id": [{
                               "name": "Show2019"
                       }],
                       "program": "",
                       "arguments": "",
                       "stop-command": "",
                       "start-command": "/home/pi/fotolijst/19slideshow.sh",
                       "state": "stopped",
                       "pid": 0
               },
               "slide2018script": {
                       "protocol": [ "program" ],
                       "id": [{
                               "name": "Show2018"
                       }],
                       "program": "",
                       "arguments": "",
                       "stop-command": "",
                       "start-command": "/home/pi/fotolijst/18slideshow.sh",
                       "state": "stopped",
                       "pid": 0
               },
               "slide2017script": {
                       "protocol": [ "program" ],
                       "id": [{
                               "name": "Show2017"
                       }],
                       "program": "",
                       "arguments": "",
                       "stop-command": "",
                       "start-command": "/home/pi/fotolijst/17slideshow.sh",
                       "state": "stopped",
                       "pid": 0
               },
               "slide2016script": {
                       "protocol": [ "program" ],
                       "id": [{
                               "name": "Show2016"
                       }],
                       "program": "",
                       "arguments": "",
                       "stop-command": "",
                       "start-command": "/home/pi/fotolijst/16slideshow.sh",
                       "state": "stopped",
                       "pid": 0
               },
               "slide2015script": {
                       "protocol": [ "program" ],
                       "id": [{
                               "name": "Show2015"
                       }],
                       "program": "",
                       "arguments": "",
                       "stop-command": "",
                       "start-command": "/home/pi/fotolijst/15slideshow.sh",
                       "state": "stopped",
                       "pid": 0
               },
               "slide2014script": {
                       "protocol": [ "program" ],
                       "id": [{
                               "name": "Show2014"
                       }],
                       "program": "",
                       "arguments": "",
                       "stop-command": "",
                       "start-command": "/home/pi/fotolijst/14slideshow.sh",
                       "state": "stopped",
                       "pid": 0
               },
               "slide2013script": {
                       "protocol": [ "program" ],
                       "id": [{
                               "name": "Show2013"
                       }],
                       "program": "",
                       "arguments": "",
                       "stop-command": "",
                       "start-command": "/home/pi/fotolijst/13slideshow.sh",
                       "state": "stopped",
                       "pid": 0
               },
               "slide2012script": {
                       "protocol": [ "program" ],
                       "id": [{
                               "name": "Show2012"
                       }],
                       "program": "",
                       "arguments": "",
                       "stop-command": "",
                       "start-command": "/home/pi/fotolijst/12slideshow.sh",
                       "state": "stopped",
                       "pid": 0
               },
               "slide2011script": {
                       "protocol": [ "program" ],
                       "id": [{
                               "name": "Show2011"
                       }],
                       "program": "",
                       "arguments": "",
                       "stop-command": "",
                       "start-command": "/home/pi/fotolijst/11slideshow.sh",
                       "state": "stopped",
                       "pid": 0
               },
               "slide2010script": {
                       "protocol": [ "program" ],
                       "id": [{
                               "name": "Show2010"
                       }],
                       "program": "",
                       "arguments": "",
                       "stop-command": "",
                       "start-command": "/home/pi/fotolijst/10slideshow.sh",
                       "state": "stopped",
                       "pid": 0
               },
               "slide2009script": {
                       "protocol": [ "program" ],
                       "id": [{
                               "name": "Show2009"
                       }],
                       "program": "",
                       "arguments": "",
                       "stop-command": "",
                       "start-command": "/home/pi/fotolijst/09slideshow.sh",
                       "state": "stopped",
                       "pid": 0
               },
               "stopslideshow": {
                       "protocol": [ "program" ],
                       "id": [{
                               "name": "Stopslideshow"
                       }],
                       "program": "",
                       "arguments": "",
                       "stop-command": "",
                       "start-command": "/home/pi/fotolijst/stop.sh",
                       "state": "stopped",
                       "pid": 0
               },
               "slideshowswitch2019": {
                       "protocol": [ "kaku_switch" ],
                       "id": [{
                               "id": 19061770,
                               "unit": 12
                       },
                       {
                               "id": 0,
                               "unit": 1
                       }],
                       "state": "on"
               },
               "slideshowswitch2018": {
                       "protocol": [ "kaku_switch" ],
                       "id": [{
                               "id": 19061770,
                               "unit": 13
                       },
                       {
                               "id": 1,
                               "unit": 1
                       }],
                       "state": "on"
               },
               "slideshowswitch2017": {
                       "protocol": [ "kaku_switch" ],
                       "id": [{
                               "id": 19061770,
                               "unit": 14
                       },
                       {
                               "id": 2,
                               "unit": 1
                       }],
                       "state": "on"
               },
               "slideshowswitch2016": {
                       "protocol": [ "kaku_switch" ],
                       "id": [{
                               "id": 19061770,
                               "unit": 15
                       },
                       {
                               "id": 3,
                               "unit": 1
                       }],
                       "state": "on"
               },
               "remote1": {
                       "protocol": [ "lirc" ],
                       "id": [{
                               "remote": "Microsoft_Xbox"
                       }],
                       "code": "0000000000531ace",
                       "repeat": 5,
                       "button": "KEY_1"
               },
               "keuken": {
                       "protocol": [ "kaku_switch_old" ],
                       "id": [{
                               "id": 1,
                               "unit": 0
                       }],
                       "state": "off"
               },
               "eetkamer": {
                       "protocol": [ "kaku_dimmer", "kaku_switch" ],
                       "id": [{
                               "id": 19061770,
                               "unit": 0
                       }],
                       "state": "off",
                       "dimlevel": 7,
                       "dimlevel-minimum": 0,
                       "dimlevel-maximum": 15
               },
               "staandelamp": {
                       "protocol": [ "kaku_switch_old", "kaku_switch" ],
                       "id": [{
                               "id": 3,
                               "unit": 0
                       },
                       {
                               "id": 19061770,
                               "unit": 3
                       },
                       {
                               "id": 15,
                               "unit": 0
                       }],
                       "state": "on"
               },
               "TVLampen": {
                       "protocol": [ "kaku_switch_old", "kaku_switch" ],
                       "id": [{
                               "id": 2,
                               "unit": 0
                       },
                       {
                               "id": 19061770,
                               "unit": 2
                       },
                       {
                               "id": 15,
                               "unit": 0
                       }],
                       "state": "on"
               },
               "badkamerfan": {
                       "protocol": [ "kaku_switch" ],
                       "id": [{
                               "id": 20382326,
                               "unit": 1
                       },
                       {
                               "id": 14,
                               "unit": 0
                       }],
                       "state": "off"
               },
               "garagedeur": {
                       "protocol": [ "kaku_switch" ],
                       "id": [{
                               "id": 26241362,
                               "unit": 1
                       }],
                       "state": "off"
               },
               "uitbouwTL": {
                       "protocol": [ "kaku_switch_old" ],
                       "id": [{
                               "id": 6,
                               "unit": 0
                       }],
                       "state": "off"
               },
               "satalites1": {
                       "protocol": [ "kaku_dimmer", "kaku_switch" ],
                       "id": [{
                               "id": 1699022,
                               "unit": 11
                       },
                       {
                               "id": 19061770,
                               "unit": 1
                       }],
                       "state": "off",
                       "dimlevel": 0,
                       "dimlevel-minimum": 0,
                       "dimlevel-maximum": 15
               },
               "Tempsens6": {
                       "protocol": [ "alecto_ws1700" ],
                       "id": [{
                               "id": 19
                       }],
                       "temperature": 6.0,
                       "humidity": 95.0,
                       "battery": 1
               },
               "Tempsens1": {
                       "protocol": [ "alecto_ws1700" ],
                       "id": [{
                               "id": 203
                       }],
                       "temperature": 20.6,
                       "humidity": 72.0,
                       "battery": 1
               },
               "Tempsens2": {
                       "protocol": [ "generic_weather" ],
                       "id": [{
                               "id": 9999
                       }],
                       "temperature": 20.00,
                       "humidity": 44.0,
                       "battery": 0
               },
               "Tempsens3": {
                       "protocol": [ "alecto_ws1700" ],
                       "id": [{
                               "id": 70
                       }],
                       "temperature": 17.0,
                       "humidity": 85.0,
                       "battery": 1
               },
               "Tempsens4": {
                       "protocol": [ "alecto_ws1700" ],
                       "id": [{
                               "id": 90
                       }],
                       "temperature": 15.3,
                       "humidity": 64.0,
                       "battery": 0
               },
               "Tempsens5": {
                       "protocol": [ "alecto_ws1700" ],
                       "id": [{
                               "id": 97
                       }],
                       "temperature": 7.5,
                       "humidity": 74.0,
                       "battery": 1
               },
               "Tempsens7": {
                       "protocol": [ "generic_weather" ],
                       "id": [{
                               "id": 9876
                       }],
                       "temperature": 0.00,
                       "humidity": 61.0,
                       "battery": 1
               },
               "kerstboom": {
                       "protocol": [ "kaku_switch_old" ],
                       "id": [{
                               "id": 4,
                               "unit": 0
                       },
                       {
                               "id": 0,
                               "unit": 0
                       }],
                       "state": "off"
               },
               "general_switch": {
                       "protocol": [ "kaku_switch_old" ],
                       "id": [{
                               "id": 15,
                               "unit": 15
                       }],
                       "state": "off"
               },
               "fotolijst": {
                       "protocol": [ "xbmc" ],
                       "id": [{
                               "server": "192.168.250.128",
                               "port": 9090
                       }],
                       "action": "active",
                       "media": "screensaver"
               }
       },
       "rules": {
               "rulekeuken": {
                       "rule": "IF remote1.button == KEY_1 THEN toggle DEVICE keuken BETWEEN on AND off",
                       "active": 1
               },
               "ruleeetkamer": {
                       "rule": "IF remote1.button == KEY_2 THEN toggle DEVICE eetkamer BETWEEN on AND off",
                       "active": 1
               },
               "ruleuitbouw": {
                       "rule": "IF remote1.button == KEY_5 THEN toggle DEVICE satalites1 BETWEEN on AND off",
                       "active": 1
               },
               "ruletv": {
                       "rule": "IF remote1.button == KEY_3 THEN toggle DEVICE TVLampen BETWEEN on AND off",
                       "active": 1
               },
               "rulestaand": {
                       "rule": "IF remote1.button == KEY_4 THEN toggle DEVICE staandelamp BETWEEN on AND off",
                       "active": 1
               },
               "ruleTLuitbouw": {
                       "rule": "IF remote1.button == KEY_6 THEN toggle DEVICE uitbouwTL BETWEEN on AND off",
                       "active": 1
               },
               "stopslideshow": {
                       "rule": "IF remote1.button == KEY_0 OR slideshowdimmer.state == off OR slideshowswitch2019.state == off OR slideshowswitch2018.state == off OR slideshowswitch2017.state == off OR slideshowswitch2016.state == off THEN switch DEVICE stopslideshow TO running",
                       "active": 1
               },
               "slidedimmerrule2019": {
                       "rule": "IF slideshowdimmer.dimlevel == 2019 AND slideshowdimmer.state == on THEN switch DEVICE slide2019script TO running",
                       "active": 1
               },
               "slidedimmerrule2018": {
                       "rule": "IF slideshowdimmer.dimlevel == 2018 AND slideshowdimmer.state == on THEN switch DEVICE slide2018script TO running",
                       "active": 1
               },
               "slidedimmerrule2017": {
                       "rule": "IF slideshowdimmer.dimlevel == 2017 AND slideshowdimmer.state == on THEN switch DEVICE slide2017script TO running",
                       "active": 1
               },
               "slidedimmerrule2016": {
                       "rule": "IF slideshowdimmer.dimlevel == 2016 AND slideshowdimmer.state == on THEN switch DEVICE slide2016script TO running",
                       "active": 1
               },
               "slidedimmerrule2015": {
                       "rule": "IF slideshowdimmer.dimlevel == 2015 AND slideshowdimmer.state == on THEN switch DEVICE slide2015script TO running",
                       "active": 1
               },
               "slidedimmerrule2014": {
                       "rule": "IF slideshowdimmer.dimlevel == 2014 AND slideshowdimmer.state == on THEN switch DEVICE slide2014script TO running",
                       "active": 1
               },
               "slidedimmerrule2013": {
                       "rule": "IF slideshowdimmer.dimlevel == 2013 AND slideshowdimmer.state == on THEN switch DEVICE slide2013script TO running",
                       "active": 1
               },
               "slidedimmerrule2012": {
                       "rule": "IF slideshowdimmer.dimlevel == 2012 AND slideshowdimmer.state == on THEN switch DEVICE slide2012script TO running",
                       "active": 1
               },
               "slidedimmerrule2011": {
                       "rule": "IF slideshowdimmer.dimlevel == 2011 AND slideshowdimmer.state == on THEN switch DEVICE slide2011script TO running",
                       "active": 1
               },
               "slidedimmerrule2010": {
                       "rule": "IF slideshowdimmer.dimlevel == 2010 AND slideshowdimmer.state == on THEN switch DEVICE slide2010script TO running",
                       "active": 1
               },
               "slidedimmerrule2009": {
                       "rule": "IF slideshowdimmer.dimlevel == 2009 AND slideshowdimmer.state == on THEN switch DEVICE slide2009script TO running",
                       "active": 1
               },
               "rule2019": {
                       "rule": "IF slideshowswitch2019.state == on THEN switch DEVICE slide2019script TO running",
                       "active": 1
               },
               "rule2018": {
                       "rule": "IF slideshowswitch2018.state == on THEN switch DEVICE slide2018script TO running",
                       "active": 1
               },
               "rule2017": {
                       "rule": "IF slideshowswitch2017.state == on THEN switch DEVICE slide2017script TO running",
                       "active": 1
               },
               "rule2016": {
                       "rule": "IF slideshowswitch2016.state == on THEN switch DEVICE slide2016script TO running",
                       "active": 1
               }
       },
       "gui": {
               "eetkamer": {
                       "name": "Lamp boven eettafel",
                       "group": [ "Verlichting" ],
                       "media": [ "all" ],
                       "readonly": 0
               },
               "keuken": {
                       "name": "Keuken lamp",
                       "group": [ "Verlichting" ],
                       "media": [ "all" ],
                       "readonly": 0
               },
               "staandelamp": {
                       "name": "Staande lamp",
                       "group": [ "Verlichting" ],
                       "media": [ "all" ],
                       "readonly": 0
               },
               "TVLampen": {
                       "name": "Lampen bij TV",
                       "group": [ "Verlichting" ],
                       "media": [ "all" ],
                       "readonly": 0
               },
               "badkamerfan": {
                       "name": "Badkamerventilator",
                       "group": [ "Verlichting" ],
                       "media": [ "all" ],
                       "readonly": 0
               },
               "garagedeur": {
                       "name": "Garagedeur",
                       "group": [ "Verlichting" ],
                       "media": [ "all" ],
                       "readonly": 0
               },
               "satalites1": {
                       "name": "Spots in uitbouw",
                       "group": [ "Verlichting" ],
                       "media": [ "all" ],
                       "readonly": 0
               },
               "uitbouwTL": {
                       "name": "TL in uitbouw",
                       "group": [ "Verlichting" ],
                       "media": [ "all" ],
                       "readonly": 0
               },
               "Tempsens6": {
                       "name": "Buiten Temperatuur",
                       "group": [ "Temperature" ],
                       "media": [ "all" ]
               },
               "Tempsens4": {
                       "name": "Zolder Temperatuur",
                       "group": [ "Temperature" ],
                       "media": [ "all" ]
               },
               "Tempsens1": {
                       "name": "Badkamer Temperatuur",
                       "group": [ "Temperature" ],
                       "media": [ "all" ]
               },
               "Tempsens2": {
                       "name": "Huiskamer Temperatuur",
                       "group": [ "Temperature" ],
                       "media": [ "mobile" ]
               },
               "Tempsens5": {
                       "name": "Garage Temperatuur",
                       "group": [ "Temperature" ],
                       "media": [ "all" ]
               },
               "Tempsens7": {
                       "name": "Meterkast Temperatuur",
                       "group": [ "Temperature" ],
                       "media": [ "all" ],
                       "show-humidity": 0
               },
               "Tempsens3": {
                       "name": "Kruipruimte Temperatuur",
                       "group": [ "Temperature" ],
                       "media": [ "all" ]
               },
               "kerstboom": {
                       "name": "kerstboom",
                       "group": [ "Verlichting" ],
                       "media": [ "mobile" ],
                       "readonly": 0
               },
               "slideshowdimmer": {
                       "name": "Fotolijstje",
                       "group": [ "Fotolijst" ],
                       "media": [ "all" ],
                       "dimlevel-minimum": 2009,
                       "dimlevel-maximum": 2019
               },
               "fotolijst": {
                       "name": "XBMC",
                       "group": [ "Fotolijst" ],
                       "media": [ "all" ]
               }
       },
       "settings": {
               "stats-enable": 1,
               "log-level": 6,
               "pid-file": "/var/run/pilight.pid",
               "log-file": "/var/log/pilight.log",
               "webserver-enable": 1,
               "standalone": 0,
               "webserver-root": "/usr/local/share/pilight/webgui",
               "webserver-http-port": 80,
               "webserver-cache": 1,
               "port": 5000,
               "gpio-platform": "raspberrypi2"
       },
       "hardware": {
               "433gpio": {
                       "sender": 0,
                       "receiver": 1
               }
       },
       "registry": {
               "pilight": {
                       "version": {
                               "current": "8.1.5"
                       }
               },
               "webserver": {
                       "ssl": {
                               "certificate": {
                                       "location": "/etc/pilight/pilight.pem"
                               }
                       }
               }
       }
}
 
Reply
  


Possibly Related Threads...
Thread Author Replies Views Last Post
  pilight start/stop loop Rschnauzer 1 334 10-27-2022, 10:28 PM
Last Post: Rschnauzer
  pilight on raspbian bullseye ChristianK 3 1,742 07-29-2022, 10:18 PM
Last Post: Henkehh
  pilight-raw changes output format from 7 to 8 Rschnauzer 2 1,672 05-04-2022, 01:32 PM
Last Post: youradultworld
Question pilight stopped working sl4m01 5 2,579 09-16-2021, 01:34 PM
Last Post: orlo11
  how to compile pilight with custom protocol code? am i missing something? stanwebber 2 1,055 07-05-2021, 03:49 AM
Last Post: stanwebber
  hardware info lost after pilight restart Rschnauzer 3 1,315 03-17-2021, 11:44 AM
Last Post: Rschnauzer
Question pilight nightly webgui offline after some hours fleisch 4 1,783 10-26-2020, 05:19 PM
Last Post: fleisch
  pilight bugs Ascenion 1 1,264 03-23-2020, 06:29 PM
Last Post: curlymo
  [Solved] pilight service crashing on first webserver access after reboot VrahoK 20 7,709 12-21-2019, 09:46 AM
Last Post: curlymo
  Bug: double free or corruption in pilight-send blackzombie 12 5,219 10-07-2019, 08:15 PM
Last Post: blackzombie

Forum Jump:


Browsing: 1 Guest(s)