Skip to content

[emerald] Initial contribution for Emerald Heat Pump Hot Water Systems - #21477

Closed
psmedley wants to merge 92 commits into
openhab:mainfrom
psmedley:emerald-hws
Closed

[emerald] Initial contribution for Emerald Heat Pump Hot Water Systems#21477
psmedley wants to merge 92 commits into
openhab:mainfrom
psmedley:emerald-hws

Conversation

@psmedley

Copy link
Copy Markdown
Contributor

Adds support to openHAB for the range of Emerald Hot Water Systems which are available for sale in Australia and Ne Zealand.

psmedley added 30 commits May 30, 2025 17:47
Signed-off-by: Paul Smedley <paul@smedley.id.au>
Signed-off-by: Paul Smedley <paul@smedley.id.au>
Signed-off-by: Paul Smedley <paul@smedley.id.au>
Signed-off-by: Paul Smedley <paul@smedley.id.au>
Signed-off-by: Paul Smedley <paul@smedley.id.au>
Signed-off-by: Paul Smedley <paul@smedley.id.au>
Signed-off-by: Paul Smedley <paul@smedley.id.au>
Signed-off-by: Paul Smedley <paul@smedley.id.au>
Signed-off-by: Paul Smedley <paul@smedley.id.au>
Signed-off-by: Paul Smedley <paul@smedley.id.au>
Signed-off-by: Paul Smedley <paul@smedley.id.au>
Signed-off-by: Paul Smedley <paul@smedley.id.au>
Signed-off-by: Paul Smedley <paul@smedley.id.au>
Signed-off-by: Paul Smedley <paul@smedley.id.au>
Signed-off-by: Paul Smedley <paul@smedley.id.au>
Signed-off-by: Paul Smedley <paul@smedley.id.au>
Signed-off-by: Paul Smedley <paul@smedley.id.au>
Signed-off-by: Paul Smedley <paul@smedley.id.au>
Signed-off-by: Paul Smedley <paul@smedley.id.au>
Signed-off-by: Paul Smedley <paul@smedley.id.au>
Signed-off-by: Paul Smedley <paul@smedley.id.au>
jimtng and others added 3 commits August 28, 2026 16:44
…1471)

* [yamlcomposer] Fix `if` indentations in the markdown table

Signed-off-by: Jimmy Tanagra <jcode@tanagra.id.au>
Signed-off-by: Leo Siepel <leosiepel@gmail.com>
Bumps [actions/setup-java](https://github.com/actions/setup-java) from 5 to 6.
- [Release notes](https://github.com/actions/setup-java/releases)
- [Commits](actions/setup-java@v5...v6)

---
updated-dependencies:
- dependency-name: actions/setup-java
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 228 out of 276 changed files in this pull request and generated 10 comments.

Suppressed comments (8)

bundles/org.openhab.binding.emerald/src/main/java/org/openhab/binding/emerald/internal/EmeraldHWSHandler.java:66

  • For RefreshType the handler currently returns without updating any channel states. This means UI-triggered refreshes (and rules that send REFRESH) won’t republish the latest values. Call updateChannels() when a refresh is received.
    bundles/org.openhab.binding.emerald/src/main/java/org/openhab/binding/emerald/internal/EmeraldAccountHandler.java:405
  • Same unsafe cast pattern here: (EmeraldHWSHandler) thing.getHandler() can throw if the Thing’s handler is not (or not yet) an EmeraldHWSHandler. Guard with instanceof before calling updateChannels().
    bundles/org.openhab.binding.emerald/src/main/java/org/openhab/binding/emerald/internal/api/EmeraldList.java:50
  • Heatpump is also a non-static inner DTO. Gson treats non-static member classes as non-deserializable because they require an outer instance. Make it static to avoid runtime JSON parse errors.
    bundles/org.openhab.binding.emerald/src/main/java/org/openhab/binding/emerald/internal/api/EmeraldList.java:80
  • LastState is a non-static inner DTO. Gson cannot deserialize non-static member classes without an outer instance. Make it static to prevent JSON parsing failures.
    bundles/org.openhab.binding.emerald/README.md:36
  • The channel documentation for mode lists (Normal/Economy/Boost), but the binding’s channel options are Boost/Normal/Quiet. This mismatch can confuse users when they compare UI values vs documentation.
    bundles/org.openhab.binding.emerald/README.md:42
  • Typo: “capacicty” should be “capacity”.
    bundles/org.openhab.binding.emerald/src/main/resources/OH-INF/thing/thing-types.xml:75
  • fault is a plain Number channel (no unit), but the pattern includes %unit%. This typically renders oddly and provides no value. Use a unitless pattern.
    bundles/org.openhab.binding.emerald/src/main/resources/OH-INF/thing/thing-types.xml:87
  • work-state is a plain Number channel (no unit), but the pattern includes %unit%, which typically renders as an empty unit. Use a unitless pattern.

Comment on lines +158 to +164
Request request = httpClient.newRequest(uri).method(method).header("accept", "*/*")
.header("content-type", "application/json")
.header("user-agent",
"EmeraldPlanet/2.5.3 (com.emerald-ems.customer; build:5; iOS 17.2.1) Alamofire/5.4.1")
.header("accept-language", "en-GB;q=1.0, en-AU;q=0.9").header(headerKey, headerValue)
.timeout(TIMEOUT_MS, TimeUnit.MILLISECONDS)
.content(new StringContentProvider(params), "application/json");
Comment on lines +171 to +173
if (!jsonResponse.isEmpty()) {
logger.trace("JSON response: '{}'", jsonResponse);
}
Comment on lines +181 to +184
} catch (TimeoutException | ExecutionException | InterruptedException ex) {
String msg = ex.getMessage();
throw new EmeraldCommunicationException(msg != null ? msg : ex.toString(), ex);
}
Comment on lines +227 to +231
// Snap to the nearest 20% step just like the Emerald app
int rounded = (int) (Math.round(clamped / 20.0) * 20);

updateState(EmeraldBindingConstants.CHANNEL_TANK_CAPACITY, new DecimalType(rounded));
}
Comment on lines +184 to +192
getThing().getThings().forEach(child -> {
EmeraldHWSHandler handler = (EmeraldHWSHandler) child.getHandler();
if (handler != null) {
EmeraldHWSConfiguration childConfig = child.getConfiguration().as(EmeraldHWSConfiguration.class);
if (!childConfig.uuid.isEmpty() && topic.contains(childConfig.uuid)) {
handler.updateFromMqtt(payload);
}
}
});
Comment on lines +33 to +36
public String token = "";

public class Info {
public String id = "";
Comment on lines +34 to +38
public class Info {
public @NonNullByDefault({}) Property[] property;
}

public class Property {
Comment on lines +15 to +16
<name>openHAB Add-ons :: Bundles :: Emerald Binding</name>
<dependencies>

## `account` Bridge Configuration

As a minimum, a username and email are needed:
Comment on lines +60 to +63
<label>Mode</label>
<description>Mode the HWS is set to</description>
<state pattern="%.0f %unit%">
<options>
@psmedley
psmedley deleted the emerald-hws branch August 28, 2026 07:17
@psmedley
psmedley restored the emerald-hws branch August 28, 2026 07:20
@psmedley
psmedley deleted the emerald-hws branch August 28, 2026 10:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

new binding If someone has started to work on a binding. For a new binding PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.