fsusr Posted March 4, 2015 Share Posted March 4, 2015 Hello,I have a hub device (Wink hub) that I want to query for status. I have no experience with this, but PHP looks like a good tool to use. I'm a total newbie, and was hoping someone here can "whip up a script" for me.From a Raspberry Pi, I'm running a command that queries a Wink Hub (home automation hub) for the status of a device. I can run this command from the Raspberry Pi like this: curl "http://192.168.1.19/set_dev_value.php" -d "nodeId=a&attrId=aprontest -m1 -l;" The return for this command, which just gets spit out from the prompt is something like this:Gang ID: 0x7c2f22ed Manufacturer ID: 0x1131, Product Number: 0xa047 Device has 20 attributes... New IAS Zone ATTRIBUTE | DESCRIPTION | TYPE | MODE | GET | SET 61440 | ZCLVersion | UINT8 | R | 1 | 61441 | ApplicationVersion | UINT8 | R | 20 | 61442 | StackVersion | UINT8 | R | 51 | 61443 | HWVersion | UINT8 | R | 16 | 61444 | ManufacturerName | STRING | R | Sercomm Corp. | 61445 | ModelIdentifier | STRING | R | Tripper | 61446 | DateCode | STRING | R | 20140814 | 61447 | PowerSource | UINT8 | R | 3 | 127008 | BatteryVoltage | UINT8 | R | 29 | 127029 | BatteryAlarmMask | UINT8 | R/W | 15 | 127030 | BatteryVoltageMinThreshold | UINT8 | R/W | 25 | 127031 | BatteryVoltageThreshold1 | UINT8 | R/W | 25 | 127032 | BatteryVoltageThreshold2 | UINT8 | R/W | 25 | 127033 | BatteryVoltageThreshold3 | UINT8 | R/W | 26 | 83947520 | ZoneState | UINT8 | R | 0 | 83947521 | ZoneType | UINT16 | R | 21 | 83947522 | ZoneStatus | UINT16 | R | 49 | 83947536 | IasCieAddress | UINT64 | R | | 83947537 | ZoneID | UINT8 | R | 1 | 1699842 | ZB_CurrentFileVersion | UINT32 | R | | The "ZoneStatus" value is 49 for "opened" and 48 for "closed". I need to parse this for 48 or 49, and then I want to then use the php script, in a IF statement (depending on if it's opened or closed), to run a command like this:curl --header "Content-Type: text/plain" --request PUT --data "OFF" http://192.168.1.21:8080/rest/items/MyLight/state I'm super new to this and hoping someone can just "do it for me". I know I know, not going about it the "teach me to fish" way Link to comment https://forums.phpfreaks.com/topic/295065-php-newbie-how-to-run-a-command-parse-the-output/ Share on other sites More sharing options...
Muddy_Funster Posted May 27, 2015 Share Posted May 27, 2015 You want the freelance board, this is for people who want help with their own code. Link to comment https://forums.phpfreaks.com/topic/295065-php-newbie-how-to-run-a-command-parse-the-output/#findComment-1512680 Share on other sites More sharing options...
Barand Posted June 9, 2015 Share Posted June 9, 2015 Is this of use http://www.phpclasses.org/blog/post/287-PHP-Integration-with-Embedded-Hardware-Device-Sensors.html Link to comment https://forums.phpfreaks.com/topic/295065-php-newbie-how-to-run-a-command-parse-the-output/#findComment-1513560 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.