Skip to content

Commit 3455af8

Browse files
authored
Merge branch 'main' into main
2 parents 2e3e6a5 + 23833a5 commit 3455af8

File tree

6 files changed

+76
-11
lines changed

6 files changed

+76
-11
lines changed

README.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,43 @@ curl http://your-server/api/data
302302

303303
---
304304

305+
## Use HTTP API in Home Assistant
306+
307+
An example configuration for an automation to set the brightness based on the sun's position. Dims the display when the sun is setting.
308+
309+
- Add the following code to your `configuration.yaml`:
310+
```yaml
311+
rest_command:
312+
obegraensad_brightness_high:
313+
url: "http://your-server/api/brightness/"
314+
method: PATCH
315+
content_type: "application/x-www-form-urlencoded"
316+
payload: "value=100"
317+
obegraensad_brightness_low:
318+
url: "http://your-server/api/brightness/"
319+
method: PATCH
320+
content_type: "application/x-www-form-urlencoded"
321+
payload: "value=1"
322+
```
323+
- Go to *Settings* --> *Automations* and create a new automation.
324+
- Select *Edit in YAML* and add the following content:
325+
```yaml
326+
alias: Obegraensad low bightness
327+
description: ""
328+
triggers:
329+
- trigger: sun
330+
event: sunset
331+
offset: 0
332+
conditions: []
333+
actions:
334+
- action: rest_command.obegraensad_brightness_low
335+
data: {}
336+
mode: single
337+
```
338+
- To set the brightness back to bright, create e.g. another automation or a condition in which `rest_command.obegraensad_brightness_high` is called.
339+
340+
---
341+
305342
# Plugin Scheduler
306343

307344
It is possible to switch between plugins automatically.

frontend/src/app.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ export const App: Component = () => {
109109
}
110110
>
111111
<ScreenInfo>
112-
<h2 class="text-4xl">A Plugin currently running</h2>
112+
<h2 class="text-4xl">A plugin is currently running</h2>
113113
<p class="text-xl mt-2 text-gray-300">
114114
Select "Draw" to show the canvas.
115115
</p>

lib/AsyncElegantOTA/AsyncElegantOTA.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
#ifdef ESP32
88
#include <AsyncTCP.h>
99
#include <Update.h>
10-
#include <esp_int_wdt.h>
1110
#include <esp_task_wdt.h>
1211
#endif
1312
#ifdef ESP8266
@@ -52,4 +51,4 @@ class AsyncElegantOtaClass
5251

5352
extern AsyncElegantOtaClass AsyncElegantOTA;
5453

55-
#endif
54+
#endif

partitions-4MB.csv

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Name ,Type ,SubType ,Offset ,Size ,Flags
2+
nvs ,data ,nvs ,36K ,20K ,
3+
otadata ,data ,ota ,56K ,8K ,
4+
app0 ,app ,ota_0 ,64K ,1856K ,
5+
app1 ,app ,ota_1 ,1920K ,1856K ,
6+
spiffs ,data ,spiffs ,3776K ,256K ,
7+
coredump ,data ,coredump ,4032K ,64K ,

platformio.ini

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,21 +24,42 @@ monitor_speed = 115200
2424
monitor_filters = esp32_exception_decoder
2525
;build_flags = -DARDUINO_USB_CDC_ON_BOOT=1
2626
; -DARDUINO_USB_MODE=1
27+
; extra_scripts = upload.py
28+
; upload_protocol = custom
29+
; upload_url = http://192.168.178.50/update
30+
; upload_port = 192.168.178.50
2731

32+
[env:ESP32-wemos]
33+
#platform = espressif32
34+
platform = https://github.com/pioarduino/platform-espressif32/releases/download/54.03.20/platform-espressif32.zip
35+
board = wemos_d1_mini32
36+
framework = arduino
37+
lib_deps =
38+
https://github.com/ESP32Async/ESPAsyncWebServer
39+
bblanchon/ArduinoJson@^6.21.5
40+
https://github.com/tzapu/WiFiManager.git#v2.0.17
41+
mickey9801/ButtonFever@^1.0
42+
build_flags = -fexceptions
43+
board_build.partitions = partitions-4MB.csv
44+
monitor_speed = 115200
45+
monitor_filters = esp32_exception_decoder
2846
; extra_scripts = upload.py
2947
; upload_protocol = custom
3048
; upload_url = http://192.168.178.50/update
3149
; upload_port = 192.168.178.50
3250

3351
[env:esp32dev]
34-
platform = espressif32
52+
#platform = espressif32
53+
platform = https://github.com/pioarduino/platform-espressif32/releases/download/54.03.20/platform-espressif32.zip
3554
board = esp32dev
3655
framework = arduino
3756
lib_deps =
38-
https://github.com/me-no-dev/ESPAsyncWebServer.git
57+
https://github.com/ESP32Async/ESPAsyncWebServer
3958
bblanchon/ArduinoJson@^6.21.5
4059
https://github.com/tzapu/WiFiManager.git#v2.0.17
4160
mickey9801/ButtonFever@^1.0
61+
build_flags = -fexceptions
62+
board_build.partitions = partitions-4MB.csv
4263
monitor_speed = 115200
4364
monitor_filters = esp32_exception_decoder
4465
; extra_scripts = upload.py

src/screen.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,9 @@ void Screen_::restoreCache()
109109
// CACHE END
110110

111111
// STORAGE START
112-
#ifdef ENABLE_STORAGE
113112
void Screen_::loadFromStorage()
114113
{
114+
#ifdef ENABLE_STORAGE
115115
storage.begin("led-wall", true);
116116
setBrightness(255);
117117

@@ -128,17 +128,19 @@ void Screen_::loadFromStorage()
128128
setBrightness(storage.getUInt("brightness", 255));
129129
setCurrentRotation(storage.getUInt("rotation", 0));
130130
storage.end();
131+
#endif
131132
}
132133

133134
void Screen_::persist()
134135
{
136+
#ifdef ENABLE_STORAGE
135137
storage.begin("led-wall");
136138
storage.putBytes("data", renderBuffer_, ROWS * COLS);
137139
storage.putUInt("brightness", brightness_);
138140
storage.putUInt("rotation", currentRotation);
139141
storage.end();
140-
}
141142
#endif
143+
}
142144
// STORAGE END
143145

144146
void Screen_::setup()
@@ -168,10 +170,9 @@ void Screen_::setup()
168170
SPI.begin(PIN_CLOCK, 34, PIN_DATA, 25); // SCLK, MISO, MOSI, SS
169171
SPI.beginTransaction(SPISettings(10000000, MSBFIRST, SPI_MODE0));
170172

171-
hw_timer_t *Screen_timer = timerBegin(0, 80, true);
172-
timerAttachInterrupt(Screen_timer, &onScreenTimer, true);
173-
timerAlarmWrite(Screen_timer, TIMER_INTERVAL_US, true);
174-
timerAlarmEnable(Screen_timer);
173+
hw_timer_t *Screen_timer = timerBegin(1000000);
174+
timerAttachInterrupt(Screen_timer, &onScreenTimer);
175+
timerAlarm(Screen_timer, TIMER_INTERVAL_US, true, 0);
175176
#endif
176177
}
177178

0 commit comments

Comments
 (0)