pyupm_hwxpxx module¶
-
class
pyupm_hwxpxx.
HWXPXX
(*args)[source]¶ Bases:
object
UPM API for the Veris HWXPXX Hardware Protocol Humidity and Temperature Sensor.
ID: hwxpxx
Name: Veris HWXPXX Hardware Protocol Humidity and Temperature Sensor
Category: temp
Manufacturer: veris
Connection: uart
Link:http://cpengineerscorp.net/veris-industries-hwxphtx.html This module implements support for the Veris HWXPHTX Hardware Protocol Humidity and Temperature Sensor family. It uses MODBUS over an RS485 interface. You must have libmodbus v3.1.2 (or greater) installed to compile and use this driver.
This module was developed using libmodbus 3.1.2, and the HWXPHTX. This sensor supports humidity, and optionally, temperature, slider switch, and override switch reporting. The HWXPHTX used to develop this driver did not include the optional slider or override switches, however support for them is provided.
It was developed using an RS232->RS485 inteface. You cannot use the built in MCU TTL UART pins for accessing this device you must use a full serial RS232->RS485 interface connected via USB.
C++ includes: hwxpxx.hpp
-
COIL_OVERRIDE
= 1¶
-
COIL_TEMP_SCALE
= 0¶
-
HOLDING_HUM_OFFSET
= 1¶
-
HOLDING_TEMP_OFFSET
= 0¶
-
INPUT_HUMIDITY
= 0¶
-
INPUT_SLIDER
= 2¶
-
INPUT_TEMPERATURE
= 1¶
-
clearOverrideSwitch
()[source]¶ void clearOverrideSwitch()
Clear the override switch status (set it to false). If this option is not installed, then this method will have no effect (the overide switch status will always be false).
-
getHumidity
()[source]¶ float getHumidity()
Get the current relative humidity. update() must have been called prior to calling this method.
The last humidity reading
-
getHumidityOffset
()[source]¶ int getHumidityOffset()
Return the current humidity offset stored on the device. This is a value between -100 and +100, specified in tenths of a percent. This offset is applied to the returned humidity reading by the device.
The current humidity offset in tenths of a percent
-
getOverrideSwitchStatus
()[source]¶ bool getOverrideSwitchStatus()
Get the current override switch status. update() must have been called prior to calling this method. This returns true if the override switch was pressed. Use clearOverrideSwitch() to reset this value to false. If this option is not installed, then this method will always return false. It is not possible to programatically set this value to true - that can only be done by physically pressing the override switch.
The last overide switch status reading
-
getSlaveID
()[source]¶ string getSlaveID()
Return a string corresponding the the device’s MODBUS slave ID. This includes information such as the manufacturer, device model number and serial number.
string represnting the MODBUS slave ID
-
getSlider
()[source]¶ int getSlider()
Get the current slider switch position. update() must have been called prior to calling this method. This returns a value between 0-100 corresponding to the position of the slider switch. If this option is not installed, this method will always return 0.
The last slider switch reading
-
getTemperature
(fahrenheit=False)[source]¶ float getTemperature(bool fahrenheit=false)
Get the current temperature. update() must have been called prior to calling this method. If this option was not installed, this method will always return 0C/0F, depending on the scale the device is operating in natively.
fahrenheit: true to return the temperature in degrees fahrenheit, false to return the temperature in degrees celsius. The default is false (degrees Celsius).
The last temperature reading in Celsius or Fahrenheit
-
getTemperatureOffset
()[source]¶ int getTemperatureOffset()
Return the current temperature offset stored on the device. This is a value between -50 and +50, specified in tenths of a degree in whatever scale (Celsius or Fahrenheit) is in use. This offset is applied to the returned temperature reading by the device.
The current temperature offset in tenths of a degree
-
setDebug
(enable)[source]¶ void setDebug(bool enable)
Enable or disable debugging output. This primarily enables and disables libmodbus debugging output.
enable: true to enable debugging, false otherwise
-
setHumidityOffset
(offset)[source]¶ void setHumidityOffset(int offset)
Set the stored humidity offset on the device. This is a value between -100 and +100, specified in tenths of a percent. This offset is applied to the returned humidity reading by the device.
offset: Offset in tenths of a percent with a range of -100 to +100
-
setSlaveAddress
(addr)[source]¶ void setSlaveAddress(int addr)
Set a new MODBUS slave address. This is useful if you have multiple HWXPXX devices on a single bus. When this method is called, the current temperature scale is re-read so that further update() calls can work correctly.
addr: The new slave address to set
-
setTemperatureOffset
(offset)[source]¶ void setTemperatureOffset(int offset)
Set the stored temperature offset on the device. This is a value between -50 and +50, specified in tenths of a degree in what ever scale (Celsius or Fahrenheit) is in use. This offset is applied to the returned temperature reading by the device.
offset: Offset in tenths of a degree with a range of -50 to +50
-
setTemperatureScale
(fahrenheit)[source]¶ void setTemperatureScale(bool fahrenheit)
Set the temperature scale used by the device. This driver detects this setting automatically and adjusts itself accordingly, so this is generally never needed. It is used to set the native reporting scale of the temperature either in degrees Celsius or Fahrenheit. Its setting will not affect the operation of getTemperature().
fahrenheit: true to set Fahrenheit, false to set Celsius
-