Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[automower] Implementation of complete automower API #17545

Open
wants to merge 37 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
c381e14
started implementation of complete automower API
MikeTheTux Oct 12, 2024
1445a1f
workaround for bug in automower API (issue created)
MikeTheTux Oct 12, 2024
3a68f00
WorkAreas and StayOutZones
MikeTheTux Oct 12, 2024
d788084
QuantityType instead of DecimalType
MikeTheTux Oct 12, 2024
4fa132d
relative statistics and patterns
MikeTheTux Oct 12, 2024
0e7d284
reverted logic
MikeTheTux Oct 12, 2024
3858e80
full calendar read support
MikeTheTux Oct 12, 2024
7f1d520
finally ...
MikeTheTux Oct 12, 2024
f74213b
new mowerZoneId config parameter
MikeTheTux Oct 13, 2024
eb132a5
cleaned up time zone handling
MikeTheTux Oct 13, 2024
a38b63f
implementation of CalendarTask POST
MikeTheTux Oct 13, 2024
b120aec
implemented sendAutomowerSettings
MikeTheTux Oct 13, 2024
b2f789a
sendAutomowerSettings
MikeTheTux Oct 13, 2024
cdbfce7
sendAutomowerSettings()
MikeTheTux Oct 13, 2024
7a292c8
re-trigger build
MikeTheTux Oct 13, 2024
0f62224
added CHANNEL_STATUS_WORK_AREA_ID channels
MikeTheTux Oct 17, 2024
7c9ad9d
implemented sendAutomowerConfirmError()
MikeTheTux Oct 17, 2024
5702549
fixed updateProperties()
MikeTheTux Oct 17, 2024
887f527
added sendAutomowerStayOutZones
MikeTheTux Oct 18, 2024
3f24b27
added sendAutomowerWorkArea()
MikeTheTux Oct 19, 2024
34c5d7b
refactored actions
MikeTheTux Oct 21, 2024
be2285b
clean-ups
MikeTheTux Oct 21, 2024
119a33d
updated changelog
MikeTheTux Oct 21, 2024
320f6e5
own review + findings
MikeTheTux Oct 22, 2024
159b828
robustness improvements
MikeTheTux Nov 9, 2024
9607dad
updated README.md
MikeTheTux Nov 10, 2024
cc07d5e
added actions to README.md
MikeTheTux Nov 10, 2024
c2269c5
README.md
MikeTheTux Nov 10, 2024
ab0fe97
testing, fixes
MikeTheTux Nov 11, 2024
db81cca
mvn i18n:generate-default-translations
MikeTheTux Nov 13, 2024
e20c4be
further improvements after testing
MikeTheTux Nov 13, 2024
9889aff
API release 2024-10-14 (https://developer.husqvarnagroup.cloud/apis/a…
MikeTheTux Nov 18, 2024
9f84daf
ResetCuttingBladeUsageTime with QuantityType
MikeTheTux Nov 18, 2024
33280d8
added error message
MikeTheTux Nov 21, 2024
55def92
static channels + channel groups
MikeTheTux Nov 23, 2024
cd70c8b
dynamic channels, static channel groups
MikeTheTux Dec 1, 2024
b55dd1a
added message channels
MikeTheTux Dec 6, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bundles/org.openhab.binding.automower/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ All Husqvarna Automower models with "Automower Connect" should be supported. It

## Discovery

Once the bridge is created and configured, openHAB will automatically discover all Automowers registered on your account.
Once the bridge is created and configured, OpenHab will automatically discover all Automowers registered on your account.
lsiepel marked this conversation as resolved.
Show resolved Hide resolved

## Thing Configuration

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,12 @@ public class AutomowerBindingConstants {
public static final String CHANNEL_STATISTIC_NUMBER_OF_COLLISIONS = GROUP_STATUS + "stat-number-of-collisions";
public static final String CHANNEL_STATISTIC_TOTAL_CHARGING_TIME = GROUP_STATUS + "stat-total-charging-time";
public static final String CHANNEL_STATISTIC_TOTAL_CUTTING_TIME = GROUP_STATUS + "stat-total-cutting-time";
public static final String CHANNEL_STATISTIC_TOTAL_CUTTING_PERCENT = GROUP_STATUS + "stat-total-cutting-percent";
public static final String CHANNEL_STATISTIC_TOTAL_DRIVE_DISTANCE = GROUP_STATUS + "stat-total-drive-distance";
public static final String CHANNEL_STATISTIC_TOTAL_RUNNING_TIME = GROUP_STATUS + "stat-total-running-time";
public static final String CHANNEL_STATISTIC_TOTAL_SEARCHING_TIME = GROUP_STATUS + "stat-total-searching-time";
public static final String CHANNEL_STATISTIC_TOTAL_SEARCHING_PERCENT = GROUP_STATUS
+ "stat-total-searching-percent";

// Position Channels ids
public static final String GROUP_POSITIONS = ""; // no channel group in use at the moment, we'll possibly
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,22 @@ private void updateChannelState(@Nullable Mower mower) {
updateState(CHANNEL_STATISTIC_TOTAL_SEARCHING_TIME,
new QuantityType<>(mower.getAttributes().getStatistics().getTotalSearchingTime(), Units.SECOND));

if (mower.getAttributes().getStatistics().getTotalRunningTime() != 0) {
updateState(CHANNEL_STATISTIC_TOTAL_CUTTING_PERCENT,
new QuantityType<>(
(float) mower.getAttributes().getStatistics().getTotalCuttingTime()
/ (float) mower.getAttributes().getStatistics().getTotalRunningTime() * 100.0,
Units.PERCENT));
updateState(CHANNEL_STATISTIC_TOTAL_SEARCHING_PERCENT,
new QuantityType<>(
(float) mower.getAttributes().getStatistics().getTotalSearchingTime()
/ (float) mower.getAttributes().getStatistics().getTotalRunningTime() * 100.0,
Units.PERCENT));
} else {
updateState(CHANNEL_STATISTIC_TOTAL_CUTTING_PERCENT, new QuantityType<>(0, Units.PERCENT));
updateState(CHANNEL_STATISTIC_TOTAL_SEARCHING_PERCENT, new QuantityType<>(0, Units.PERCENT));
}

updateState(LAST_POSITION,
new PointType(new DecimalType(mower.getAttributes().getLastPosition().getLatitude()),
new DecimalType(mower.getAttributes().getLastPosition().getLongitude())));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,11 @@
<channel id="stat-number-of-collisions" typeId="statNumberOfCollisionsType"/>
<channel id="stat-total-charging-time" typeId="statTotalChargingTimeType"/>
<channel id="stat-total-cutting-time" typeId="statTotalCuttingTimeType"/>
<channel id="stat-total-cutting-percent" typeId="statTotalCuttingPercentType"/>
<channel id="stat-total-drive-distance" typeId="statTotalDriveDistanceType"/>
<channel id="stat-total-running-time" typeId="statTotalRunningTimeType"/>
<channel id="stat-total-searching-time" typeId="statTotalSearchingTimeType"/>
<channel id="stat-total-searching-percent" typeId="statTotalSearchingPercentType"/>

<!-- Commands -->
<channel id="start" typeId="start"/>
Expand Down Expand Up @@ -438,7 +440,7 @@
<item-type>Number:Time</item-type>
<label>Cutting Blade Usage Time</label>
<description>The time since the last reset of the cutting blade usage counter</description>
<state readOnly="true"/>
<state readOnly="true" pattern="%.1f h"/>
</channel-type>

<channel-type id="statNumberOfChargingCyclesType">
Expand All @@ -459,35 +461,49 @@
<item-type>Number:Time</item-type>
<label>Total Charging Time</label>
<description>Total charging time</description>
<state readOnly="true"/>
<state readOnly="true" pattern="%.1f h"/>
</channel-type>

<channel-type id="statTotalCuttingTimeType">
<item-type>Number:Time</item-type>
<label>Total Cutting Time</label>
<description>Total cutting time</description>
<state readOnly="true"/>
<state readOnly="true" pattern="%.1f h"/>
</channel-type>

<channel-type id="statTotalCuttingPercentType">
<item-type>Number:Dimensionless</item-type>
<label>Relative Total Cutting Time</label>
<description>Total cutting time in percent</description>
<state readOnly="true" pattern="%.1f %%"/>
</channel-type>

<channel-type id="statTotalDriveDistanceType">
<item-type>Number:Length</item-type>
<label>Total Drive Distance</label>
<description>Total driven distance</description>
<state readOnly="true"/>
<state readOnly="true" pattern="%.1f km"/>
</channel-type>

<channel-type id="statTotalRunningTimeType">
<item-type>Number:Time</item-type>
<label>Total Running Time</label>
<description>The total running time (the wheel motors have been running)</description>
<state readOnly="true"/>
<state readOnly="true" pattern="%.1f h"/>
</channel-type>

<channel-type id="statTotalSearchingTimeType">
<item-type>Number:Time</item-type>
<label>Total Searching Time</label>
<description>The total searching time</description>
<state readOnly="true"/>
<state readOnly="true" pattern="%.1f h"/>
</channel-type>

<channel-type id="statTotalSearchingPercentType">
<item-type>Number:Dimensionless</item-type>
<label>Relative Total Searching Time</label>
<description>The total searching time in percent</description>
<state readOnly="true" pattern="%.1f %%"/>
</channel-type>

<channel-type id="positionType">
Expand Down Expand Up @@ -546,7 +562,7 @@
<item-type>Number:Dimensionless</item-type>
<label>Cutting height in percent</label>
<description>Cutting height in percent. 0-100</description>
<state readOnly="true"/>
<state readOnly="true" pattern="%d %%"/>
</channel-type>

<channel-type id="workareasEnabledType">
Expand All @@ -560,7 +576,7 @@
<item-type>Number:Dimensionless</item-type>
<label>Work Area Progress</label>
<description>The progress on a work area. EPOS mowers and systematic mowing work areas only.</description>
<state readOnly="true"/>
<state readOnly="true" pattern="%d %%"/>
</channel-type>

<channel-type id="workareasLastTimeCompletedType">
Expand Down