File tree Expand file tree Collapse file tree 1 file changed +11
-8
lines changed
custom_components/sensorpush Expand file tree Collapse file tree 1 file changed +11
-8
lines changed Original file line number Diff line number Diff line change @@ -91,14 +91,17 @@ def refresh_sensorpush_data(event_time):
91
91
#hass.data[SENSORPUSH_SERVICE].update(update_devices=True)
92
92
93
93
# retrieve the latest samples from the SensorPush cloud service
94
- latest_samples = hass .data [SENSORPUSH_SERVICE ].samples ()
95
- if latest_samples :
96
- hass .data [SENSORPUSH_SAMPLES ] = latest_samples
97
-
98
- # notify all listeners (sensor entities) that they may have new data
99
- dispatcher_send (hass , SIGNAL_SENSORPUSH_UPDATED )
100
- else :
101
- LOG .warn ("Unable to fetch latest samples from SensorPush cloud" )
94
+ try :
95
+ latest_samples = hass .data [SENSORPUSH_SERVICE ].samples ()
96
+ if latest_samples :
97
+ hass .data [SENSORPUSH_SAMPLES ] = latest_samples
98
+
99
+ # notify all listeners (sensor entities) that they may have new data
100
+ dispatcher_send (hass , SIGNAL_SENSORPUSH_UPDATED )
101
+ else :
102
+ LOG .warn ("Unable to fetch latest samples from SensorPush cloud" )
103
+ except Exception as ex :
104
+ LOG .warn (f"Unable to fetch latest samples from SensorPush cloud. Error: { ex } " )
102
105
103
106
# subscribe for notifications that an update should be triggered
104
107
hass .services .register (SENSORPUSH_DOMAIN , 'update' , refresh_sensorpush_data )
You can’t perform that action at this time.
0 commit comments