SensorPush Gateway Driver
This driver connects to the SensorPush cloud-based API to retrieve sensor readings.
Background
SensorPush sell a temperature and humidity sensor with Bluetooth connectivity for connecting directly to a mobile phone / tablet to collect sensor readings. Each sensor is able to store up to 20 days worth of readings that can be downloaded when the mobile device is back in range. You can also purchase a gateway to allow readings to be sent to the SensorPush cloud storage, making these available away from home on your mobile phone and through the SensorPush API.
NOTE - This driver relies on the use of the SensorPush Gateway and the storage of sensor readings in the cloud, it cannot connect to SensorPush sensors directly.
The Driver
How Does It Work?
The SensorPush Gateway driver connects to the SensorPush cloud-hosted API to retrieve the list of sensors configured on the gateway, setting up two child devices per sensor, one as a temperature sensor virtual device and another as a humidity sensor virtual device. Regular updates of the current sensor readings can be configured, either using the in-built polling options, or using an RM Rule to trigger a device refresh for the gateway device.
Installation and Setup
Recommended installation method is to use the Community developed Hubitat Package Manager
For manual installation, follow the instructions below, using the driver code located [here]
(https://raw.githubusercontent.com/sburke781/hubitat/master/SensorPush/SensorPushGateway_driver.groovy)
- Access the driver from the GitHub link above, clicking on the RAW button to open the text only view
- Copy the driver text from the RAW view
- On your HE hub, open the Drivers Code section of the HE Web UI
- Paste in the driver code
- Click Save to install the SensorPush Gateway driver
Before starting to call the SensorPush API you MUST access the web-based SensorPush Dashboard to accept their terms and conditions. Log into the dashboard with the same credentials used to setup the Gateway in the SensorPush app. Thanks to @Dread_Pirate_Roberts for reminding me of this.
Creating a SensorPush Gateway Virtual Device
- Open the Devices section of the HE Web UI
- Click the "Add Virtual Device" button on the top right of the page
- Enter a "Device Name" and select the SensorPush Gateway driver from the "Type" drop-down list
- Click the "Save Device" button to create the new device
- The Device Edit page will display
Configuring the SensorPush Gateway Virtual Device
- In the Preferences section, enter your Username / E-Mail and Password used when setting up the Gateway with SensorPush
- Choose whether to enable or disable the Automatic Sensor Polling option, and if enabled, the number of minutes between polling of sensor readings
- Adjust the various logging options to turn on and off the different levels of logging that can occur, e.g. Information, Error, Warning and Debug Logging. It is recommended to leave Error Logging enabled.
- Click "Save Preferences"
- Click the "Get Auth Token" button (command) at the top of the device edit page, this will authenticate with the SensorPush cloud-hosted system
- Click the "Refresh" button (command) for the device
- Refresh the browser
- Review the Device Details section at the bottom of the Device Edit page. Ensure the 2 Component Devices have been created for each sensor, one for Temperature, one for Humidity. If the Automatic Sensor Polling option is turned on, ensure the Schedule Job details are displayed.
Using the SensorPush Gateway / Sensor Devices
The child devices for each sensor can be used in a number of different ways, including displaying temperature and humidity readings on dashboards, in RM rules, in various community apps, as well exporting to external data logging and visualisation setups.
Change Log
2022-07-16: 1.0.4 - (@coreystup) Added description text and units to temp and humidity events, Added info logs
2022-02-02: 1.0.3 - Fix for certificate error in HTTP calls to SensorPush API
2021-12-31: 1.0.2 - Fix for error in samples HTTP call
2021-12-28: 1.0.1 - HTTP calls now asynchronous, driver added to HPM (version 1.0.1)
2021-05-16 - Automatic Polling Fix
- Corrected the CRON job setup again, somehow it was still wrong...
2021-04-17 - Automatic Polling Fix
- Corrected issue with the automatic polling, it now honours the interval minutes setting correctly
2021-02-27 - Temperature Conversion
- Updated samples method, replacing code to always convert to degrees C with a call to convertTemperatureIfNeeded to convert temperature readings based on HE hub temperature scale setting, including before and after debug logging for the temperature conversion
- Minor adjustments to some logging to include correct method references
- Adjusted notes on HE Community thread to include step to accept terms and conditions on SensorPush Dashboard web page - thanks @Dread_Pirate_Roberts
Enjoy!!
Simon