em27_sensors
frog.hardware.plugins.sensors.em27_sensors
¤
This module provides an interface to the EM27 monitor.
This is used to scrape the PSF27Sensor data table off the server.
Attributes¤
Classes¤
EM27Error
¤
Bases: Exception
Indicates than an error occurred while parsing the webpage.
EM27Sensors(host=EM27_HOST, poll_interval=EM27_SENSORS_POLL_INTERVAL, timeout=DEFAULT_EM27_HTTP_TIMEOUT)
¤
Bases: EM27SensorsBase
An interface for EM27 sensors on the real device.
Create a new EM27Sensors.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
host
|
str
|
The IP address or hostname of the EM27 device |
EM27_HOST
|
poll_interval
|
float
|
How often to poll the sensors (seconds) |
EM27_SENSORS_POLL_INTERVAL
|
timeout
|
float
|
The maximum time in seconds to wait for a response from the server |
DEFAULT_EM27_HTTP_TIMEOUT
|
Source code in frog/hardware/plugins/sensors/em27_sensors.py
112 113 114 115 116 117 118 119 120 121 122 123 124 125 |
|
Functions¤
EM27SensorsBase(url, poll_interval=float('nan'), timeout=DEFAULT_HTTP_TIMEOUT)
¤
Bases: HTTPDevice
, SensorsBase
An interface for monitoring EM27 properties.
Create a new EM27 property monitor.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
url
|
str
|
Web address of the automation units diagnostics page. |
required |
poll_interval
|
float
|
How often to poll the device (seconds) |
float('nan')
|
timeout
|
float
|
The maximum time in seconds to wait for a response from the server |
DEFAULT_HTTP_TIMEOUT
|
Source code in frog/hardware/plugins/sensors/em27_sensors.py
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
|
Functions¤
handle_response(response)
¤
Process received sensor data.
Source code in frog/hardware/plugins/sensors/em27_sensors.py
93 94 95 96 97 98 99 100 101 102 |
|
request_readings()
¤
Request the EM27 property data from the web server.
The HTTP request is made on a background thread.
Source code in frog/hardware/plugins/sensors/em27_sensors.py
86 87 88 89 90 91 |
|
Functions¤
get_em27_sensor_data(content)
¤
Search for the PSF27Sensor table and store the data.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
content
|
str
|
HTML content in which to search for PSF27Sensor table |
required |
Returns:
Name | Type | Description |
---|---|---|
data_table |
list[SensorReading]
|
a list of sensor properties and their values |
Source code in frog/hardware/plugins/sensors/em27_sensors.py
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
|