Skip to content
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

[mqtt.awtrix3] Initial contribution #18242

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

DrRSatzteil
Copy link
Contributor

@DrRSatzteil DrRSatzteil commented Feb 8, 2025

[mqtt.awtrix3] Initial Contribution

Description

This pull request contributes a new binding to control Awtrix 3 devices via MQTT. Awtrix 3 is a custom firmware that can be flashed on to a Ulanzi tc001 clock but compatible devices can also be custom made. This binding is based on the existing MQTT binding. The Ulanzi clock is a very popular alternative to the LaMetric Time clock but much less expensive. The binding was available on the marketplace for quite some time now and is potentially used by quite a few OH users. The binding itself has proven to be stable and just got some minor functional adjustments in the last few releases. The final changes made before this PR were:

  • Create a README
  • Refactor Helper and AwtrixApp classes to use a more standardized approach to serialize/deserialize JSON messages.
  • Refactor the code to comply to codestyle guidelines

Current marketplace release and discussions: https://community.openhab.org/t/awtrix-3-binding-formerly-awtrix-light/149739

Testing

Link will be provided once this has been built

Signed-off-by: Thomas Lauterbach <[email protected]>
@DrRSatzteil DrRSatzteil requested a review from a team as a code owner February 8, 2025 20:43
@jlaur jlaur added the new binding If someone has started to work on a binding. For a new binding PR. label Feb 8, 2025
@DrRSatzteil DrRSatzteil changed the title [awtrix3] Initial contribution [mqtt.awtrix3] Initial contribution Feb 9, 2025
Signed-off-by: Thomas Lauterbach <[email protected]>
@lsiepel

This comment was marked as outdated.

Copy link
Contributor

@lsiepel lsiepel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution. Have not looked at the two handlers yet. Besides these comments, there are some more files that need to be changed:
Please add yourself to the CODEWONER file.
Also add the binding to:
openhab-addons/bundles/pom.xml
openhab-addons\features\openhab-addons\src\main\resources\footer.xml

Comment on lines 11 to 12
| `awtrixclock` (Bridge) | Represents an Awtrix 3 display device. Acts as a bridge for apps. |
| `awtrixapp` | Represents an app running on the Awtrix display. Apps can show text, icons, notifications, etc. |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please stick to the naming convention for thing id's

Suggested change
| `awtrixclock` (Bridge) | Represents an Awtrix 3 display device. Acts as a bridge for apps. |
| `awtrixapp` | Represents an app running on the Awtrix display. Apps can show text, icons, notifications, etc. |
| `awtrix-clock` (Bridge) | Represents an Awtrix 3 display device. Acts as a bridge for apps. |
| `awtrix-app` | Represents an app running on the Awtrix display. Apps can show text, icons, notifications, etc. |

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@@ -0,0 +1,380 @@
# MQTT Awtrix 3 Binding

This binding allows you to control Awtrix 3 (formerly Awtrix Light) LED matrix displays via MQTT. The Awtrix 3 is a customizable 32x8 LED matrix display that can show various information like time, weather, notifications and custom text/graphics.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Each sentence on its own line, please do so for the whole readme.

Suggested change
This binding allows you to control Awtrix 3 (formerly Awtrix Light) LED matrix displays via MQTT. The Awtrix 3 is a customizable 32x8 LED matrix display that can show various information like time, weather, notifications and custom text/graphics.
This binding allows you to control Awtrix 3 (formerly Awtrix Light) LED matrix displays via MQTT.
The Awtrix 3 is a customizable 32x8 LED matrix display that can show various information like time, weather, notifications and custom text/graphics.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

| Channel | Type | Description |
|-------------------|----------------------|------------------------------------------------------------------------------------------------------------------------------------------------|
| `app` | String | Currently active app: Will show the name of the app that is currently shown on the display. |
| `autoBrightness` | Switch | Automatic brightness control: The clock will adjust the display brightness automatically based on ambient light. |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The lower-case-hyphen naming convention should be used for the channel id's

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done


### Things

```
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add language to code blocks.

Suggested change
```
```java

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done


### Items

```
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
```
```java

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Comment on lines 318 to 320
<tags>
<tag>Control</tag>
</tags>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

drop the tags

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Comment on lines 328 to 330
<tags>
<tag>Control</tag>
</tags>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

drop the tags

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Comment on lines 338 to 341
<tags>
<tag>Control</tag>
<tag>Duration</tag>
</tags>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

drop the tags, there is no duration being controlled here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@DrRSatzteil
Copy link
Contributor Author

Thank you for your first review results. I'm already going through the checklist and currently making first changes. This list is very helpful, maybe it would make sense to mention it in the binding development documentation.

Thomas Lauterbach added 4 commits February 13, 2025 00:27
Signed-off-by: Thomas Lauterbach <[email protected]>
Signed-off-by: Thomas Lauterbach <[email protected]>
Signed-off-by: Thomas Lauterbach <[email protected]>
@DrRSatzteil
Copy link
Contributor Author

By going through the checklist I realized that I should get rid of the use of BigDecimal in my binding and replace it with int wherever possible (probably in most places). What do you think?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new binding If someone has started to work on a binding. For a new binding PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants