Last active
June 21, 2018 20:44
-
-
Save tom-henderson/9ebda921e2c1b85c535c3a9e495ec680 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>Label</key> | |
<string>org.observium.agent</string> | |
<key>Program</key> | |
<string>/usr/local/lib/observium-agent/yoctopuce</string> | |
<key>Sockets</key> | |
<dict> | |
<key>Listeners</key> | |
<array> | |
<dict> | |
<key>SockServiceName</key> | |
<string>36602</string> | |
</dict> | |
</array> | |
</dict> | |
<key>inetdCompatibility</key> | |
<dict> | |
<key>Wait</key> | |
<false/> | |
</dict> | |
</dict> | |
</plist> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
from yoctopuce.yocto_api import * | |
from yoctopuce.yocto_temperature import * | |
from yoctopuce.yocto_humidity import * | |
from yoctopuce.yocto_pressure import * | |
errmsg = YRefParam() | |
YAPI.RegisterHub("usb", errmsg) | |
temperature = YTemperature.FirstTemperature() | |
humidity = YHumidity.FirstHumidity() | |
pressure = YPressure.FirstPressure() | |
print "<<<yoctopuce>>>" | |
print "temperature:rack:{}".format(temperature.get_currentValue()) | |
print "humidity:rack:{}".format(humidity.get_currentValue()) | |
print "pressure:rack:{}".format(pressure.get_currentValue()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
global $agent_sensors; | |
if (!empty($agent_data['yoctopuce'])) | |
{ | |
$sensors = explode("\n", $agent_data['yoctopuce']); | |
if (count($sensors)) | |
{ | |
foreach ($sensors as $sensor) | |
{ | |
list($sensortype, $key, $value) = explode(":", $sensor, 3); | |
$key = trim($key); | |
$value = trim($value); | |
$sensortype = trim($sensortype); | |
discover_sensor($valid['sensor'], $sensortype, $device, '', $key, 'yoctopuce', "$key", 1, $value, array(), 'agent'); | |
$agent_sensors[$sensortype]['yoctopuce'][$key] = array('description' => "$key", 'current' => $value, 'index' => $key); | |
} | |
} | |
$valid_applications['yocopuce'] = 'yoctopuce'; | |
echo(PHP_EOL); | |
unset($sensors); | |
} | |
// EOF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment