The OmniPro/Lumina controller acts as a "bridge" for accessing other connected devices.
-
| Omni type | Hardware Type | Things |
|:---------------------------|:-------------------------------------------------|:----------------------------------|
| Controller | Omni (Pro II, IIe, LTe), Lumina | `controller` (omni, lumina) |
| Access Control Reader Lock | Leviton Access Control Reader | `lock` |
-
## Discovery
### Controller
The devices support some of the following channels:
-| Channel Type ID | Item Type | Description | Thing types supporting this channel |
-|-----------------------------|----------------------|--------------------------------------------------------------------------------------|-----------------------------------------------------|
-| `activate_keypad_emergency` | Number | Activate a burglary, fire, or auxiliary keypad emergency alarm on Omni based models. | `area` |
-| `alarm_burglary` | Switch | Indicates if a burglary alarm is active. | `area` |
-| `alarm_fire` | Switch | Indicates if a fire alarm is active. | `area` |
-| `alarm_gas` | Switch | Indicates if a gas alarm is active. | `area` |
-| `alarm_auxiliary` | Switch | Indicates if a auxiliary alarm is active. | `area` |
-| `alarm_freeze` | Switch | Indicates if a freeze alarm is active. | `area` |
-| `alarm_water` | Switch | Indicates if a water alarm is active. | `area` |
-| `alarm_duress` | Switch | Indicates if a duress alarm is active. | `area` |
-| `alarm_temperature` | Switch | Indicates if a temperature alarm is active. | `area` |
-| `mode` | Number | Represents the area security mode. | `area`, `lumina_area` |
-| `disarm` | String | Send a 4 digit user code to disarm the system. | `area` |
-| `day` | String | Send a 4 digit user code to arm the system to day. | `area` |
-| `night` | String | Send a 4 digit user code to arm the system to night. | `area` |
-| `away` | String | Send a 4 digit user code to arm the system to away. | `area` |
-| `vacation` | String | Send a 4 digit user code to arm the system to vacation. | `area` |
-| `day_instant` | String | Send a 4 digit user code to arm the system to day instant. | `area` |
-| `night_delayed` | String | Send a 4 digit user code to arm the system to night delayed. | `area` |
-| `home` | String | Send a 4 digit user code to set the system to home. | `lumina_area` |
-| `sleep` | String | Send a 4 digit user code to set the system to sleep. | `lumina_area` |
-| `away` | String | Send a 4 digit user code to set the system to away. | `lumina_area` |
-| `vacation` | String | Send a 4 digit user code to set the system to vacation. | `lumina_area` |
-| `party` | String | Send a 4 digit user code to set the system to party. | `lumina_area` |
-| `special` | String | Send a 4 digit user code to set the system to special. | `lumina_area` |
-| `source_text_{1,2,3,4,5,6}` | String | A line of metadata from this audio source. | `audio_source` |
-| `polling` | Switch | Enable or disable polling of this audio source. | `audio_source` |
-| `zone_power` | Switch | Power status of this audio zone. | `audio_zone` |
-| `zone_mute` | Switch | Mute status of this audio zone. | `audio_zone` |
-| `zone_volume` | Dimmer | Volume level of this audio zone. | `audio_zone` |
-| `zone_source` | Number | Source for this audio zone. | `audio_zone` |
-| `zone_control` | Player | Control the audio zone, e.g. start/stop/next/previous. | `audio_zone` |
-| `system_date` | DateTime | Set controller date/time. | `controller` |
-| `last_log` | String | Last log message on the controller, represented in JSON. | `controller` |
-| `enable_disable_beeper` | Switch | Enable/Disable the beeper for this/all console(s). | `controller`, `console` |
-| `beep` | Switch | Send a beep command to this/all console(s). | `controller`, `console` |
-| `press` | Switch | Sends a button event to the controller. | `button` |
-| `low_setpoint` | Number | The current low setpoint for this humidity/temperature sensor. | `temp_sensor`, `humidity_sensor` |
-| `high_setpoint` | Number | The current high setpoint for this humidity/temperature sensor. | `temp_sensor`, `humidity_sensor` |
-| `temperature` | Number:Temperature | The current temperature at this thermostat/temperature sensor. | `thermostat`, `temp_sensor` |
-| `humidity` | Number:Dimensionless | The current relative humidity at this thermostat/humidity sensor. | `thermostat`, `humidity_sensor` |
-| `freeze_alarm` | Contact | Closed when freeze alarm is triggered by this thermostat. | `thermostat` |
-| `comm_failure` | Contact | Closed during a communications failure with this thermostat. | `thermostat` |
-| `outdoor_temperature` | Number:Temperature | The current outdoor temperature detected by this thermostat. | `thermostat` |
-| `heat_setpoint` | Number:Temperature | The current low/heating setpoint of this thermostat. | `thermostat` |
-| `cool_setpoint` | Number:Temperature | The current high/cooling setpoint of this thermostat. | `thermostat` |
-| `humidify_setpoint` | Number:Dimensionless | The current low/humidify setpoint for this thermostat. | `thermostat` |
-| `dehumidify_setpoint` | Number:Dimensionless | The current high/dehumidify setpoint for this thermostat. | `thermostat` |
-| `system_mode` | Number | The current system mode of this thermostat. | `thermostat` |
-| `fan_mode` | Number | The current fan mode of this thermostat. | `thermostat` |
-| `hold_status` | Number | The current hold status of this thermostat. | `thermostat` |
-| `status` | Number | The current numeric status of this thermostat. | `thermostat` |
-| `level` | Dimmer | Increase/Decrease the level of this unit/dimmable unit/UPB unit. | `unit`, `dimmable`, `upb` |
-| `switch` | Switch | Turn this unit/dimmable unit/flag/output/room on/off. | `unit`, `dimmable`, `upb`, `flag`, `output`, `room` |
-| `on_for_seconds` | Number | Turn on this unit for a specified number of seconds. | `unit`, `dimmable`, `upb`, `flag`, `output` |
-| `off_for_seconds` | Number | Turn off this unit for a specified number of seconds. | `unit`, `dimmable`, `upb`, `flag`, `output` |
-| `on_for_minutes` | Number | Turn on this unit for a specified number of minutes. | `unit`, `dimmable`, `upb`, `flag`, `output` |
-| `off_for_minutes` | Number | Turn off this unit for a specified number of minutes. | `unit`, `dimmable`, `upb`, `flag`, `output` |
-| `on_for_hours` | Number | Turn on this unit for a specified number of hours. | `unit`, `dimmable`, `upb`, `flag`, `output` |
-| `off_for_hours` | Number | Turn off this unit for a specified number of hours. | `unit`, `dimmable`, `upb`, `flag`, `output` |
-| `upb_status` | String | Send a UPB status request message for this UPB unit to the controller. | `upb` |
-| `value` | Number | Numeric value of this flag. | `flag` |
-| `scene_{a,b,c,d}` | Switch | Turn this scene on/off. | `room` |
-| `state` | Number | The current state of this room. | `room` |
-| `contact` | Contact | Contact state information of this zone. | `zone` |
-| `current_condition` | Number | Current condition of this zone. | `zone` |
-| `latched_alarm_status` | Number | Latched alarm status of this zone. | `zone` |
-| `arming_status` | Number | Arming status of this zone. | `zone` |
-| `bypass` | String | Send a 4 digit user code to bypass this zone. | `zone` |
-| `restore` | String | Send a 4 digit user code to restore this zone. | `zone` |
-
+| Channel Type ID | Item Type | Description | Thing types supporting this channel |
+|-----------------------------|----------------------|----------------------------------------------------------------------------------------------|-----------------------------------------------------|
+| `activate_keypad_emergency` | Number | Activate a burglary, fire, or auxiliary keypad emergency alarm on Omni based models. | `area` |
+| `alarm_burglary` | Switch | Indicates if a burglary alarm is active. | `area` |
+| `alarm_fire` | Switch | Indicates if a fire alarm is active. | `area` |
+| `alarm_gas` | Switch | Indicates if a gas alarm is active. | `area` |
+| `alarm_auxiliary` | Switch | Indicates if a auxiliary alarm is active. | `area` |
+| `alarm_freeze` | Switch | Indicates if a freeze alarm is active. | `area` |
+| `alarm_water` | Switch | Indicates if a water alarm is active. | `area` |
+| `alarm_duress` | Switch | Indicates if a duress alarm is active. | `area` |
+| `alarm_temperature` | Switch | Indicates if a temperature alarm is active. | `area` |
+| `mode` | Number | Represents the area security mode. | `area`, `lumina_area` |
+| `disarm` | String | Send a 4 digit user code to disarm the system. | `area` |
+| `day` | String | Send a 4 digit user code to arm the system to day. | `area` |
+| `night` | String | Send a 4 digit user code to arm the system to night. | `area` |
+| `away` | String | Send a 4 digit user code to arm the system to away. | `area` |
+| `vacation` | String | Send a 4 digit user code to arm the system to vacation. | `area` |
+| `day_instant` | String | Send a 4 digit user code to arm the system to day instant. | `area` |
+| `night_delayed` | String | Send a 4 digit user code to arm the system to night delayed. | `area` |
+| `home` | String | Send a 4 digit user code to set the system to home. | `lumina_area` |
+| `sleep` | String | Send a 4 digit user code to set the system to sleep. | `lumina_area` |
+| `away` | String | Send a 4 digit user code to set the system to away. | `lumina_area` |
+| `vacation` | String | Send a 4 digit user code to set the system to vacation. | `lumina_area` |
+| `party` | String | Send a 4 digit user code to set the system to party. | `lumina_area` |
+| `special` | String | Send a 4 digit user code to set the system to special. | `lumina_area` |
+| `source_text_{1,2,3,4,5,6}` | String | A line of metadata from this audio source. | `audio_source` |
+| `polling` | Switch | Enable or disable polling of this audio source. | `audio_source` |
+| `zone_power` | Switch | Power status of this audio zone. | `audio_zone` |
+| `zone_mute` | Switch | Mute status of this audio zone. | `audio_zone` |
+| `zone_volume` | Dimmer | Volume level of this audio zone. | `audio_zone` |
+| `zone_source` | Number | Source for this audio zone. | `audio_zone` |
+| `zone_control` | Player | Control the audio zone, e.g. start/stop/next/previous. | `audio_zone` |
+| `system_date` | DateTime | Controller date/time. See [Rule Actions](#rule-actions) for how to set controller date/time. | `controller` |
+| `last_log` | String | Last log message on the controller, represented in JSON. | `controller` |
+| `enable_disable_beeper` | Switch | Enable/Disable the beeper for this/all console(s). | `controller`, `console` |
+| `beep` | Switch | Send a beep command to this/all console(s). | `controller`, `console` |
+| `press` | Switch | Sends a button event to the controller. | `button` |
+| `low_setpoint` | Number | The current low setpoint for this humidity/temperature sensor. | `temp_sensor`, `humidity_sensor` |
+| `high_setpoint` | Number | The current high setpoint for this humidity/temperature sensor. | `temp_sensor`, `humidity_sensor` |
+| `temperature` | Number:Temperature | The current temperature at this thermostat/temperature sensor. | `thermostat`, `temp_sensor` |
+| `humidity` | Number:Dimensionless | The current relative humidity at this thermostat/humidity sensor. | `thermostat`, `humidity_sensor` |
+| `freeze_alarm` | Contact | Closed when freeze alarm is triggered by this thermostat. | `thermostat` |
+| `comm_failure` | Contact | Closed during a communications failure with this thermostat. | `thermostat` |
+| `outdoor_temperature` | Number:Temperature | The current outdoor temperature detected by this thermostat. | `thermostat` |
+| `heat_setpoint` | Number:Temperature | The current low/heating setpoint of this thermostat. | `thermostat` |
+| `cool_setpoint` | Number:Temperature | The current high/cooling setpoint of this thermostat. | `thermostat` |
+| `humidify_setpoint` | Number:Dimensionless | The current low/humidify setpoint for this thermostat. | `thermostat` |
+| `dehumidify_setpoint` | Number:Dimensionless | The current high/dehumidify setpoint for this thermostat. | `thermostat` |
+| `system_mode` | Number | The current system mode of this thermostat. | `thermostat` |
+| `fan_mode` | Number | The current fan mode of this thermostat. | `thermostat` |
+| `hold_status` | Number | The current hold status of this thermostat. | `thermostat` |
+| `status` | Number | The current numeric status of this thermostat. | `thermostat` |
+| `level` | Dimmer | Increase/Decrease the level of this unit/dimmable unit/UPB unit. | `unit`, `dimmable`, `upb` |
+| `switch` | Switch | Turn this unit/dimmable unit/flag/output/room on/off. | `unit`, `dimmable`, `upb`, `flag`, `output`, `room` |
+| `on_for_seconds` | Number | Turn on this unit for a specified number of seconds. | `unit`, `dimmable`, `upb`, `flag`, `output` |
+| `off_for_seconds` | Number | Turn off this unit for a specified number of seconds. | `unit`, `dimmable`, `upb`, `flag`, `output` |
+| `on_for_minutes` | Number | Turn on this unit for a specified number of minutes. | `unit`, `dimmable`, `upb`, `flag`, `output` |
+| `off_for_minutes` | Number | Turn off this unit for a specified number of minutes. | `unit`, `dimmable`, `upb`, `flag`, `output` |
+| `on_for_hours` | Number | Turn on this unit for a specified number of hours. | `unit`, `dimmable`, `upb`, `flag`, `output` |
+| `off_for_hours` | Number | Turn off this unit for a specified number of hours. | `unit`, `dimmable`, `upb`, `flag`, `output` |
+| `upb_status` | String | Send a UPB status request message for this UPB unit to the controller. | `upb` |
+| `value` | Number | Numeric value of this flag. | `flag` |
+| `scene_{a,b,c,d}` | Switch | Turn this scene on/off. | `room` |
+| `state` | Number | The current state of this room. | `room` |
+| `contact` | Contact | Contact state information of this zone. | `zone` |
+| `current_condition` | Number | Current condition of this zone. | `zone` |
+| `latched_alarm_status` | Number | Latched alarm status of this zone. | `zone` |
+| `arming_status` | Number | Arming status of this zone. | `zone` |
+| `bypass` | String | Send a 4 digit user code to bypass this zone. | `zone` |
+| `restore` | String | Send a 4 digit user code to restore this zone. | `zone` |
### Trigger Channels
| `activated_event` | Event sent when a button is activated. | `button` |
| `switch_press_event` | Event sent when an ALC, UPB, Radio RA, or Starlite switch is pressed. | `dimmable`, `upb` |
+## Rule Actions
+
+This binding includes a rule action, which allows synchronizing the controller time to match the openHAB system time with a user specified zone.
+There is a separate instance for each contoller, which can be retrieved through:
+
+:::: tabs
+
+::: tab JavaScript
+
+``` javascript
+var omnilinkActions = actions.get("omnilink", "omnilink:controller:home");
+```
+
+:::
+
+::: tab DSL
+
+``` php
+val omnilinkActions = getActions("omnilink", "omnilink:controller:home")
+
+```
+
+:::
+
+::::
+
+where the first parameter always has to be `omnilink` and the second is the full Thing UID of the controller that should be used.
+Once this action instance is retrieved, you can invoke the `synchronizeControllerTime(String zone)` method on it:
+
+:::: tabs
+
+::: tab JavaScript
+
+``` javascript
+omnilinkAction.synchronizeControllerTime("America/Denver");
+```
+
+:::
+
+::: tab DSL
+
+``` php
+omnilinkAction.synchronizeControllerTime("America/Denver")
+
+```
+
+:::
+
+::::
## Full Example
14=Arming night delay
=Unknown
```
-
-### Example `omnilink.rules`
-
-```
-rule "Update OmniPro Time"
-when
- Time cron "0 0 0/1 1/1 * ? *"
-then
- OmniProTime.sendCommand( new DateTimeType() )
-end
-```
--- /dev/null
+/**
+ * Copyright (c) 2010-2022 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.omnilink.internal.action;
+
+import java.time.ZoneId;
+import java.time.ZonedDateTime;
+import java.util.Optional;
+
+import org.eclipse.jdt.annotation.NonNullByDefault;
+import org.eclipse.jdt.annotation.Nullable;
+import org.openhab.binding.omnilink.internal.handler.OmnilinkBridgeHandler;
+import org.openhab.core.automation.annotation.ActionInput;
+import org.openhab.core.automation.annotation.RuleAction;
+import org.openhab.core.i18n.TimeZoneProvider;
+import org.openhab.core.thing.binding.ThingActions;
+import org.openhab.core.thing.binding.ThingActionsScope;
+import org.openhab.core.thing.binding.ThingHandler;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * This is the action handler service for the synchronizeControllerTime action.
+ *
+ * @author Ethan Dye - Initial contribution
+ */
+@ThingActionsScope(name = "omnilink")
+@NonNullByDefault
+public class OmnilinkActions implements ThingActions {
+ private final Logger logger = LoggerFactory.getLogger(OmnilinkActions.class);
+ public static Optional<TimeZoneProvider> timeZoneProvider = Optional.empty();
+ private @Nullable OmnilinkBridgeHandler handler;
+
+ @Override
+ public void setThingHandler(@Nullable ThingHandler handler) {
+ if (handler instanceof OmnilinkBridgeHandler) {
+ this.handler = (OmnilinkBridgeHandler) handler;
+ }
+ }
+
+ @Override
+ public @Nullable ThingHandler getThingHandler() {
+ return handler;
+ }
+
+ @RuleAction(label = "@text/actionLabel", description = "@text/actionDesc")
+ public void synchronizeControllerTime(
+ @ActionInput(name = "zone", label = "@text/actionInputZoneLabel", description = "@text/actionInputZoneDesc") @Nullable String zone) {
+ OmnilinkBridgeHandler actionsHandler = handler;
+ if (actionsHandler == null) {
+ logger.debug("Action service ThingHandler is null!");
+ } else {
+ ZonedDateTime zdt;
+ if (ZoneId.getAvailableZoneIds().contains(zone)) {
+ zdt = ZonedDateTime.now(ZoneId.of(zone));
+ } else {
+ logger.debug("Time zone provided invalid, using system default!");
+ if (timeZoneProvider.isPresent()) {
+ zdt = ZonedDateTime.now(timeZoneProvider.get().getTimeZone());
+ } else {
+ zdt = ZonedDateTime.now(ZoneId.systemDefault());
+ }
+ }
+ actionsHandler.synchronizeControllerTime(zdt);
+ }
+ }
+
+ public static void synchronizeSystemTime(ThingActions actions, @Nullable String zone) {
+ ((OmnilinkActions) actions).synchronizeControllerTime(zone);
+ }
+
+ public static void setTimeZoneProvider(TimeZoneProvider tzp) {
+ timeZoneProvider = Optional.of(tzp);
+ }
+}
import java.net.UnknownHostException;
import java.time.ZonedDateTime;
import java.util.Collection;
-import java.util.Collections;
import java.util.Map;
import java.util.Optional;
+import java.util.Set;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;
import org.openhab.binding.omnilink.internal.AudioPlayer;
import org.openhab.binding.omnilink.internal.SystemType;
import org.openhab.binding.omnilink.internal.TemperatureFormat;
+import org.openhab.binding.omnilink.internal.action.OmnilinkActions;
import org.openhab.binding.omnilink.internal.config.OmnilinkBridgeConfig;
import org.openhab.binding.omnilink.internal.discovery.OmnilinkDiscoveryService;
import org.openhab.binding.omnilink.internal.exceptions.BridgeOfflineException;
@Override
public Collection<Class<? extends ThingHandlerService>> getServices() {
- return Collections.singleton(OmnilinkDiscoveryService.class);
+ return Set.of(OmnilinkDiscoveryService.class, OmnilinkActions.class);
}
public void sendOmnilinkCommand(final int message, final int param1, final int param2)
}
}
+ public void synchronizeControllerTime(ZonedDateTime zdt) {
+ boolean inDaylightSavings = zdt.getZone().getRules().isDaylightSavings(zdt.toInstant());
+ try {
+ getOmniConnection().setTimeCommand(zdt.getYear() - 2000, zdt.getMonthValue(), zdt.getDayOfMonth(),
+ zdt.getDayOfWeek().getValue(), zdt.getHour(), zdt.getMinute(), inDaylightSavings);
+ } catch (IOException | OmniNotConnectedException | OmniInvalidResponseException
+ | OmniUnknownMessageTypeException e) {
+ logger.debug("Could not send set date time command to OmniLink Controller: {}", e.getMessage());
+ }
+ }
+
private SystemFeatures reqSystemFeatures()
throws OmniInvalidResponseException, OmniUnknownMessageTypeException, BridgeOfflineException {
try {
}
switch (channelUID.getId()) {
- case CHANNEL_SYSTEM_DATE:
- if (command instanceof DateTimeType) {
- ZonedDateTime zdt = ((DateTimeType) command).getZonedDateTime();
- boolean inDaylightSavings = zdt.getZone().getRules().isDaylightSavings(zdt.toInstant());
- try {
- getOmniConnection().setTimeCommand(zdt.getYear() - 2000, zdt.getMonthValue(),
- zdt.getDayOfMonth(), zdt.getDayOfWeek().getValue(), zdt.getHour(), zdt.getMinute(),
- inDaylightSavings);
- } catch (IOException | OmniNotConnectedException | OmniInvalidResponseException
- | OmniUnknownMessageTypeException e) {
- logger.debug("Could not send Set Time command to OmniLink Controller: {}", e.getMessage());
- }
- } else {
- logger.debug("Invalid command: {}, must be DateTimeType", command);
- }
- break;
case CHANNEL_CONSOLE_ENABLE_DISABLE_BEEPER:
if (command instanceof StringType) {
try {
OmniUnknownMessageTypeException {
SystemStatus status = getOmniConnection().reqSystemStatus();
logger.debug("Received system status: {}", status);
- // Let's update system time
+ // Update controller's reported time
String dateString = new StringBuilder().append(2000 + status.getYear()).append("-")
.append(String.format("%02d", status.getMonth())).append("-")
.append(String.format("%02d", status.getDay())).append("T")