-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[avmfritz] Added ThingActions for power meter device to enable/disable high polling #19488
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
Merged
lsiepel
merged 3 commits into
openhab:main
from
cweitkamp:feature-avmfritz-powermeter-polling
Oct 19, 2025
+680
−131
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
74 changes: 74 additions & 0 deletions
74
...rc/main/java/org/openhab/binding/avmfritz/internal/actions/AVMFritzPowerMeterActions.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
/* | ||
* Copyright (c) 2010-2025 Contributors to the openHAB project | ||
* | ||
* See the NOTICE file(s) distributed with this work for additional | ||
* information. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License 2.0 which is available at | ||
* http://www.eclipse.org/legal/epl-2.0 | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
*/ | ||
package org.openhab.binding.avmfritz.internal.actions; | ||
|
||
import org.eclipse.jdt.annotation.NonNullByDefault; | ||
import org.eclipse.jdt.annotation.Nullable; | ||
import org.openhab.binding.avmfritz.internal.handler.AVMFritzPowerMeterActionsHandler; | ||
import org.openhab.core.automation.annotation.ActionInput; | ||
import org.openhab.core.automation.annotation.RuleAction; | ||
import org.openhab.core.thing.binding.ThingActions; | ||
import org.openhab.core.thing.binding.ThingActionsScope; | ||
import org.openhab.core.thing.binding.ThingHandler; | ||
|
||
/** | ||
* The {@link AVMFritzPowerMeterActions} defines thing actions for power meter devices / groups of the avmfritz binding. | ||
* | ||
* @author Christoph Weitkamp - Initial contribution | ||
*/ | ||
@ThingActionsScope(name = "avmfritz") | ||
@NonNullByDefault | ||
public class AVMFritzPowerMeterActions implements ThingActions { | ||
|
||
private @Nullable AVMFritzPowerMeterActionsHandler handler; | ||
|
||
@Override | ||
public void setThingHandler(@Nullable ThingHandler handler) { | ||
this.handler = (AVMFritzPowerMeterActionsHandler) handler; | ||
} | ||
|
||
@Override | ||
public @Nullable ThingHandler getThingHandler() { | ||
return handler; | ||
} | ||
|
||
@RuleAction(label = "@text/enablePowerMeterHighRefreshActionLabel", description = "@text/enablePowerMeterHighRefreshActionDescription") | ||
public void enablePowerMeterHighRefresh( | ||
@ActionInput(name = "Device Id", label = "@text/enablePowerMeterHighRefreshInputLabel", description = "@text/enablePowerMeterHighRefreshInputDescription", type = "java.lang.Long", required = true) @Nullable Long deviceId) { | ||
AVMFritzPowerMeterActionsHandler actionsHandler = handler; | ||
if (actionsHandler == null) { | ||
throw new IllegalArgumentException("AVMFritzPowerMeterDeviceHandler ThingHandler is null!"); | ||
} | ||
if (deviceId == null) { | ||
throw new IllegalArgumentException("Cannot enable power meter high refresh as 'deviceId' is null!"); | ||
} | ||
actionsHandler.enablePowerMeterHighRefresh(deviceId.longValue()); | ||
} | ||
|
||
public static void enablePowerMeterHighRefresh(ThingActions actions, @Nullable Long deviceId) { | ||
((AVMFritzPowerMeterActions) actions).enablePowerMeterHighRefresh(deviceId); | ||
} | ||
|
||
@RuleAction(label = "@text/disablePowerMeterHighRefreshActionLabel", description = "@text/disablePowerMeterHighRefreshActionDescription") | ||
public void disablePowerMeterHighRefresh() { | ||
AVMFritzPowerMeterActionsHandler actionsHandler = handler; | ||
if (actionsHandler == null) { | ||
throw new IllegalArgumentException("AVMFritzPowerMeterDeviceHandler ThingHandler is null!"); | ||
} | ||
actionsHandler.disablePowerMeterHighRefresh(); | ||
} | ||
|
||
public static void disablePowerMeterHighRefresh(ThingActions actions) { | ||
((AVMFritzPowerMeterActions) actions).disablePowerMeterHighRefresh(); | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
...ng.avmfritz/src/main/java/org/openhab/binding/avmfritz/internal/dto/json/EnergyStats.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* | ||
* Copyright (c) 2010-2025 Contributors to the openHAB project | ||
* | ||
* See the NOTICE file(s) distributed with this work for additional | ||
* information. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License 2.0 which is available at | ||
* http://www.eclipse.org/legal/epl-2.0 | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
*/ | ||
package org.openhab.binding.avmfritz.internal.dto.json; | ||
|
||
import com.google.gson.annotations.SerializedName; | ||
|
||
/** | ||
* | ||
* @author Christoph Weitkamp - Initial contribution | ||
*/ | ||
public class EnergyStats { | ||
@SerializedName("DeviceConnectState") | ||
public String deviceConnectState; | ||
@SerializedName("VoltageStat") | ||
public Values voltageStat; | ||
@SerializedName("MM_Value_Amp") | ||
public int mMValueAmp; | ||
@SerializedName("sum_Year") | ||
public int sumYear; | ||
@SerializedName("sum_Day") | ||
public int sumDay; | ||
@SerializedName("MM_Value_Volt") | ||
public int mMValueVolt; | ||
@SerializedName("MM_Value_Power") | ||
public int mMValuePower; | ||
@SerializedName("tabType") | ||
public String tabType; | ||
@SerializedName("DeviceID") | ||
public String deviceID; | ||
@SerializedName("DeviceSwitchState") | ||
public String deviceSwitchState; | ||
@SerializedName("EnergyStat") | ||
public Values energyStat; | ||
@SerializedName("CurrentDateInSec") | ||
public String currentDateInSec; | ||
@SerializedName("sum_Month") | ||
public int sumMonth; | ||
@SerializedName("RequestResult") | ||
public boolean requestResult; | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.