-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
[surepetcare] Add support for waterstation Felaqua #18114
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* | ||
* 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.surepetcare.internal.dto; | ||
|
||
import java.time.ZonedDateTime; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
import com.google.gson.annotations.SerializedName; | ||
|
||
/** | ||
* The {@link SurePetcarePetDrinking} is the Java class used to represent the | ||
* status of a pet. It's used to deserialize JSON API results. | ||
* | ||
* @author Rene Scherer - Initial contribution | ||
* @author Holger Eisold - Added pet feeder status, waterstation | ||
*/ | ||
public class SurePetcarePetDrinking { | ||
|
||
public Long tagId; | ||
public Long deviceId; | ||
@SerializedName("change") | ||
public List<Float> drinkChange = new ArrayList<>(); | ||
@SerializedName("at") | ||
public ZonedDateTime drinkChangeAt; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -134,15 +134,17 @@ protected void updateThing() { | |
updateState(DEVICE_CHANNEL_PAIRING_MODE, new StringType(device.status.pairingModeId.toString())); | ||
} else { | ||
float batVol = device.status.battery; | ||
updateState(DEVICE_CHANNEL_BATTERY_VOLTAGE, new DecimalType(batVol)); | ||
updateState(DEVICE_CHANNEL_BATTERY_LEVEL, new DecimalType(Math.min( | ||
(batVol - BATTERY_EMPTY_VOLTAGE) / (BATTERY_FULL_VOLTAGE - BATTERY_EMPTY_VOLTAGE) * 100.0f, | ||
100.0f))); | ||
updateState(DEVICE_CHANNEL_BATTERY_VOLTAGE, new QuantityType<>(batVol, Units.VOLT)); | ||
updateState(DEVICE_CHANNEL_BATTERY_LEVEL, | ||
new QuantityType<>( | ||
Math.min((batVol - BATTERY_EMPTY_VOLTAGE) | ||
/ (BATTERY_FULL_VOLTAGE - BATTERY_EMPTY_VOLTAGE) * 100.0f, 100.0f), | ||
Units.PERCENT)); | ||
updateState(DEVICE_CHANNEL_LOW_BATTERY, OnOffType.from(batVol < LOW_BATTERY_THRESHOLD)); | ||
updateState(DEVICE_CHANNEL_DEVICE_RSSI, | ||
QuantityType.valueOf(device.status.signal.deviceRssi, Units.DECIBEL_MILLIWATTS)); | ||
new QuantityType<>(device.status.signal.deviceRssi, Units.DECIBEL_MILLIWATTS)); | ||
updateState(DEVICE_CHANNEL_HUB_RSSI, | ||
QuantityType.valueOf(device.status.signal.hubRssi, Units.DECIBEL_MILLIWATTS)); | ||
new QuantityType<>(device.status.signal.hubRssi, Units.DECIBEL_MILLIWATTS)); | ||
|
||
if (thing.getThingTypeUID().equals(THING_TYPE_FLAP_DEVICE)) { | ||
updateThingCurfews(device); | ||
|
@@ -175,6 +177,8 @@ protected void updateThing() { | |
new StringType(device.control.lid.closeDelayId.toString())); | ||
updateState(DEVICE_CHANNEL_BOWLS_TRAINING_MODE, | ||
new StringType(device.control.trainingModeId.toString())); | ||
} else if (thing.getThingTypeUID().equals(THING_TYPE_WATER_DEVICE)) { | ||
// TODO | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Something missing? |
||
} else { | ||
logger.warn("Unknown product type for device {}", thing.getUID().getAsString()); | ||
} | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please revert changes in this file. Translations should be provided through Crowdin after the PR is merged. See https://www.openhab.org/docs/developer/utils/i18n.html#managing-translations |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -78,7 +78,7 @@ | |
</supported-bridge-type-refs> | ||
|
||
<label>Sure Petcare Hub Device</label> | ||
<description>A Sure Petcare hub device (connects cat flaps, feeders etc. to a network)</description> | ||
<description>A Sure Petcare hub device (connects pet/cat flaps, feeders and waterstations to a network)</description> | ||
|
||
<channels> | ||
<channel id="id" typeId="idType"/> | ||
|
@@ -192,6 +192,40 @@ | |
<representation-property>id</representation-property> | ||
</thing-type> | ||
|
||
<thing-type id="waterDevice"> | ||
<supported-bridge-type-refs> | ||
<bridge-type-ref id="bridge"/> | ||
</supported-bridge-type-refs> | ||
|
||
<label>Sure Petcare Waterstation Device</label> | ||
<description>A Sure Petcare pet waterstation device</description> | ||
|
||
<channels> | ||
<channel id="id" typeId="idType"/> | ||
<channel id="name" typeId="nameType"/> | ||
<channel id="product" typeId="productType"/> | ||
<channel id="lowBattery" typeId="system.low-battery"/> | ||
<channel id="batteryLevel" typeId="system.battery-level"/> | ||
<channel id="batteryVoltage" typeId="batteryVoltageType"/> | ||
<channel id="online" typeId="onlineType"/> | ||
<channel id="deviceRSSI" typeId="rssiDeviceType"/> | ||
<channel id="hubRSSI" typeId="rssiHubType"/> | ||
</channels> | ||
|
||
<properties> | ||
<property name="id"/> | ||
<property name="version"/> | ||
<property name="createdAt"/> | ||
<property name="updatedAt"/> | ||
<property name="householdId"/> | ||
<property name="productType"/> | ||
<property name="productName"/> | ||
<property name="pairingAt"/> | ||
<property name="thingTypeVersion">1</property> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is not needed (yet). |
||
</properties> | ||
<representation-property>id</representation-property> | ||
</thing-type> | ||
|
||
<thing-type id="pet"> | ||
<supported-bridge-type-refs> | ||
<bridge-type-ref id="bridge"/> | ||
|
@@ -220,6 +254,9 @@ | |
<channel id="feederLastChange" typeId="feederLastChangeType"/> | ||
<channel id="feederLastChangeLeft" typeId="feederLastChangeLeftType"/> | ||
<channel id="feederLastChangeRight" typeId="feederLastChangeRightType"/> | ||
<channel id="waterDevice" typeId="waterDeviceType"/> | ||
<channel id="waterLastDrinking" typeId="waterLastDrinkingType"/> | ||
<channel id="waterLastChange" typeId="waterLastChangeType"/> | ||
</channels> | ||
|
||
<properties> | ||
|
@@ -272,6 +309,7 @@ | |
<option value="3">Pet Flap</option> | ||
<option value="4">Pet Feeder</option> | ||
<option value="6">Cat Flap</option> | ||
<option value="8">Waterstation</option> | ||
</options> | ||
</state> | ||
</channel-type> | ||
|
@@ -527,6 +565,27 @@ | |
<state readOnly="true" pattern="%.2f %unit%"/> | ||
</channel-type> | ||
|
||
<channel-type id="waterDeviceType"> | ||
<item-type>String</item-type> | ||
<label>Pet Waterstation Device Name</label> | ||
<description>The pet waterstation device name</description> | ||
<state readOnly="true" pattern="%s"/> | ||
</channel-type> | ||
|
||
<channel-type id="waterLastDrinkingType"> | ||
<item-type>DateTime</item-type> | ||
<label>Pet Last Drinking</label> | ||
<description>The last pet drinking</description> | ||
<state readOnly="true" pattern="%1$tY-%1$tm-%1$td %1$tH:%1$tM:%1$tS"/> | ||
</channel-type> | ||
|
||
<channel-type id="waterLastChangeType"> | ||
<item-type>Number:Volume</item-type> | ||
<label>Pet Drinking Last Change</label> | ||
<description>The pet drinking last change</description> | ||
<state readOnly="true" pattern="%.2f %unit%"/> | ||
</channel-type> | ||
|
||
<channel-type id="lockingModeType"> | ||
<item-type>String</item-type> | ||
<label>Locking Mode</label> | ||
|
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -14,6 +14,17 @@ | |||||||||||||||||||||
</instruction-set> | ||||||||||||||||||||||
</thing-type> | ||||||||||||||||||||||
|
||||||||||||||||||||||
<thing-type uid="surepetcare:waterDevice"> | ||||||||||||||||||||||
<instruction-set targetVersion="1"> | ||||||||||||||||||||||
<update-channel id="deviceRSSI"> | ||||||||||||||||||||||
<type>surepetcare:rssiDeviceType</type> | ||||||||||||||||||||||
</update-channel> | ||||||||||||||||||||||
<update-channel id="hubRSSI"> | ||||||||||||||||||||||
<type>surepetcare:rssiHubType</type> | ||||||||||||||||||||||
</update-channel> | ||||||||||||||||||||||
</instruction-set> | ||||||||||||||||||||||
</thing-type> | ||||||||||||||||||||||
|
||||||||||||||||||||||
Comment on lines
+17
to
+27
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since the thing type
Suggested change
However, for thing type |
||||||||||||||||||||||
<thing-type uid="surepetcare:flapDevice"> | ||||||||||||||||||||||
<instruction-set targetVersion="1"> | ||||||||||||||||||||||
<update-channel id="deviceRSSI"> | ||||||||||||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.