This repository has been archived by the owner on May 7, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 780
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Wouter Born <eclipse@maindrain.net>
- Loading branch information
1 parent
dafbc9a
commit dc49b62
Showing
16 changed files
with
230 additions
and
18 deletions.
There are no files selected for viewing
32 changes: 32 additions & 0 deletions
32
extensions/binding/org.eclipse.smarthome.binding.lifx/ESH-INF/i18n/lifx.properties
This file contains 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,32 @@ | ||
# binding | ||
binding.lifx.name = LIFX Binding | ||
binding.lifx.description = This is the binding for LIFX lights. | ||
|
||
# thing types | ||
thing-type.lifx.colorlight.label = LIFX Color Light | ||
thing-type.lifx.colorirlight.label = LIFX Color IR Light | ||
thing-type.lifx.colormzlight.label = LIFX Color MultiZone Light | ||
thing-type.lifx.whitelight.label = LIFX White Light | ||
|
||
# thing type configuration | ||
thing-type.config.lifx.light.deviceId.label = LIFX device ID | ||
thing-type.config.lifx.light.fadetime.label = Fade time | ||
thing-type.config.lifx.light.fadetime.description = The time to fade to the new color value (in ms). | ||
|
||
# channel types | ||
channel-type.lifx.brightness.label = Brightness | ||
channel-type.lifx.brightness.description = Sets the brightness of the light | ||
channel-type.lifx.color.label = Color | ||
channel-type.lifx.color.description = Selects the color of the light | ||
channel-type.lifx.colorzone.label = Color zone {0} | ||
channel-type.lifx.colorzone.description = Selects the zone {0} color of the light | ||
channel-type.lifx.infrared.label = Infrared | ||
channel-type.lifx.infrared.description = Sets the infrared of the light | ||
channel-type.lifx.temperature.label = Temperature | ||
channel-type.lifx.temperature.description = Sets the temperature of the light | ||
channel-type.lifx.temperaturezone.label = Temperature zone {0} | ||
channel-type.lifx.temperaturezone.description = Sets the zone {0} temperature of the light | ||
|
||
# channel type configuration | ||
channel-type.config.lifx.brightness.powerOnBrightness.label = Power on brightness | ||
channel-type.config.lifx.brightness.powerOnBrightness.description = Brightness level used when switching on the light. Use empty value to leave brightness as is. |
32 changes: 32 additions & 0 deletions
32
extensions/binding/org.eclipse.smarthome.binding.lifx/ESH-INF/i18n/lifx_nl.properties
This file contains 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,32 @@ | ||
# binding | ||
binding.lifx.name = LIFX Binding | ||
binding.lifx.description = Dit is de binding voor LIFX lampen. | ||
|
||
# thing types | ||
thing-type.lifx.colorlight.label = LIFX Kleuren Lamp | ||
thing-type.lifx.colorirlight.label = LIFX Kleuren IR Lamp | ||
thing-type.lifx.colormzlight.label = LIFX Kleuren MultiZone Lamp | ||
thing-type.lifx.whitelight.label = LIFX Wittinten Lamp | ||
|
||
# thing type configuration | ||
thing-type.config.lifx.light.deviceId.label = LIFX apparaat ID | ||
thing-type.config.lifx.light.fadetime.label = Vervagingsduur | ||
thing-type.config.lifx.light.fadetime.description = De tijdsduur van het vervagen naar een nieuwe kleur (in ms). | ||
|
||
# channel types | ||
channel-type.lifx.brightness.label = Helderheid | ||
channel-type.lifx.brightness.description = Bepaalt de helderheid van de lamp | ||
channel-type.lifx.color.label = Kleur | ||
channel-type.lifx.color.description = Bepaalt de kleur van de lamp | ||
channel-type.lifx.colorzone.label = Kleur zone {0} | ||
channel-type.lifx.colorzone.description = Bepaalt de kleur van lampzone {0} | ||
channel-type.lifx.infrared.label = Infrarood | ||
channel-type.lifx.infrared.description = Bepaalt het infraroodniveau van de lamp | ||
channel-type.lifx.temperature.label = Temperatuur | ||
channel-type.lifx.temperature.description = Bepaalt de kleurtemperatuur van de lamp | ||
channel-type.lifx.temperaturezone.label = Temperatuur zone {0} | ||
channel-type.lifx.temperaturezone.description = Bepaalt de kleurtemperatuur van lampzone {0} | ||
|
||
# channel type configuration | ||
channel-type.config.lifx.brightness.powerOnBrightness.label = Inschakelhelderheid | ||
channel-type.config.lifx.brightness.powerOnBrightness.description = Het helderheidsniveau bij inschakeling van de lamp. Gebruik een lege waarde om de helderheid ongewijzigd te laten. |
This file contains 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
22 changes: 22 additions & 0 deletions
22
extensions/binding/org.eclipse.smarthome.binding.lifx/OSGI-INF/LifxChannelFactory.xml
This file contains 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,22 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
Copyright (c) 2014-2017 by the respective copyright holders. | ||
All rights reserved. This program and the accompanying materials | ||
are made available under the terms of the Eclipse Public License v1.0 | ||
which accompanies this distribution, and is available at | ||
http://www.eclipse.org/legal/epl-v10.html | ||
--> | ||
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" activate="activate" deactivate="deactivate" immediate="true" name="org.eclipse.smarthome.binding.lifx.internal.LifxChannelFactory"> | ||
|
||
<implementation class="org.eclipse.smarthome.binding.lifx.internal.LifxChannelFactoryImpl"/> | ||
|
||
<service> | ||
<provide interface="org.eclipse.smarthome.binding.lifx.internal.LifxChannelFactory"/> | ||
</service> | ||
|
||
<reference bind="setI18nProvider" cardinality="1..1" interface="org.eclipse.smarthome.core.i18n.I18nProvider" name="I18nprovider" policy="dynamic" unbind="unsetI18nProvider"/> | ||
<reference bind="setLocaleProvider" cardinality="1..1" interface="org.eclipse.smarthome.core.i18n.LocaleProvider" name="LocaleProvider" policy="static" unbind="unsetLocaleProvider"/> | ||
|
||
</scr:component> |
This file contains 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 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
24 changes: 24 additions & 0 deletions
24
...ng.lifx/src/main/java/org/eclipse/smarthome/binding/lifx/internal/LifxChannelFactory.java
This file contains 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,24 @@ | ||
/** | ||
* Copyright (c) 2014-2017 by the respective copyright holders. | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v1.0 | ||
* which accompanies this distribution, and is available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
*/ | ||
package org.eclipse.smarthome.binding.lifx.internal; | ||
|
||
import org.eclipse.smarthome.core.thing.Channel; | ||
import org.eclipse.smarthome.core.thing.ThingUID; | ||
|
||
/** | ||
* The {@link LifxChannelFactory} creates dynamic LIFX channels. | ||
* | ||
* @author Wouter Born - Add i18n support | ||
*/ | ||
public interface LifxChannelFactory { | ||
|
||
Channel createColorZoneChannel(ThingUID thingUID, int index); | ||
|
||
Channel createTemperatureZoneChannel(ThingUID thingUID, int index); | ||
|
||
} |
89 changes: 89 additions & 0 deletions
89
...ifx/src/main/java/org/eclipse/smarthome/binding/lifx/internal/LifxChannelFactoryImpl.java
This file contains 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,89 @@ | ||
/** | ||
* Copyright (c) 2014-2017 by the respective copyright holders. | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v1.0 | ||
* which accompanies this distribution, and is available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
*/ | ||
package org.eclipse.smarthome.binding.lifx.internal; | ||
|
||
import static org.eclipse.smarthome.binding.lifx.LifxBindingConstants.*; | ||
|
||
import java.util.Locale; | ||
|
||
import org.eclipse.smarthome.core.i18n.I18nProvider; | ||
import org.eclipse.smarthome.core.i18n.LocaleProvider; | ||
import org.eclipse.smarthome.core.thing.Channel; | ||
import org.eclipse.smarthome.core.thing.ChannelUID; | ||
import org.eclipse.smarthome.core.thing.ThingUID; | ||
import org.eclipse.smarthome.core.thing.binding.builder.ChannelBuilder; | ||
import org.osgi.framework.Bundle; | ||
import org.osgi.service.component.ComponentContext; | ||
|
||
/** | ||
* The {@link LifxChannelFactoryImpl} creates dynamic LIFX channels. | ||
* | ||
* @author Wouter Born - Add i18n support | ||
*/ | ||
public class LifxChannelFactoryImpl implements LifxChannelFactory { | ||
|
||
private static final String COLOR_ZONE_LABEL_KEY = "channel-type.lifx.colorzone.label"; | ||
private static final String COLOR_ZONE_DESCRIPTION_KEY = "channel-type.lifx.colorzone.description"; | ||
|
||
private static final String TEMPERATURE_ZONE_LABEL_KEY = "channel-type.lifx.temperaturezone.label"; | ||
private static final String TEMPERATURE_ZONE_DESCRIPTION_KEY = "channel-type.lifx.temperaturezone.description"; | ||
|
||
private Bundle bundle; | ||
private I18nProvider i18nProvider; | ||
private LocaleProvider localeProvider; | ||
|
||
@Override | ||
public Channel createColorZoneChannel(ThingUID thingUID, int index) { | ||
String label = getText(COLOR_ZONE_LABEL_KEY, index); | ||
String description = getText(COLOR_ZONE_DESCRIPTION_KEY, index); | ||
return ChannelBuilder.create(new ChannelUID(thingUID, CHANNEL_COLOR_ZONE + index), "ColorItem") | ||
.withType(CHANNEL_TYPE_COLOR_ZONE).withLabel(label).withDescription(description).build(); | ||
} | ||
|
||
@Override | ||
public Channel createTemperatureZoneChannel(ThingUID thingUID, int index) { | ||
String label = getText(TEMPERATURE_ZONE_LABEL_KEY, index); | ||
String description = getText(TEMPERATURE_ZONE_DESCRIPTION_KEY, index); | ||
return ChannelBuilder.create(new ChannelUID(thingUID, CHANNEL_TEMPERATURE_ZONE + index), "DimmerItem") | ||
.withType(CHANNEL_TYPE_TEMPERATURE_ZONE).withLabel(label).withDescription(description).build(); | ||
} | ||
|
||
private String getDefaultText(String key) { | ||
return i18nProvider.getText(bundle, key, key, Locale.ENGLISH); | ||
} | ||
|
||
private String getText(String key, Object... arguments) { | ||
Locale locale = localeProvider != null ? localeProvider.getLocale() : Locale.ENGLISH; | ||
return i18nProvider != null ? i18nProvider.getText(bundle, key, getDefaultText(key), locale, arguments) : key; | ||
} | ||
|
||
protected void activate(ComponentContext componentContext) { | ||
this.bundle = componentContext.getBundleContext().getBundle(); | ||
} | ||
|
||
protected void deactivate(ComponentContext componentContext) { | ||
this.bundle = null; | ||
} | ||
|
||
protected void setI18nProvider(I18nProvider i18nProvider) { | ||
this.i18nProvider = i18nProvider; | ||
} | ||
|
||
protected void unsetI18nProvider(I18nProvider i18nProvider) { | ||
this.i18nProvider = null; | ||
} | ||
|
||
protected void setLocaleProvider(LocaleProvider localeProvider) { | ||
this.localeProvider = localeProvider; | ||
} | ||
|
||
protected void unsetLocaleProvider(LocaleProvider localeProvider) { | ||
this.localeProvider = null; | ||
} | ||
|
||
} |
This file contains 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
2 changes: 1 addition & 1 deletion
2
...e.binding.lifx/src/main/java/org/eclipse/smarthome/binding/lifx/internal/fields/HSBK.java
This file contains 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
2 changes: 1 addition & 1 deletion
2
...ding.lifx/src/main/java/org/eclipse/smarthome/binding/lifx/internal/fields/HSBKField.java
This file contains 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
2 changes: 1 addition & 1 deletion
2
...rc/main/java/org/eclipse/smarthome/binding/lifx/internal/protocol/ApplicationRequest.java
This file contains 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
2 changes: 1 addition & 1 deletion
2
.../main/java/org/eclipse/smarthome/binding/lifx/internal/protocol/GetColorZonesRequest.java
This file contains 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
2 changes: 1 addition & 1 deletion
2
.../main/java/org/eclipse/smarthome/binding/lifx/internal/protocol/SetColorZonesRequest.java
This file contains 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
2 changes: 1 addition & 1 deletion
2
...ain/java/org/eclipse/smarthome/binding/lifx/internal/protocol/StateMultiZoneResponse.java
This file contains 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
2 changes: 1 addition & 1 deletion
2
...src/main/java/org/eclipse/smarthome/binding/lifx/internal/protocol/StateZoneResponse.java
This file contains 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