forked from openhab/openhab-addons
-
Notifications
You must be signed in to change notification settings - Fork 0
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: DrRSatzteil <thomas_lauterbach@arcor.de> Lots of fixes and improvements Repeat property is evil! Updated thing descriptions and cleanup Fixed command handling for bridge Fixed blinkIndicator action Cleanup Removed ColorTemp tag from effectPalette Send None as effectPalette value to reset Prevent DiscoveryService from receiving retained app messages Missing slash added Various fixes and improvements Initialise all items (no more UNDEF types) Increased init wait time Smoother app initialisation Fixed display command Channel impr. / dont accept commands during sync Brightness settings working now pushIcon fixed, faster init Removed unused buttonControl channel Set app active when found in rotation Initial notification impl Added custom notifications Fixed trigger channels Map stats.matrix field added in AL 0.89 Added DSL Rule Action support Spotless and pom version fixes Updated copyright notice Added deep sleep action lifetime and overlay channels added added app-updates Signed-off-by: DrRSatzteil <thomas_lauterbach@arcor.de> added app-updates Signed-off-by: DrRSatzteil <thomas_lauterbach@arcor.de> override app removal Signed-off-by: Thomas Lauterbach <2452988+DrRSatzteil@users.noreply.github.com> updated copyright notice Signed-off-by: Thomas Lauterbach <2452988+DrRSatzteil@users.noreply.github.com>
- Loading branch information
1 parent
705feff
commit 5383907
Showing
21 changed files
with
3,849 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
This content is produced and maintained by the openHAB project. | ||
|
||
* Project home: https://www.openhab.org | ||
|
||
== Declared Project Licenses | ||
|
||
This program and the accompanying materials are made available under the terms | ||
of the Eclipse Public License 2.0 which is available at | ||
https://www.eclipse.org/legal/epl-2.0/. | ||
|
||
== Source Code | ||
|
||
https://github.com/openhab/openhab-addons |
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,28 @@ | ||
<?xml version="1.0" encoding="UTF-8" standalone="no"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
|
||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<parent> | ||
<groupId>org.openhab.addons.bundles</groupId> | ||
<artifactId>org.openhab.addons.reactor.bundles</artifactId> | ||
<version>5.0.0-SNAPSHOT</version> | ||
</parent> | ||
|
||
<artifactId>org.openhab.binding.mqtt.awtrixlight</artifactId> | ||
<name>openHAB Add-ons :: Bundles :: MQTT Awtrix Light</name> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.openhab.addons.bundles</groupId> | ||
<artifactId>org.openhab.binding.mqtt</artifactId> | ||
<version>${project.version}</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
<properties> | ||
<bnd.importpackage>javax.measure.*;version="[2.1,3)"</bnd.importpackage> | ||
</properties> | ||
</project> |
12 changes: 12 additions & 0 deletions
12
bundles/org.openhab.binding.mqtt.awtrixlight/src/main/feature/feature.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,12 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<features name="org.openhab.binding.mqtt.awtrixlight-${project.version}" xmlns="http://karaf.apache.org/xmlns/features/v1.4.0"> | ||
<repository>mvn:org.openhab.core.features.karaf/org.openhab.core.features.karaf.openhab-core/${ohc.version}/xml/features</repository> | ||
|
||
<feature name="openhab-binding-mqtt-awtrixlight" description="MQTT Binding Awtrix Light" version="${project.version}"> | ||
<feature>openhab-runtime-base</feature> | ||
<feature>openhab-transport-mqtt</feature> | ||
<bundle start-level="80">mvn:org.openhab.addons.bundles/org.openhab.binding.mqtt/${project.version}</bundle> | ||
<bundle start-level="81">mvn:org.openhab.addons.bundles/org.openhab.binding.mqtt.awtrixlight/${project.version}</bundle> | ||
</feature> | ||
|
||
</features> |
26 changes: 26 additions & 0 deletions
26
...ixlight/src/main/java/org/openhab/binding/mqtt/awtrixlight/internal/AppConfigOptions.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,26 @@ | ||
/** | ||
* 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.mqtt.awtrixlight.internal; | ||
|
||
import org.eclipse.jdt.annotation.NonNullByDefault; | ||
|
||
/** | ||
* The {@link AppConfigOptions} Holds the config for the app settings. | ||
* | ||
* @author Thomas Lauterbach - Initial contribution | ||
*/ | ||
@NonNullByDefault | ||
public class AppConfigOptions { | ||
public String appname = ""; | ||
public boolean useButtons = false; | ||
} |
183 changes: 183 additions & 0 deletions
183
.../main/java/org/openhab/binding/mqtt/awtrixlight/internal/AwtrixLightBindingConstants.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,183 @@ | ||
/** | ||
* 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.mqtt.awtrixlight.internal; | ||
|
||
import static org.openhab.binding.mqtt.MqttBindingConstants.BINDING_ID; | ||
|
||
import java.math.BigDecimal; | ||
import java.util.Set; | ||
|
||
import org.eclipse.jdt.annotation.NonNullByDefault; | ||
import org.openhab.core.thing.ThingTypeUID; | ||
|
||
/** | ||
* The {@link AwtrixLightBindingConstants} class defines common constants, which are | ||
* used across the whole binding. | ||
* | ||
* @author Thomas Lauterbach - Initial contribution | ||
*/ | ||
@NonNullByDefault | ||
public class AwtrixLightBindingConstants { | ||
|
||
// List of all Thing Type UIDs | ||
public static final ThingTypeUID THING_TYPE_APP = new ThingTypeUID(BINDING_ID, "awtrixapp"); | ||
public static final ThingTypeUID THING_TYPE_BRIDGE = new ThingTypeUID(BINDING_ID, "awtrixclock"); | ||
public static final Set<ThingTypeUID> SUPPORTED_THING_TYPES = Set.of(THING_TYPE_APP, THING_TYPE_BRIDGE); | ||
|
||
// Thing Type IDs | ||
public static final String AWTRIX_APP = "awtrixapp"; | ||
public static final String AWTRIX_CLOCK = "awtrixclock"; | ||
|
||
// Matrix Size | ||
public static final int SCREEN_HEIGHT = 8; | ||
public static final int SCREEN_WIDTH = 32; | ||
|
||
// Clock Properties | ||
public static final String PROP_APPID = "appid"; | ||
public static final String PROP_APPLOCKTIMEOUT = "appLockTimeout"; | ||
public static final String PROP_APPNAME = "appname"; | ||
public static final String PROP_APP_CONTROLLABLE = "useButtons"; | ||
public static final String PROP_BASETOPIC = "basetopic"; | ||
public static final String PROP_DISCOVERDEFAULT = "discoverDefaultApps"; | ||
public static final String PROP_FIRMWARE = "firmware"; | ||
public static final String PROP_UNIQUEID = "uniqueId"; | ||
public static final String PROP_VENDOR = "vendor"; | ||
|
||
// Clock Topics | ||
public static final String TOPIC_BASE = "awtrix"; | ||
public static final String TOPIC_BUTLEFT = "/stats/buttonLeft"; | ||
public static final String TOPIC_BUTRIGHT = "/stats/buttonRight"; | ||
public static final String TOPIC_BUTSELECT = "/stats/buttonSelect"; | ||
public static final String TOPIC_INDICATOR1 = "/indicator1"; | ||
public static final String TOPIC_INDICATOR2 = "/indicator2"; | ||
public static final String TOPIC_INDICATOR3 = "/indicator3"; | ||
public static final String TOPIC_NOTIFY = "/notify"; | ||
public static final String TOPIC_POWER = "/power"; | ||
public static final String TOPIC_REBOOT = "/reboot"; | ||
public static final String TOPIC_SCREEN = "/screen"; | ||
public static final String TOPIC_SEND_SCREEN = "/sendscreen"; | ||
public static final String TOPIC_SETTINGS = "/settings"; | ||
public static final String TOPIC_SLEEP = "/sleep"; | ||
public static final String TOPIC_SOUND = "/sound"; | ||
public static final String TOPIC_STATS = "/stats"; | ||
public static final String TOPIC_STATS_CURRENT_APP = "/stats/currentApp"; | ||
public static final String TOPIC_SWITCH = "/switch"; | ||
public static final String TOPIC_UPGRADE = "/doupdate"; | ||
|
||
// Stats fields | ||
public static final String FIELD_BRIDGE_APP = "app"; | ||
public static final String FIELD_BRIDGE_BATTERY = "bat"; | ||
public static final String FIELD_BRIDGE_BATTERY_RAW = "bat_raw"; | ||
public static final String FIELD_BRIDGE_BRIGHTNESS = "bri"; | ||
public static final String FIELD_BRIDGE_FIRMWARE = "version"; | ||
public static final String FIELD_BRIDGE_HUMIDITY = "hum"; | ||
public static final String FIELD_BRIDGE_INDICATOR1 = "indicator1"; | ||
public static final String FIELD_BRIDGE_INDICATOR2 = "indicator2"; | ||
public static final String FIELD_BRIDGE_INDICATOR3 = "indicator3"; | ||
public static final String FIELD_BRIDGE_INDICATOR1_COLOR = "indicator1-color"; | ||
public static final String FIELD_BRIDGE_INDICATOR2_COLOR = "indicator2-color"; | ||
public static final String FIELD_BRIDGE_INDICATOR3_COLOR = "indicator3-color"; | ||
public static final String FIELD_BRIDGE_LDR_RAW = "ldr_raw"; | ||
public static final String FIELD_BRIDGE_LUX = "lux"; | ||
public static final String FIELD_BRIDGE_MATRIX = "matrix"; | ||
public static final String FIELD_BRIDGE_MESSAGES = "messages"; | ||
public static final String FIELD_BRIDGE_RAM = "ram"; | ||
public static final String FIELD_BRIDGE_TEMPERATURE = "temp"; | ||
public static final String FIELD_BRIDGE_TYPE = "type"; | ||
public static final String FIELD_BRIDGE_UID = "uid"; | ||
public static final String FIELD_BRIDGE_UPTIME = "uptime"; | ||
public static final String FIELD_BRIDGE_WIFI_SIGNAL = "wifi_signal"; | ||
|
||
// Settings fields | ||
public static final String FIELD_BRIDGE_SET_APP_TIME = "ATIME"; | ||
public static final String FIELD_BRIDGE_SET_AUTO_BRIGHTNESS = "ABRI"; | ||
public static final String FIELD_BRIDGE_SET_AUTO_TRANSITION = "ATRANS"; | ||
public static final String FIELD_BRIDGE_SET_BLOCK_KEYS = "BLOCKN"; | ||
public static final String FIELD_BRIDGE_SET_BRIGHTNESS = "BRI"; | ||
public static final String FIELD_BRIDGE_SET_DISPLAY = "MATP"; | ||
|
||
// TODO: Validate that it really mutes | ||
public static final String FIELD_BRIDGE_SET_MUTE = "SOUND"; | ||
public static final String FIELD_BRIDGE_SET_SCROLL_SPEED = "SSPEED"; | ||
public static final String FIELD_BRIDGE_SET_TEXT_COLOR = "TCOL"; | ||
public static final String FIELD_BRIDGE_SET_TRANS_EFFECT = "TEFF"; | ||
public static final String FIELD_BRIDGE_SET_TRANS_SPEED = "TSPEED"; | ||
|
||
// Apps | ||
public static final String BASE_APP_TOPIC = "/custom"; | ||
public static final String[] DEFAULT_APPS = { "Time", "Date", "Temperature", "Humidity", "Battery" }; | ||
|
||
// Common Channels | ||
public static final String CHANNEL_BUTLEFT = "buttonleft"; | ||
public static final String CHANNEL_BUTRIGHT = "buttonright"; | ||
public static final String CHANNEL_BUTSELECT = "buttonselect"; | ||
|
||
// Clock Channels | ||
public static final String CHANNEL_APP = "app"; | ||
public static final String CHANNEL_AUTO_BRIGHTNESS = "autoBrightness"; | ||
public static final String CHANNEL_BATTERY = "batterylevel"; | ||
public static final String CHANNEL_BRIGHTNESS = "brightness"; | ||
public static final String CHANNEL_DISPLAY = "display"; | ||
public static final String CHANNEL_HUMIDITY = "humidity"; | ||
public static final String CHANNEL_INDICATOR1 = "indicator1"; | ||
public static final String CHANNEL_INDICATOR2 = "indicator2"; | ||
public static final String CHANNEL_INDICATOR3 = "indicator3"; | ||
public static final String CHANNEL_LOW_BATTERY = "low-battery"; | ||
public static final String CHANNEL_LUX = "lux"; | ||
public static final String CHANNEL_RSSI = "rssi"; | ||
public static final String CHANNEL_SCREEN = "screen"; | ||
public static final String CHANNEL_TEMPERATURE = "temperature"; | ||
|
||
// App Channels | ||
public static final String CHANNEL_ACTIVE = "active"; | ||
public static final String CHANNEL_AUTOSCALE = "autoscale"; | ||
public static final String CHANNEL_BACKGROUND = "background"; | ||
public static final String CHANNEL_BAR = "bar"; | ||
public static final String CHANNEL_BLINK_TEXT = "blinkText"; | ||
public static final String CHANNEL_CENTER = "center"; | ||
public static final String CHANNEL_COLOR = "color"; | ||
public static final String CHANNEL_DURATION = "duration"; | ||
public static final String CHANNEL_EFFECT = "effect"; | ||
public static final String CHANNEL_EFFECT_BLEND = "effectBlend"; | ||
public static final String CHANNEL_EFFECT_PALETTE = "effectPalette"; | ||
public static final String CHANNEL_EFFECT_SPEED = "effectSpeed"; | ||
public static final String CHANNEL_FADE_TEXT = "fadeText"; | ||
public static final String CHANNEL_GRADIENT_COLOR = "gradientColor"; | ||
public static final String CHANNEL_ICON = "icon"; | ||
public static final String CHANNEL_LIFETIME = "lifetime"; | ||
public static final String CHANNEL_LIFETIME_MODE = "lifetimeMode"; | ||
public static final String CHANNEL_LINE = "line"; | ||
public static final String CHANNEL_OVERLAY = "overlay"; | ||
public static final String CHANNEL_PROGRESS = "progress"; | ||
public static final String CHANNEL_PROGRESSC = "progressColor"; | ||
public static final String CHANNEL_PROGRESSBC = "progressBackground"; | ||
public static final String CHANNEL_PUSH_ICON = "pushIcon"; | ||
public static final String CHANNEL_RAINBOW = "rainbow"; | ||
public static final String CHANNEL_REPEAT = "repeat"; | ||
public static final String CHANNEL_RESET = "reset"; | ||
public static final String CHANNEL_SCROLLSPEED = "scrollSpeed"; | ||
public static final String CHANNEL_TEXT = "text"; | ||
public static final String CHANNEL_TEXTCASE = "textCase"; | ||
public static final String CHANNEL_TEXT_OFFSET = "textOffset"; | ||
public static final String CHANNEL_TOP_TEXT = "topText"; | ||
|
||
public static final String PUSH_ICON_OPTION_0 = "STATIC"; | ||
public static final String PUSH_ICON_OPTION_1 = "PUSHOUT"; | ||
public static final String PUSH_ICON_OPTION_2 = "PUSHOUTRETURN"; | ||
|
||
// Just some little helpers... | ||
public static final BigDecimal MINUSONE = new BigDecimal(-1); | ||
public static final BigDecimal ONEHUNDRED = new BigDecimal(100); | ||
public static final BigDecimal THOUSAND = new BigDecimal(1000); | ||
} |
65 changes: 65 additions & 0 deletions
65
...rc/main/java/org/openhab/binding/mqtt/awtrixlight/internal/AwtrixLightHandlerFactory.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,65 @@ | ||
/** | ||
* 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.mqtt.awtrixlight.internal; | ||
|
||
import static org.openhab.binding.mqtt.awtrixlight.internal.AwtrixLightBindingConstants.SUPPORTED_THING_TYPES; | ||
|
||
import org.eclipse.jdt.annotation.NonNullByDefault; | ||
import org.eclipse.jdt.annotation.Nullable; | ||
import org.openhab.binding.mqtt.awtrixlight.internal.handler.AwtrixLightAppHandler; | ||
import org.openhab.binding.mqtt.awtrixlight.internal.handler.AwtrixLightBridgeHandler; | ||
import org.openhab.core.thing.Bridge; | ||
import org.openhab.core.thing.Thing; | ||
import org.openhab.core.thing.ThingRegistry; | ||
import org.openhab.core.thing.ThingTypeUID; | ||
import org.openhab.core.thing.binding.BaseThingHandlerFactory; | ||
import org.openhab.core.thing.binding.ThingHandler; | ||
import org.openhab.core.thing.binding.ThingHandlerFactory; | ||
import org.osgi.service.component.annotations.Activate; | ||
import org.osgi.service.component.annotations.Component; | ||
import org.osgi.service.component.annotations.Reference; | ||
|
||
/** | ||
* The {@link AwtrixLightHandlerFactory} is responsible for creating things and thing | ||
* handlers. | ||
* | ||
* @author Thomas Lauterbach - Initial contribution | ||
*/ | ||
@Component(service = ThingHandlerFactory.class) | ||
@NonNullByDefault | ||
public class AwtrixLightHandlerFactory extends BaseThingHandlerFactory { | ||
|
||
@Activate | ||
public AwtrixLightHandlerFactory(final @Reference ThingRegistry thingRegistry) { | ||
} | ||
|
||
@Override | ||
public boolean supportsThingType(ThingTypeUID thingTypeUID) { | ||
return SUPPORTED_THING_TYPES.contains(thingTypeUID); | ||
} | ||
|
||
@Override | ||
protected @Nullable ThingHandler createHandler(Thing thing) { | ||
ThingTypeUID thingTypeUID = thing.getThingTypeUID(); | ||
if (AwtrixLightBridgeHandler.SUPPORTED_THING_TYPES.contains(thingTypeUID)) { | ||
AwtrixLightBridgeHandler bridgeHandler = new AwtrixLightBridgeHandler((Bridge) thing); | ||
return bridgeHandler; | ||
} else if (AwtrixLightAppHandler.SUPPORTED_THING_TYPES.contains(thingTypeUID)) { | ||
AwtrixLightAppHandler appHandler = new AwtrixLightAppHandler((Thing) thing); | ||
return appHandler; | ||
} | ||
|
||
return null; | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
...ight/src/main/java/org/openhab/binding/mqtt/awtrixlight/internal/BridgeConfigOptions.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,30 @@ | ||
/** | ||
* 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.mqtt.awtrixlight.internal; | ||
|
||
import java.math.BigDecimal; | ||
|
||
import org.eclipse.jdt.annotation.NonNullByDefault; | ||
|
||
/** | ||
* The {@link BridgeConfigOptions} Holds the config for the bridge settings. | ||
* | ||
* @author Thomas Lauterbach - Initial contribution | ||
*/ | ||
@NonNullByDefault | ||
public class BridgeConfigOptions { | ||
public String basetopic = "awtrix"; | ||
public int appLockTimeout = 10; | ||
public boolean discoverDefaultApps = false; | ||
public BigDecimal lowBatteryThreshold = new BigDecimal(25); | ||
} |
Oops, something went wrong.