Skip to content

Commit

Permalink
Merge pull request #40 from geertmeersman/dev-current
Browse files Browse the repository at this point in the history
feat: Add REST sensor category to attributes
  • Loading branch information
geertmeersman authored Jun 7, 2023
2 parents 758dd79 + 34713cd commit be41b45
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 1 deletion.
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ A Home Assistant integration to monitor Robonect

**MQTT sensors** (when enabled) are enabled prior to the REST sensors, as they update faster.

The **REST sensors**, are updated on a configurable scan interval. When the mower is sleeping, only the status sensors are being updated (since the others have no activity and updating them would wake up the mower, resuling in a beep every time a scan happens)
The **REST sensors**, are updated on a configurable scan interval. When the mower is sleeping, only the status sensors are being updated (since the others have no activity and updating them would wake up the mower, resuling in a beep every time a scan happens). Example here: [Rest sensor and the REST category](#rest-sensor-and-the-rest-category)

---

Expand Down Expand Up @@ -71,6 +71,7 @@ The **REST sensors**, are updated on a configurable scan interval. When the mowe
- [Mowing job](#mowing-job)
- [Timer](#timer)
- [Config flow](#config-flow)
- [Rest sensor and the REST category](#rest-sensor-and-the-rest-category)

## Installation

Expand Down Expand Up @@ -505,3 +506,9 @@ cards:
![options_5](https://raw.githubusercontent.com/geertmeersman/robonect/main/images/screenshots/options_5.png)
![options_6](https://raw.githubusercontent.com/geertmeersman/robonect/main/images/screenshots/options_6.png)
![options_7](https://raw.githubusercontent.com/geertmeersman/robonect/main/images/screenshots/options_7.png)

### Rest sensor and the REST category

Note: if the sensor is a REST sensor and the category does not equal 'status', the sensor will only be updated during the non-sleeping phase of the mower

![rest_category](https://raw.githubusercontent.com/geertmeersman/robonect/main/images/screenshots/rest_category.png)
1 change: 1 addition & 0 deletions custom_components/robonect/binary_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ def set_extra_attributes(self):
if len(self.coordinator.data) and self.category in self.coordinator.data:
attributes = {
"last_synced": self.last_synced,
"category": self.category,
}
if self.entity_description.rest_attrs:
attrs = get_json_dict_path(
Expand Down
1 change: 1 addition & 0 deletions custom_components/robonect/device_tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ def update_rest_gps_state(self):
self._longitude = float(gps_state.get(ATTR_LONGITUDE))
self._attributes = {
"last_synced": self.last_synced,
"category": self.category,
ATTR_SATELLITES: gps_state.get(ATTR_SATELLITES),
}
else:
Expand Down
1 change: 1 addition & 0 deletions custom_components/robonect/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,7 @@ def set_extra_attributes(self):
if len(self.coordinator.data) and self.category in self.coordinator.data:
attributes = {
"last_synced": self.last_synced,
"category": self.category,
}
if self.entity_description.rest_attrs:
attrs = get_json_dict_path(
Expand Down
Binary file added images/screenshots/rest_category.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit be41b45

Please sign in to comment.