Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Blueforcer committed Nov 19, 2023
2 parents 812b5f4 + 37f1a97 commit a0bbf3c
Show file tree
Hide file tree
Showing 26 changed files with 341 additions and 48 deletions.
6 changes: 6 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM mcr.microsoft.com/devcontainers/cpp:1-debian-11

ARG REINSTALL_CMAKE_VERSION_FROM_SOURCE="none"

RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
&& apt-get -y install --no-install-recommends python3-venv
23 changes: 23 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/cpp
{
"name": "awtrix-light",
"build": {
"dockerfile": "Dockerfile"
}

// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],

// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "sudo apt -y update && sudo apt-get -y install python3-venv"

// Configure tool-specific properties.
// "customizations": {},

// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
}
2 changes: 1 addition & 1 deletion AWL_Backup/build/conf/logging.properties
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ handlers= java.util.logging.ConsoleHandler
# Default global logging level.
# This specifies which kinds of events are logged across
# all loggers. For any given facility this global level
# can be overriden by a facility specific level
# can be overridden by a facility specific level
# Note that the ConsoleHandler also has a separate level
# setting to limit messages printed to the console.
.level= INFO
Expand Down
2 changes: 1 addition & 1 deletion AWL_Backup/build/conf/security/java.policy
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ grant {
// allows anyone to listen on dynamic ports
permission java.net.SocketPermission "localhost:0", "listen";

// "standard" properies that can be read by anyone
// "standard" properties that can be read by anyone
permission java.util.PropertyPermission "java.version", "read";
permission java.util.PropertyPermission "java.vendor", "read";
permission java.util.PropertyPermission "java.vendor.url", "read";
Expand Down
38 changes: 38 additions & 0 deletions Helper_Scripts/img2rgb888.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Converts an image to a RGB888 array

import argparse
from PIL import Image

def rgb_to_rgb888(r, g, b):
return (r << 16) | (g << 8) | (b)

def convert_bmp_to_rgb888_array(file_path):
# Open image
image = Image.open(file_path)

# Retrieve pixel data
pixels = list(image.convert("RGB").getdata())

# Initialize RGB888 array
rgb888_array = []

# Iterate through each pixel and convert to RGB888
for r, g, b in pixels:
rgb888_value = rgb_to_rgb888(r, g, b)
rgb888_array.append(str(rgb888_value))

# Join the array elements into a string with square brackets
return "[" + ", ".join(rgb888_array) + "]"

# Create argument parser
parser = argparse.ArgumentParser(description="Convert an image to an RGB888 array string.")
parser.add_argument("file_path", help="Path to the image to be converted.")

# Parse arguments
args = parser.parse_args()

# Convert the BMP file to an RGB888 array string
rgb888_array_string = convert_bmp_to_rgb888_array(args.file_path)

# Print the converted string
print(rgb888_array_string)
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Take your Awtrix experience to the next level with the mobile app, tailored for

#### **Features:**
- **Liveview:** See your Awtrix in real-time.
- **Settings Customization:** Tweak text colors, set transistion and many more with just your fingertip.
- **Settings Customization:** Tweak text colors, set transition and many more with just your fingertip.
- **Icon Management:** View, or delete icons effortlessly.
- **Exclusive Icon Database:** Get unique icons only available for app users.
- **Icon Creation & Sharing:** Design and share your icons with our community.
Expand Down
34 changes: 31 additions & 3 deletions docs/api.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,33 @@
# MQTT / HTTP API

## Table of Contents
* [Overview](#overview)
* [Status Retrieval](#status-retrieval)
* [LiveView](#liveview)
* [Power Control](#power-control)
* [Sound Playback](#sound-playback)
* [Mood Lighting](#mood-lighting)
* [Colored Indicators](#colored-indicators)
* [Custom Apps and Notifications](#custom-apps-and-notifications)
+ [Interaction](#interaction)
+ [JSON Properties](#json-properties)
- [Example](#example)
+ [Drawing Instructions](#drawing-instructions)
+ [Example](#example-1)
+ [Display Text in Colored Fragments](#display-text-in-colored-fragments)
+ [Sending Multiple Custom Pages Simultaneously](#sending-multiple-custom-pages-simultaneously)
+ [Delete a Custom App](#delete-a-custom-app)
+ [Dismiss Notification](#dismiss-notification)
+ [Switch Apps](#switch-apps)
+ [Switch to Specific App](#switch-to-specific-app)
* [Change Settings](#change-settings)
+ [JSON Properties](#json-properties-1)
* [Update](#update)
- [Reboot Awtrix](#reboot-awtrix)
- [Erase Awtrix](#erase-awtrix)
- [Clear Settings](#clear-settings)


## Overview

This API documentation covers various functionalities such as retrieving device statistics, screen mirroring, notifications, customapps, sound playing, and mood lighting. You can interact with these features via both MQTT and HTTP protocols.
Expand Down Expand Up @@ -141,7 +169,7 @@ Below are the properties you can utilize in the JSON object. **All keys are opti

| Key | Type | Description | Default | Custom App | Notification |
| --- | ---- | ----------- | ------- | ------- | ------- |
| `text` | string | The text to display. | N/A | X | X |
| `text` | string | The text to display. Keep in mind the font does not have a fixed size and `I` uses less space than `W`. This facts affects when text will start scrolling | N/A | X | X |
| `textCase` | integer | Changes the Uppercase setting. 0=global setting, 1=forces uppercase; 2=shows as it sent. | 0 | X | X |
| `topText` | boolean | Draw the text on top. | false | X | X |
| `textOffset` | integer | Sets an offset for the x position of a starting text. | 0 | X | X |
Expand Down Expand Up @@ -175,7 +203,7 @@ Below are the properties you can utilize in the JSON object. **All keys are opti
| `noScroll` | boolean | Disables the text scrolling. | false | X | X |
| `clients` | array of strings | Allows forwarding a notification to other awtrix devices. Use the MQTT prefix for MQTT and IP addresses for HTTP. | | | X |
| `scrollSpeed` | integer | Modifies the scroll speed. Enter a percentage value of the original scroll speed. | 100 | X | X |
| `effect` | string | Shows an [effect](https://blueforcer.github.io/awtrix-light/#/effects) as background. | | X | X |
| `effect` | string | Shows an [effect](https://blueforcer.github.io/awtrix-light/#/effects) as background.The effect can be removed by sending an empty string for effect| | X | X |
| `effectSettings` | json map | Changes color and speed of the [effect](https://blueforcer.github.io/awtrix-light/#/effects). | | X | X |
| `save` | boolean | Saves your custom app into flash and reloads it after boot. Avoid this for custom apps with high update frequencies because the ESP's flash memory has limited write cycles. | | X | |

Expand Down Expand Up @@ -359,7 +387,7 @@ You can adjust each property in the JSON object according to your preferences. I
**Color Values**: Can either be an RGB array (e.g., `[255,0,0]`) or a valid 6-digit hexadecimal color value (e.g., "#FF0000" for red).


**Transision effects:**
**Transition effects:**
```bash
0 - Random
1 - Slide
Expand Down
180 changes: 177 additions & 3 deletions docs/apps.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ There are numerous benefits to this approach:
- **Efficient resource management:** Save valuable flash memory space on the ESP module.
- **Adaptability:** No need to rewrite the firmware if an API undergoes changes.

You can use any system you like wich is able to build json strings and send them to a mqtt topic.
You can use any system you like which is able to build json strings and send them to a mqtt topic.

## AWTRIX FLOWS
This is your go-to hub for sharing and discovering AWTRIX Light automations, also known as custom Apps for several services.
Expand All @@ -25,10 +25,184 @@ https://flows.blueforcer.de/
[Node-RED](https://nodered.org/) serves as an ideal software solution for creating these applications.
It is available as a standalone program or as a plugin for Home Assistant and ioBroker, allowing you to further enhance the capabilities of your AWTRIX Light system.

Here is a demo of an Youtube App as NodeRED Flow:
Here is a demo, please press the triangle to unfold.

<details>
<summary>Example for adding a Youtube App as NodeRED flow</summary>

```json
[{"id":"2a59d30d07abe14f","type":"group","z":"54b42d8d.cda474","style":{"stroke":"#999999","stroke-opacity":"1","fill":"none","fill-opacity":"1","label":true,"label-position":"nw","color":"#a4a4a4"},"nodes":["f0f17299.3736c","dc7878f9.4756c8","f234aae371d72680","555bb8624b88c9c3","69c388146e28049d","a349ade5a57f7537"],"x":34,"y":39,"w":892,"h":122},{"id":"f0f17299.3736c","type":"inject","z":"54b42d8d.cda474","g":"2a59d30d07abe14f","name":"","props":[],"repeat":"3600","crontab":"","once":true,"onceDelay":0.1,"topic":"","x":130,"y":120,"wires":[["a349ade5a57f7537"]]},{"id":"dc7878f9.4756c8","type":"http request","z":"54b42d8d.cda474","g":"2a59d30d07abe14f","name":"","method":"GET","ret":"obj","paytoqs":"query","url":"https://youtube.googleapis.com/youtube/v3/channels","tls":"","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[],"x":430,"y":120,"wires":[["f234aae371d72680"]]},{"id":"f234aae371d72680","type":"function","z":"54b42d8d.cda474","g":"2a59d30d07abe14f","name":"parser","func":"var json = msg.payload;\nvar subscriberCount = json.items[0].statistics.subscriberCount;\n\nmsg.payload = { \"text\": subscriberCount, \"icon\": 5029};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":590,"y":120,"wires":[["555bb8624b88c9c3"]]},{"id":"555bb8624b88c9c3","type":"mqtt out","z":"54b42d8d.cda474","g":"2a59d30d07abe14f","name":"","topic":"ulanzi/custom/youtube","qos":"","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"346df2a95aac5785","x":800,"y":120,"wires":[]},{"id":"69c388146e28049d","type":"comment","z":"54b42d8d.cda474","g":"2a59d30d07abe14f","name":"Youtube Follower","info":"Just enter your channelID and Youtube API key in the \"Data\" node and set your AWTRIX MQTT prefix.\nUses Icon 5029 (LM)","x":140,"y":80,"wires":[]},{"id":"a349ade5a57f7537","type":"function","z":"54b42d8d.cda474","g":"2a59d30d07abe14f","name":"Data","func":"msg.payload = { \"id\": \"UCpGLALzRO0uaasWTsm9M99w\", \"key\": \"XXX\", \"part\":\"statistics\"}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":270,"y":120,"wires":[["dc7878f9.4756c8"]]},{"id":"346df2a95aac5785","type":"mqtt-broker","name":"","broker":"localhost","port":"1883","clientid":"","autoConnect":true,"usetls":false,"protocolVersion":"4","keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","birthMsg":{},"closeTopic":"","closeQos":"0","closePayload":"","closeMsg":{},"willTopic":"","willQos":"0","willPayload":"","willMsg":{},"userProps":"","sessionExpiry":""}]
[
{
"id": "2a59d30d07abe14f",
"type": "group",
"z": "54b42d8d.cda474",
"style": {
"stroke": "#999999",
"stroke-opacity": "1",
"fill": "none",
"fill-opacity": "1",
"label": true,
"label-position": "nw",
"color": "#a4a4a4"
},
"nodes": [
"f0f17299.3736c",
"dc7878f9.4756c8",
"f234aae371d72680",
"555bb8624b88c9c3",
"69c388146e28049d",
"a349ade5a57f7537"
],
"x": 34,
"y": 39,
"w": 892,
"h": 122
},
{
"id": "f0f17299.3736c",
"type": "inject",
"z": "54b42d8d.cda474",
"g": "2a59d30d07abe14f",
"name": "",
"props": [],
"repeat": "3600",
"crontab": "",
"once": true,
"onceDelay": 0.1,
"topic": "",
"x": 130,
"y": 120,
"wires": [
[
"a349ade5a57f7537"
]
]
},
{
"id": "dc7878f9.4756c8",
"type": "http request",
"z": "54b42d8d.cda474",
"g": "2a59d30d07abe14f",
"name": "",
"method": "GET",
"ret": "obj",
"paytoqs": "query",
"url": "https://youtube.googleapis.com/youtube/v3/channels",
"tls": "",
"persist": false,
"proxy": "",
"insecureHTTPParser": false,
"authType": "",
"senderr": false,
"headers": [],
"x": 430,
"y": 120,
"wires": [
[
"f234aae371d72680"
]
]
},
{
"id": "f234aae371d72680",
"type": "function",
"z": "54b42d8d.cda474",
"g": "2a59d30d07abe14f",
"name": "parser",
"func": "var json = msg.payload;\nvar subscriberCount = json.items[0].statistics.subscriberCount;\n\nmsg.payload = { \"text\": subscriberCount, \"icon\": 5029};\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 590,
"y": 120,
"wires": [
[
"555bb8624b88c9c3"
]
]
},
{
"id": "555bb8624b88c9c3",
"type": "mqtt out",
"z": "54b42d8d.cda474",
"g": "2a59d30d07abe14f",
"name": "",
"topic": "ulanzi/custom/youtube",
"qos": "",
"retain": "",
"respTopic": "",
"contentType": "",
"userProps": "",
"correl": "",
"expiry": "",
"broker": "346df2a95aac5785",
"x": 800,
"y": 120,
"wires": []
},
{
"id": "69c388146e28049d",
"type": "comment",
"z": "54b42d8d.cda474",
"g": "2a59d30d07abe14f",
"name": "Youtube Follower",
"info": "Just enter your channelID and Youtube API key in the \"Data\" node and set your AWTRIX MQTT prefix.\nUses Icon 5029 (LM)",
"x": 140,
"y": 80,
"wires": []
},
{
"id": "a349ade5a57f7537",
"type": "function",
"z": "54b42d8d.cda474",
"g": "2a59d30d07abe14f",
"name": "Data",
"func": "msg.payload = { \"id\": \"UCpGLALzRO0uaasWTsm9M99w\", \"key\": \"XXX\", \"part\":\"statistics\"}\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 270,
"y": 120,
"wires": [
[
"dc7878f9.4756c8"
]
]
},
{
"id": "346df2a95aac5785",
"type": "mqtt-broker",
"name": "",
"broker": "localhost",
"port": "1883",
"clientid": "",
"autoConnect": true,
"usetls": false,
"protocolVersion": "4",
"keepalive": "60",
"cleansession": true,
"birthTopic": "",
"birthQos": "0",
"birthPayload": "",
"birthMsg": {},
"closeTopic": "",
"closeQos": "0",
"closePayload": "",
"closeMsg": {},
"willTopic": "",
"willQos": "0",
"willPayload": "",
"willMsg": {},
"userProps": "",
"sessionExpiry": ""
}
]
```
</details>

This Node-RED flow retrieves and displays the subscriber count of a specified YouTube channel on an AWTRIX light device. The flow consists of the following nodes:

Expand Down
8 changes: 4 additions & 4 deletions docs/dev.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ The JSON object has the following properties:
| `mirror_screen` | boolean | Mirrors the screen | `false` |
| `temp_dec_places` | integer | Number of decimal places for temperature measurements | `0` |
| `sensor_reading` | boolean | Enables or disables the reading of the Temp&Hum sensor | `true` |
| `temp_offset` | float | Sets the offset for the internal temperature messurement | `-9` |
| `hum_offset` | float | Sets the offset for the internal humidity messurement | `0` |
| `temp_offset` | float | Sets the offset for the internal temperature measurement | `-9` |
| `hum_offset` | float | Sets the offset for the internal humidity measurement | `0` |
| `min_brightness` | integer | Sets minimum brightness level for the Autobrightness control | `2` |
| `max_brightness` | integer | Sets maximum brightness level for the Autobrightness control. On high levels, this could result in overheating! | `180` |
| `min_battery` | integer | Calibrates the minimum battery messurement by the given raw value. You will get that from the stats api | `475` |
| `max_battery` | integer | Calibrates the maximum battery messurement by the given raw value. You will get that from the stats api | `665` |
| `min_battery` | integer | Calibrates the minimum battery measurement by the given raw value. You will get that from the stats api | `475` |
| `max_battery` | integer | Calibrates the maximum battery measurement by the given raw value. You will get that from the stats api | `665` |
| `ha_prefix` | string | Sets the prefix for Homassistant discovery | `homeassistant` |
| `background_effect` | string | Sets an [effect](https://blueforcer.github.io/awtrix-light/#/effects) as global background layer | - |
| `stats_interval` | integer | Sets the interval in milliseconds when awtrix should send its stats to HA and MQTT | 10000 |
Expand Down
6 changes: 3 additions & 3 deletions docs/effects.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Effects

AWTRIX light can show effects wherever you want
- Notification and CustomApps. This will show the effect as the first layer, so you can stil draw text over it.
- Notification and CustomApps. This will show the effect as the first layer, so you can still draw text over it.
- Backgroundlayer. This will show the effect behind everything and in each app. You can add it via Hidden features.

Just call the name for your favorite effect.
AWTRIX sends all effect names once after start via MQTT to stats/effects. So you can create external selectors.
Its also accessable via HTTTP /api/effects
Its also accessible via HTTTP /api/effects

<table>
<tr>
Expand Down Expand Up @@ -159,7 +159,7 @@ Remember, the colors you define in your palette serve as key points in the color
# Artnet (DMX)

Awtrix light supports Artnet out of the box.
For [Jinx!](http://www.live-leds.de/) you can <a href="awtrix_light.jnx" download>download this template</a>. Just change the IP of both universes to your awtrix IP and youre ready to go.
For [Jinx!](http://www.live-leds.de/) you can <a href="awtrix_light.jnx" download>download this template</a>. Just change the IP of both universes to your awtrix IP and you're ready to go.

**For any Other Artnet controller:**
Create 2 universes with 384 channels each. Also add a new matrix layout with 8 strings á 32 Strands and top left starting position. When you start to send data, AWTRIX will stop its normal operation and shows your data. 1s after you stop sending data, AWTRIX will return to normal operation.
Expand Down
Loading

0 comments on commit a0bbf3c

Please sign in to comment.