Has anyone tried calling WiringPi from inside a HA module?
I seem to be having some troubles. Empirically it's as if my calling of the gpio command just "doesn't happen."
Example:
Code: Select all
var test = system("gpio readall");
debugPrint("Test: "+test);
Code: Select all
[2014-11-18 17:38:19.115] Test: 0,
When it should be returning something like this (This is me running it manually):
Code: Select all
pi@raspberrypi ~ $ gpio readall
+-----+-----+---------+------+---+-Model B2-+---+------+---------+-----+-----+
| BCM | wPi | Name | Mode | V | Physical | V | Mode | Name | wPi | BCM |
+-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+
| | | 3.3v | | | 1 || 2 | | | 5v | | |
| 2 | 8 | SDA.1 | IN | 1 | 3 || 4 | | | 5V | | |
| 3 | 9 | SCL.1 | IN | 1 | 5 || 6 | | | 0v | | |
| 4 | 7 | GPIO. 7 | IN | 1 | 7 || 8 | 1 | ALT0 | TxD | 15 | 14 |
| | | 0v | | | 9 || 10 | 1 | ALT0 | RxD | 16 | 15 |
| 17 | 0 | GPIO. 0 | OUT | 1 | 11 || 12 | 1 | OUT | GPIO. 1 | 1 | 18 |
| 27 | 2 | GPIO. 2 | OUT | 1 | 13 || 14 | | | 0v | | |
| 22 | 3 | GPIO. 3 | OUT | 1 | 15 || 16 | 1 | OUT | GPIO. 4 | 4 | 23 |
| | | 3.3v | | | 17 || 18 | 1 | OUT | GPIO. 5 | 5 | 24 |
| 10 | 12 | MOSI | IN | 0 | 19 || 20 | | | 0v | | |
| 9 | 13 | MISO | IN | 0 | 21 || 22 | 1 | OUT | GPIO. 6 | 6 | 25 |
| 11 | 14 | SCLK | IN | 0 | 23 || 24 | 0 | IN | CE0 | 10 | 8 |
| | | 0v | | | 25 || 26 | 0 | IN | CE1 | 11 | 7 |
+-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+
| 28 | 17 | GPIO.17 | IN | 0 | 51 || 52 | 0 | IN | GPIO.18 | 18 | 29 |
| 30 | 19 | GPIO.19 | IN | 0 | 53 || 54 | 0 | IN | GPIO.20 | 20 | 31 |
+-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+
| BCM | wPi | Name | Mode | V | Physical | V | Mode | Name | wPi | BCM |
+-----+-----+---------+------+---+-Model B2-+---+------+---------+-----+-----+
pi@raspberrypi ~ $
I have similar results when I try reading individual pins or (most importantly) setting a pin's on/off state. The command is accepted (I have whitelisted gpio in the .syscommand file) but it just doesn't return anything. And when it is supposed to execute the commands to set pins on/off I will manually read the pin's state (after the set command "completes) but the state is unchanged.
There are no errors being reported in the /var/log/z-way-server.log nor in the system log.
Has anyone else experienced this?
Edit:
For what it's worth I am able to successfully execute other commands through system().
For example this command executes just fine even though it is piped through multiple commands. So I'm at a loss why gpio is being the exception.
Code: Select all
var CLI_tempSensorCommand = "sed -n '2p' < "+"/sys/bus/w1/devices/"+tempSensorID+"/w1_slave"+" | awk '{print $10; }' | cut -c 3-";
system(CLI_tempSensorCommand);