Skip to content

Commit b36efeb

Browse files
Merge pull request #611 from ApolloAutomation/dev
2 parents ba1dc7d + 2f0a9e3 commit b36efeb

File tree

4 files changed

+165
-8
lines changed

4 files changed

+165
-8
lines changed
681 KB
Loading
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
---
2+
title: >-
3+
M-1 LED Matrix Setting up scrolling text with the states of Home Assistant
4+
entities!
5+
description: >-
6+
Step by step guide for custom scrolling text using the states of Home
7+
Assistant entities!
8+
---
9+
# Share Data from Home Assistant on your M-1 LED Matrix
10+
11+
!!! tip "This tutorial expects you to already have 4 segments created!"
12+
13+
Please follow <a href="https://wiki.apolloautomation.com/products/m1/setup/m1-segments/" target="_blank" rel="noreferrer nofollow noopener">this wiki article</a> to setup your M-1 LED Matrix with segments. If you are using multiple panels, <a href="https://wiki.apolloautomation.com/products/m1/setup/m1-multiple-panels/#segment-setup" target="_blank" rel="noreferrer nofollow noopener">follow this article</a> instead then come back!
14+
15+
The <a href="https://www.home-assistant.io/integrations/wled/" target="_blank" rel="noreferrer nofollow noopener">WLED integration for Home Assistant</a> does not support sending data from our devices directly to the M-1 LED Matrix, however, we are still able to do so using the <a href="https://mm.kno.wled.ge/interfaces/json-api/" target="_blank" rel="noreferrer nofollow noopener">WLED JSON API</a>. This is an advanced tutorial but if you follow each step closely you should be able to follow along!
16+
17+
1\. Install "Studio Code Server" <a href="https://github.com/hassio-addons/addon-vscode" target="_blank" rel="noreferrer nofollow noopener">from the addon store</a> in Home Assistant OS. Click Open Webui and navigate to your configuration.yaml file.
18+
19+
![](../../../assets/m1-navigate-to-configuration-yaml.gif)
20+
21+
!!! danger "This file is used by Home Assistant and must be careful edited"
22+
23+
Home Assistant requires this file to work properly so only make changes exactly as shown below. Do NOT add any extra spaces or change anything other than what is shown in the steps below!
24+
25+
## 🧩 WLED Matrix YAML Generator
26+
27+
<iframe src="/static/matrix-jinja-generator.html" width="100%" height="700" style="border: 1px solid #ccc; border-radius: 6px;"></iframe>
28+
29+
&nbsp;
30+
31+
2\. Copy the code below and paste it at the very bottom of your configuration.yaml file.
32+
33+
```yaml
34+
rest_command:
35+
matrix_all_segments:
36+
url: http://10.10.10.176/json/state
37+
content_type: 'application/json'
38+
verify_ssl: false
39+
method: 'post'
40+
timeout: 20
41+
payload: >
42+
{
43+
"seg":[
44+
{
45+
"id":0,
46+
"fx":122,
47+
"n": "{{state_attr('weather.nowcast','temperature')}}F {{states('weather.nowcast')|title}} FL: {{ states('sensor.feels_like') | round(0) | int }}F"
48+
},
49+
{
50+
"id":1,
51+
"fx":122,
52+
"n": "{{ states('lock.front_door_lock') == 'locked' and 'Front Door Locked' or 'Front Door Unlocked' }}"
53+
},
54+
{
55+
"id":2,
56+
"fx":122,
57+
"n": "CO2 {{states('sensor.brandon_air_1_co2') | int}}ppm VOC {{states('sensor.brandon_air_1_sen55_voc') | int}}ppm"
58+
},
59+
{
60+
"id":3,
61+
"fx":122,
62+
"n": "Ping {{ states('sensor.1_1_1_1_round_trip_time_average') | float | round(0) | int }}ms {{ states('alarm_control_panel.alarmo') }}"
63+
}
64+
]
65+
}
66+
```

docs/products/m1/setup/m1-general-tips.md

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,12 @@ description: Multiple helpful tips to use your M-1 LED Matrix to the fullest!
44
---
55
# General Tips
66

7-
###### Known issues
7+
The M-1 LED Matrix is using <a href="https://github.com/MoonModules/WLED-MM" target="_blank" rel="noreferrer nofollow noopener">WLED MoonModules</a> which is a fork of WLED that supports the Hub75 Matrix.
88

9-
As of 6/25/25 these are the known issues with the firmware shipped with the device:
9+
WLED uses <a href="https://wiki.apolloautomation.com/products/m1/setup/m1-segments/" target="_blank" rel="noreferrer nofollow noopener">segments</a> which allow you to create virtual led strips (or panels) of leds to control individually. This is useful in cases where you want to <a href="https://wiki.apolloautomation.com/products/m1/setup/m1-multiple-panels/#software-setup" target="_blank" rel="noreferrer nofollow noopener">connect multiple panels and have text scrolling across the screens</a>.
1010

