-
-
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
[rachio] Initial contribution #10434
Conversation
cc468f9
to
81bdd69
Compare
This pull request has been mentioned on openHAB Community. There might be relevant details there: https://community.openhab.org/t/rachio-smart-sprinkler-controller/7078/352 |
a13bd8a
to
03f81c8
Compare
@markus7017, I'm trying out the rachio binding, and noticed some messages getting logged with INFO. These will need to be changed to debug or higher. |
Thing rachio:zone:1:XXXXXXXXXXXX-5 "Rachio zone 5" @ "Sprinkler" | ||
Thing rachio:zone:1:XXXXXXXXXXXX-6 "Rachio zone 6" @ "Sprinkler" | ||
Thing rachio:zone:1:XXXXXXXXXXXX-7 "Rachio zone 7" @ "Sprinkler" | ||
Thing rachio:zone:1:XXXXXXXXXXXX-8 "Rachio zone 8" @ "Sprinkler" |
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.
I'm seeing the following in openhab.log with my 8 zone rachio:
2021-04-13 12:47:27.271 [INFO ] [el.core.internal.ModelRepositoryImpl] - Validation issues found in configuration model 'rachio.things', using it anyway:
Provide a thing type ID and a thing ID in this format:
<thingTypeId> <thingId>
Provide a thing type ID and a thing ID in this format:
<thingTypeId> <thingId>
Provide a thing type ID and a thing ID in this format:
<thingTypeId> <thingId>
Provide a thing type ID and a thing ID in this format:
<thingTypeId> <thingId>
Provide a thing type ID and a thing ID in this format:
<thingTypeId> <thingId>
Provide a thing type ID and a thing ID in this format:
<thingTypeId> <thingId>
Provide a thing type ID and a thing ID in this format:
<thingTypeId> <thingId>
Provide a thing type ID and a thing ID in this format:
<thingTypeId> <thingId>
Provide a thing type ID and a thing ID in this format:
<thingTypeId> <thingId>
@NonNullByDefault | ||
public class RachioDiscoveryService extends AbstractDiscoveryService implements DiscoveryService, ThingHandlerService { | ||
|
||
private static final int DISCOVERY_REFRESH_SEC = 900; |
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.
Why is this necessary every 15 minutes? Once a controller is configured why does this need to continually occur?
logger.info("Zone#{} '{}' (id={}) added, enabled={}", zone.zoneNumber, zone.name, zone.id, | ||
zone.getEnabled()); | ||
|
||
if (zone.getEnabled() == OnOffType.ON) { |
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.
Shouldn't all zones be added, even if they are currently be disabled? The zones can be ignored in the inbox if needed.
// register thing if it not already exists | ||
ThingUID zoneThingUID = new ThingUID(THING_TYPE_ZONE, bridgeUID, zone.getThingID()); | ||
zone.setUID(devThingUID, zoneThingUID); | ||
logger.info("Zone#{} '{}' (id={}) added, enabled={}", zone.zoneNumber, zone.name, zone.id, |
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.
logger.debug
.withLabel(dev.name + "[" + zone.zoneNumber + "]: " + zone.name).build(); | ||
thingDiscovered(zoneDiscoveryResult); | ||
} else { | ||
logger.info("Zone#{} '{}' is disabled, skip thing creation", zone.name, zone.id); |
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.
logger.debug
} | ||
} | ||
} | ||
logger.info("{} Rachio device initialized.", deviceList.size()); |
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.
logger.debug
// register thing if it not already exists | ||
ThingUID devThingUID = new ThingUID(THING_TYPE_DEVICE, bridgeUID, dev.getThingID()); | ||
dev.setUID(bridgeUID, devThingUID); | ||
logger.info(" Rachio device discovered: '{}' (id {}), S/N={}, MAC={}", dev.name, dev.id, |
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.
logger.debug
logger.info(" Rachio device discovered: '{}' (id {}), S/N={}, MAC={}", dev.name, dev.id, | ||
dev.serialNumber, dev.macAddress); | ||
logger.debug(" latitude={}, longitude={}", dev.latitude, dev.longitude); | ||
logger.info(" device status={}, paused/sleep={}, on={}", dev.status, dev.getSleepMode(), |
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.
logger.debug
zone.setEvent(evt, getTimestamp()); // and funnel all zone events to the device | ||
if (event.type.equals("ZONE_STATUS")) { | ||
if (event.zoneRunStatus.state.equals("ZONE_STARTED")) { | ||
logger.info("{}: Zone {} STARTED watering ({}).", thingId, zoneName, event.timestamp); |
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.
logger.debug
logger.info("{}: Zone {} STARTED watering ({}).", thingId, zoneName, event.timestamp); | ||
updateChannel(CHANNEL_ZONE_RUN, OnOffType.ON); | ||
} else if (event.subType.equals("ZONE_STOPPED") || event.subType.equals("ZONE_COMPLETED")) { | ||
logger.info( |
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.
logger.debug
event.durationInMinutes, event.flowVolume); | ||
updateChannel(CHANNEL_ZONE_RUN, OnOffType.OFF); | ||
} else { | ||
logger.info("{}: Event for zone {}: {} (status={}, duration = {}sec)", thingId, event.zoneName, |
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.
logger.debug
} | ||
update = true; | ||
} else if (event.subType.equals("ZONE_DELTA")) { | ||
logger.info("{}: DELTA Event for zone {}: {}.{}", thingId, zone.name, event.category, event.action); |
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.
logger.debug
} | ||
} | ||
|
||
logger.info("RachioCloud: Connector initialized"); |
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.
logger.debug
RachioDevice checkDev = de.getValue(); | ||
RachioDevice dev = deviceList.get(checkDev.id); | ||
if (dev == null) { | ||
logger.info("RachioCloud: New device detected: {} - {}", checkDev.id, checkDev.name); |
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.
logger.debug
} | ||
|
||
public void shutdown() { | ||
logger.info("RachioCloud: Shutting down"); |
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.
logger.debug
} | ||
} else if (channel.equals(RachioBindingConstants.CHANNEL_DEVICE_STOP)) { | ||
if (command == OnOffType.ON) { | ||
logger.info("STOP watering for device '{}'", dev.name); |
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.
logger.debug
} | ||
} else if (channel.equals(RachioBindingConstants.CHANNEL_DEVICE_RAIN_DELAY)) { | ||
if (command instanceof DecimalType) { | ||
logger.info("Start rain delay cycle for {} sec", command.toString()); |
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.
logger.debug
if (checkApi.getLastApiResult().isRateLimitWarning()) { | ||
skipCalls++; | ||
if (skipCalls % RACHIO_RATE_SKIP_CALLS > 0) { | ||
logger.info("RachioCloud: API limit is getting critical -> skip update ({} / {})", skipCalls, |
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.
logger.debug
// RAIN_SENSOR_DETECTION_ON, RAIN_SENSOR_DETECTION_OFF, RAIN_DELAY_ON, RAIN_DELAY_OFF | ||
logger.debug("Device {} ('{}') changed to status '{}'.", d.name, d.id, event.subType); | ||
if (event.subType.equals("COLD_REBOOT")) { | ||
logger.info("{}: Device {} was restarted, ip={}/{}, gw={}, dns={}/{}, wifi rssi={}.", thingId, |
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.
logger.debug
dev.setNetwork(event.network); | ||
} | ||
} else if (event.subType.equals("ONLINE")) { | ||
logger.info("{}: Device is ONLINE.", thingId); |
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.
logger.debug
logger.info("{}: Device is ONLINE.", thingId); | ||
dev.setStatus(event.subType); | ||
} else if (event.subType.equals("OFFLINE") || event.subType.equals("OFFLINE_NOTIFICATION")) { | ||
logger.info("{}: Device is OFFLINE (subType = '{}').", thingId, event.subType); |
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.
logger.debug
logger.info("{}: Device is OFFLINE (subType = '{}').", thingId, event.subType); | ||
dev.setStatus(event.subType); | ||
} else if (event.subType.equals("SLEEP_MODE_ON")) { | ||
logger.info("{}: Device switch to sleep mode.", thingId); |
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.
logger.debug
logger.info("{}: Device reporterd Rain Delay ON.", thingId); | ||
update = false; // details missing | ||
} else if (event.subType.equals("RAIN_DELAY_OFF")) { | ||
logger.info("{}: Device reporterd Rain Delay OFF.", thingId); |
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.
logger.debug
logger.info("{}: Device reporterd Rain Delay OFF.", thingId); | ||
update = false; // details missing | ||
} else if (event.subType.equals("RAIN_SENSOR_DETECTION_ON")) { | ||
logger.info("{}: Device reporterd a Rain Sensor ON.", thingId); |
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.
logger.debug
logger.info("{}: Device reporterd a Rain Sensor ON.", thingId); | ||
update = false; // details missing | ||
} else if (event.subType.equals("RAIN_SENSOR_DETECTION_ON")) { | ||
logger.info("{}: Device reporterd Rain Sensor OFF.", thingId); |
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.
logger.debug
update = false; // details missing | ||
} | ||
} else if (event.type.equals("SCHEDULE_STATUS")) { | ||
logger.info("{}: Status {} for schedule {}: {} (start={}, end={}, duration={}min)", thingId, |
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.
logger.debug
TimeUnit.SECONDS); | ||
} | ||
} | ||
|
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.
Missing:
@Override
protected void stopBackgroundDiscovery() {
logger.debug("Stopping background discovery for new Rachio controllers");
if (discoveryJob != null) {
discoveryJob.cancel(true);
discoveryJob = null;
}
}
Signed-off-by: Markus Michels <markus7017@gmail.com>
Signed-off-by: Markus Michels <markus7017@gmail.com>
Signed-off-by: Markus Michels <markus7017@gmail.com>
myopenhab.org) Signed-off-by: Markus Michels <markus7017@gmail.com>
properties Signed-off-by: Markus Michels <markus7017@gmail.com>
03f81c8
to
5ae3baa
Compare
Signed-off-by: Markus Michels <markus7017@gmail.com>
@markus7017 Did you see @robnielsen's review comments? |
@markus7017 Did you see @kaikreuzer's question if you saw @robnielsen comments? |
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.
Setting PR status according to pending review comments.
Marked as "stale", last activity was 14 months ago and there were unfortunately no answers to review comments. |
Hi gusy, sorry. I set other priorities, but just some people asked for OH 3.3 support so I'll work on this shortly |
<parent> | ||
<groupId>org.openhab.addons.bundles</groupId> | ||
<artifactId>org.openhab.addons.reactor.bundles</artifactId> | ||
<version>3.1.0-SNAPSHOT</version> |
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.
<version>3.1.0-SNAPSHOT</version> | |
<version>3.4.0-SNAPSHOT</version> |
Signed-off-by: Markus Michels <markus7017@gmail.com>
@@ -0,0 +1,17 @@ | |||
<?xml version="1.0" encoding="UTF-8"?> | |||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" | |||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
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.
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | |
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> |
See #11833
<parent> | ||
<groupId>org.openhab.addons.bundles</groupId> | ||
<artifactId>org.openhab.addons.reactor.bundles</artifactId> | ||
<version>3.4.0-SNAPSHOT</version> |
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.
<version>3.4.0-SNAPSHOT</version> | |
<version>4.2.0-SNAPSHOT</version> |
@@ -0,0 +1,9 @@ | |||
<?xml version="1.0" encoding="UTF-8"?> |
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.
This needs to be adapted to the new addon.xml
, the PR to adapt the developer docs is not merged yet, so if you need more details, the corresponding issue is here: openhab/openhab-core#2058
But you can also update your branch and look at another binding's addon.xml
and adapt it to this initial contribution.
This PR is 2,5 years old. In #10434 (comment) @markus7017 (PR author) commented that his priorities have changed. Now (over a year later) the status quo has not changed. As this PR needs some work (review, fixes etc), i don't think some one else will bring it to a mergable state. |
This binding integrates Rachio sprinkler controllers. The binding uses the Rachio Cloud API. Event callback can be configured to utilized myopenhab.org as a proxy.