Skip to content

Commit

Permalink
updated samples() call that changed in pysensorpush
Browse files Browse the repository at this point in the history
  • Loading branch information
rsnodgrass committed Jun 2, 2022
1 parent 01caf0d commit ffbefe4
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@

Home Assistant integration for wireless SensorPush temperature and humidity/hygrometer sensors.

[![coffee](https://www.buymeacoffee.com/assets/img/custom_images/black_img.png)](https://buymeacoffee.com/DYks67r)

## Hardware Supported

| Model | Temp | Humidity | Presure | Dewpoint | VPD | Waterproof | Battery Life | Range |
Expand Down
7 changes: 3 additions & 4 deletions custom_components/sensorpush/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,9 @@ def setup(hass, config):
# return False
# FIXME: log warning if no sensors found?

hass.data[SENSORPUSH_SAMPLES] = sensorpush_service.samples
hass.data[SENSORPUSH_SAMPLES] = sensorpush_service.samples()

# FIXME: trigger automatic setup of sensors


except (ConnectTimeout, HTTPError) as ex:
LOG.error("Unable to connect to SensorPush: %s", str(ex))
Expand All @@ -92,7 +91,7 @@ def refresh_sensorpush_data(event_time):
#hass.data[SENSORPUSH_SERVICE].update(update_devices=True)

# retrieve the latest samples from the SensorPush cloud service
latest_samples = hass.data[SENSORPUSH_SERVICE].samples
latest_samples = hass.data[SENSORPUSH_SERVICE].samples()
if latest_samples:
hass.data[SENSORPUSH_SAMPLES] = latest_samples

Expand Down Expand Up @@ -146,7 +145,7 @@ def extra_state_attributes(self):
@callback
def _update_callback(self):
samples = self.hass.data[SENSORPUSH_SAMPLES]
sensor_results = samples['sensors']
sensor_results = samples.get('sensors')

sensor_data = sensor_results[self._device_id]
latest_result = sensor_data[0]
Expand Down
4 changes: 2 additions & 2 deletions custom_components/sensorpush/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"name": "SensorPush",
"documentation": "https://github.com/rsnodgrass/hass-sensorpush/",
"issue_tracker": "https://github.com/rsnodgrass/hass-sensorpush/issues",
"requirements": ["pysensorpush>=0.1.6"],
"version": "0.1.0",
"requirements": ["pysensorpush>=0.1.7"],
"version": "0.1.1",
"dependencies": [],
"codeowners": ["@rsnodgrass"],
"iot_class": "cloud_polling"
Expand Down

0 comments on commit ffbefe4

Please sign in to comment.