11-
* <a href="https://github.com/MoonModules/WLED-MM/issues/243" target="_blank" rel="noreferrer nofollow noopener">unable to set default preset at boot</a> (only will boot to orange screen)
12-
* randomly crashes after 1-2 days
13-
* <a href="https://github.com/MoonModules/WLED-MM/issues/242" target="_blank" rel="noreferrer nofollow noopener">changing custom preset to effect does not work</a> unless you turn the leds off then back on (not power cycle).
14-
* <a href="https://github.com/MoonModules/WLED-MM/issues/241" target="_blank" rel="noreferrer nofollow noopener">Error 11 not enough space after saving some presets</a>
15-
* Once you edit a setting and save in the LED Preferences and go try to save again it will crash the device. <a href="https://chatgpt.com/share/685dba2e-3818-8010-8b44-592d802f0782" target="_blank" rel="noreferrer nofollow noopener">Workaround for now is to edit the json manually using ChatGPT.</a>
16-
* <a href="https://github.com/MoonModules/WLED-MM/issues/247" target="_blank" rel="noreferrer nofollow noopener">Image and effects are shifted to the left by 1 column</a>
11+
Segments are also able to be used to control two panels from one controller such as making the first segment a 64x64 panel and the second segment control second 64x64 panel.
12+
13+
The M-1 matrix is able to be controlled via the <a href="https://mm.kno.wled.ge/interfaces/json-api/" target="_blank" rel="noreferrer nofollow noopener">JSON API</a> and this allows to do some really neat things such as send data from Home Assistant to show up as "scrolling text" on your matrix. (Works best with 2 or 3 panels not 4 due to 32 characters available as scrolling text.
14+
15+
The M-1 Matrix can be controlled using the <a href="https://mm.kno.wled.ge/interfaces/json-api/" target="_blank" rel="noreferrer nofollow noopener">JSON API</a>, allowing you to do some really cool things like sending data from Home Assistant to display as scrolling text on the matrix. (For best results, use 1 to 3 panels instead of 4, as the scrolling text supports up to 32 characters.)
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
<h2>🧩 WLED Matrix YAML Generator (4 Segments)</h2>
2+
<p>Select the entity type and enter the full Home Assistant entity ID. Example: <code>sensor.temp_living_room</code></p>
3+
4+
<form id="entity-form">
5+
<div id="entity-entries"></div>
6+
</form>
7+
8+
<h3>📝 Generated YAML:</h3>
9+
<pre id="output" style="background:#1e1e1e;color:#dcdcdc;padding:1em;overflow:auto;border-radius:5px;"></pre>
10+
<button onclick="copyYAML()">📋 Copy to Clipboard</button>
11+
12+
<script>
13+
const defaultFX = 122;
14+
const output = document.getElementById("output");
15+
const entries = document.getElementById("entity-entries");
16+
17+
const exampleEntities = [
18+
{ type: "weather", entity: "weather.nowcast" },
19+
{ type: "lock", entity: "lock.front_door_lock" },
20+
{ type: "sensor", entity: "sensor.brandon_air_1_co2" },
21+
{ type: "alarm_control_panel", entity: "alarm_control_panel.alarmo" }
22+
];
23+
24+
// Build 4 input blocks
25+
for (let i = 0; i < 4; i++) {
26+
const div = document.createElement("div");
27+
const example = exampleEntities[i];
28+
div.innerHTML = `
29+
<fieldset style="margin-bottom:1em;border:1px solid #ccc;padding:1em;border-radius:6px;">
30+
<legend>Segment ${i}</legend>
31+
<label>Entity Type:
32+
<select name="type" data-id="${i}">
33+
<option value="sensor">sensor</option>
34+
<option value="lock">lock</option>
35+
<option value="alarm_control_panel">alarm_control_panel</option>
36+
<option value="weather">weather</option>
37+
<option value="other">other</option>
38+
</select>
39+
</label><br>
40+
<label>Entity ID:
41+
<input type="text" name="entity" value="${example.entity}" placeholder="e.g., sensor.temp_living_room" data-id="${i}" style="width: 300px;">
42+
</label>
43+
</fieldset>
44+
`;
45+
entries.appendChild(div);
46+
}
47+
48+
// Update YAML output when inputs change
49+
entries.querySelectorAll("input, select").forEach(el => {
50+
el.addEventListener("input", updateYAML);
51+
el.addEventListener("change", updateYAML);
52+
});
53+
54+
function formatTemplate(entity, type) {
55+
if (!entity) return "";
56+
const name = entity.split(".")[1]?.replace(/_/g, " ");
57+
switch (type) {
58+
case "sensor":
59+
return `{{ states('${entity}') | round(0) }} (${name})`;
60+
case "lock":
61+
return `${name}: {{ 'Locked' if is_state('${entity}', 'locked') else 'Unlocked' }}`;
62+
case "alarm_control_panel":
63+
return `Alarm: {{ states('${entity}') | title }}`;
64+
case "weather":
65+
return `Weather: {{ states('${entity}') | title }}`;
66+
default:
67+
return `{{ states('${entity}') }} (${name})`;
68+
}
69+
}
70+
71+
function updateYAML() {
72+
const segments = Array.from(entries.querySelectorAll("fieldset")).map((fs, i) => {
73+
const type = fs.querySelector('select[name="type"]').value;
74+
const entity = fs.querySelector('input[name="entity"]').value.trim();
75+
if (!entity) return null;
76+
const template = formatTemplate(entity, type).replace(/"/g, '\\"');
77+
return ` {\n "id": ${i},\n "fx": ${defaultFX},\n "n": "${template}"\n }`;
78+
}).filter(Boolean);
79+
80+
const yaml = `rest_command:\n matrix_all_segments:\n url: http://10.10.10.176/json/state\n content_type: 'application/json'\n verify_ssl: false\n method: 'post'\n timeout: 20\n payload: >\n {\n "seg":[\n${segments.join(",\n")}\n ]\n }`;
81+
82+
output.textContent = yaml;
83+
}
84+
85+
function copyYAML() {
86+
navigator.clipboard.writeText(output.textContent).then(() => {
87+
alert("YAML copied to clipboard!");
88+
});
89+
}
90+
91+
updateYAML();
92+
</script>

0 commit comments

Comments
 (0)