haswitchplate / openhasp Goto Github PK
View Code? Open in Web Editor NEWHomeAutomation Switchplate based on lvgl for ESP32
Home Page: https://www.openhasp.com
License: MIT License
HomeAutomation Switchplate based on lvgl for ESP32
Home Page: https://www.openhasp.com
License: MIT License
Add a page next/previous
or page +/-
commands that would switch to next configured page then loop back to page 0 once it reaches the end number of configured pages. Useful for page 254 buttons to go to next/previous page
add extra resilience for page command so it doesn't default to 0 when using anything but numbers but does nothing and returns error/invalid command in log
Jan 28 19:13:07 hasptest MQTT[RCV] - #033[91m[81008/136116 40]#033[92m[54588/54612 1]hasp/hasptest/command/page = next
Jan 28 19:13:07 hasptest HASP #033[91m[81008/136116 40]#033[92m[54588/54612 1]Changing page to 0
Jan 28 19:13:07 hasptest HASP #033[91m[81008/136116 40]#033[92m[54588/54612 1][0] p[0].b[0] lv_obj
Jan 28 19:13:07 hasptest MQTT[PUB] - #033[91m[81008/132944 39]#033[92m[54588/54612 1]hasp/hasptest/state/page => 0
Jan 28 19:13:16 hasptest MQTT[RCV] - #033[91m[81008/136116 40]#033[92m[54588/54612 1]hasp/hasptest/command/page = +
Jan 28 19:13:16 hasptest HASP #033[91m[81008/136116 40]#033[92m[54588/54612 1]Changing page to 0
After Long Idle, screen turns off. If I touch the screen to wake it, the object underneath will also react. This is a problem as the user might touch in the wrong area without first seeing the screen, causing undesired effects.
It would be nice to have an option/setting which enabled, at touch would check first if the screen is off and if it is, just wake it and exit routine/function without touching the objects.
A quick note: numPages
in statusupdate
is always 12, while I only defined 5 pages in my .jsonl file.
Is your feature request related to a problem? Please describe.
To protect and prolonge the lifetime of the devices, thus being more green and generating less hazardous waste.
LCD switche's main problem is that they display the same picture 99.999% of the time when turned on. Even if somebody turns off backlight during the night or dark periods, if turned on during the day it is still true and the same pixels are tensioned the same way always. But turned off backlight only reduces heat generated by the panel, external heat cannot be avoided, so for example when the sun lights the plate, even if backlight is off and picture can't be seen, the LCD pixels still display the same and the heat has the same negative effect when coming through the front.
This will lead to screen picture burn-in after a few years of operation.
Describe the solution you'd like
The solution is to "train" the pixels with other contents from time to time. Display of other pages is not enough because the contents of them change in very little, background/button colors are mostly the same, not to speak about a header or a footer page navigation bar which is the same across all pages.
The suggested solution would consist of a function which displays random R, G, B, Black and White colored pixels all across the screen every 1 second. This could be activated by an MQTT command antiburn 1
and stopped by touching the screen or by antiburn 0
. The command could be issued by the HA system in idle periods like when presence reporting nobody's home or during the night or whatever. It would be up to the users when they'd want to trigger this, openHASP should never run this on its own. The recommendation would be that if possible, the users should run this for 1-5 minutes per day total time.
Describe alternatives you've considered
Use static BMP loaded to flash and looping through one by one. Not good because pictures are always the same (not truly random), flash space eaten up by uncompressed BMP, lot of overhead.
Additional context
Not applicable.
Long idle setting in "Display Settings" is not retained, resulting in the display remaining on indefinitely.
This happens after home assistant restarts. Not always immediately, but eventually after 3 or 4 restarts the setting is lost.
Setting retained.
openHASP returns the state of dropdowns and rollers containing unescaped newline (\n
) character.
This is invalid and causes an exception in Home Assistant.
Using dropdowns to list the sources and sound modes of a media player.
This is the related starter config loaded config.jsonl from flash:
{"page":6,"id":5,"obj":"dropdown","x":5,"y":128,"w":120,"h":30,"options":"Source1\nSource2\nSource3"}
{"page":6,"id":6,"obj":"dropdown","x":130,"y":128,"w":75,"h":30,"options":"Jazz\nPop\nRock"}
The objects get updated correctly by the custom component using templates generating lists separated by newline character:
- obj: "p6b5" # sources list
properties:
"options": >
{% if not (is_state('media_player.hang_up2stream','unavailable')) %}{{"(nincs forrás)\n"|e}}{%for source in state_attr('media_player.hang_up2stream','source_list')%}{{source+"\n"|e}}{%-if not loop.last%}{%-endif%}{%-endfor%}{% endif %}
- obj: "p6b6" # sound modes list
properties:
"options": >
{% if not (is_state('media_player.hang_up2stream','unavailable')) %}{%for soundmode in state_attr('media_player.hang_up2stream','sound_mode_list')%}{{soundmode+"\n"|e}}{%-if not loop.last%}{%-endif%}{%-endfor%}{% endif %}
The objects get populated correctly with the options, however when the plate returns them in MQTT state topics hasp/plate/state/p6b5
and hasp/plate/state/p6b6
Home Assistant registers error message json.decoder.JSONDecodeError: Invalid control character at the location of the first newline character:
2021-04-16 17:37:23 ERROR (MainThread) [homeassistant.util.logging] Exception in message_received when handling msg on 'hasp/plate/state/p6b5': '{"options":"(nincs forrás)
3,5 Jack
Bluetooth
USB
PC Audio
Jazzy
Jazzy Robi
Rádió 1
Retró
Sláger
Best FM
Forrás
Manna
Info Rádió
Jazzy Soul
Jazzy Grrove
Jazzy Cool
Petőfi
SpotifyPlayer
Karácsony
Kossuth
Impuls
SubasioPiu"}'
Traceback (most recent call last):
File "/config/custom_components/openhasp/__init__.py", line 559, in message_received
message = HASP_EVENT_SCHEMA(json.loads(msg.payload))
File "/usr/local/lib/python3.8/json/__init__.py", line 357, in loads
return _default_decoder.decode(s)
File "/usr/local/lib/python3.8/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/local/lib/python3.8/json/decoder.py", line 353, in raw_decode
obj, end = self.scan_once(s, idx)
json.decoder.JSONDecodeError: Invalid control character at: line 1 column 27 (char 26)
2021-04-16 17:37:23 ERROR (MainThread) [homeassistant.util.logging] Exception in message_received when handling msg on 'hasp/plate/state/p6b6': '{"options":"Classic
Jazz
Normal
Pop
Vocal"}'
Traceback (most recent call last):
File "/config/custom_components/openhasp/__init__.py", line 559, in message_received
message = HASP_EVENT_SCHEMA(json.loads(msg.payload))
File "/usr/local/lib/python3.8/json/__init__.py", line 357, in loads
return _default_decoder.decode(s)
File "/usr/local/lib/python3.8/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/local/lib/python3.8/json/decoder.py", line 353, in raw_decode
obj, end = self.scan_once(s, idx)
json.decoder.JSONDecodeError: Invalid control character at: line 1 column 20 (char 19)
2021-04-16 17:37:25 ERROR (MainThread) [homeassistant.util.logging] Exception in message_received when handling msg on 'hasp/plate/state/p6b5': '{"options":"(nincs forrás)
3,5 Jack
Bluetooth
USB
PC Audio
Jazzy
Jazzy Robi
Rádió 1
Retró
Sláger
Best FM
Forrás
Manna
Info Rádió
Jazzy Soul
Jazzy Grrove
Jazzy Cool
Petőfi
SpotifyPlayer
Karácsony
Kossuth
Impuls
SubasioPiu"}'
Traceback (most recent call last):
File "/config/custom_components/openhasp/__init__.py", line 559, in message_received
message = HASP_EVENT_SCHEMA(json.loads(msg.payload))
File "/usr/local/lib/python3.8/json/__init__.py", line 357, in loads
return _default_decoder.decode(s)
File "/usr/local/lib/python3.8/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/local/lib/python3.8/json/decoder.py", line 353, in raw_decode
obj, end = self.scan_once(s, idx)
json.decoder.JSONDecodeError: Invalid control character at: line 1 column 27 (char 26)
2021-04-16 17:37:25 ERROR (MainThread) [homeassistant.util.logging] Exception in message_received when handling msg on 'hasp/plate/state/p6b6': '{"options":"Classic
Jazz
Normal
Pop
Vocal"}'
Traceback (most recent call last):
File "/config/custom_components/openhasp/__init__.py", line 559, in message_received
message = HASP_EVENT_SCHEMA(json.loads(msg.payload))
File "/usr/local/lib/python3.8/json/__init__.py", line 357, in loads
return _default_decoder.decode(s)
File "/usr/local/lib/python3.8/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/local/lib/python3.8/json/decoder.py", line 353, in raw_decode
obj, end = self.scan_once(s, idx)
json.decoder.JSONDecodeError: Invalid control character at: line 1 column 20 (char 19)
Jsons generated by the plate in MQTT payloads need to be checked not to contain invalid characters.
Hi' Francis.
WOW !! What an amazing piece of software!! 👏👏😎
It's almost unbelieable that you've managed to squeeze all this into an ESP8266 🤯
I've had a Nextion display lying around for almost a year, but never really got to setup and test good old HASP.
And now I've stumpled across this little gem by pure accident - lucky me 😉
Hasp-lvgl can do all I searched for and a lot more.
I'm using Home Assistant to tie up all my IoT and automations.
Could you add the possibility to specify and tie an optional HA entity_id and key with an object in the pages.jsonl file ?
That would make templating in various automations possible for groups of 'identical' entities (light, switches etc.)
The easy part would be to include these in the state json attributes string thas is published.
But HA would need to push commands and state changes as well to hasp-lvgl.
As page and object number is arbitrary to HA, entity_id would have to be used as identifier in topic,
Can't really think of any easier and more clever method to link entity_id together with page and object number 🤔
Have I completely missed an obvious solution that could be used as alternative ? 😆
Rgds.
Henning
Is your feature request related to a problem? Please describe.
To verify the status of the GPIO settings from HA side. At boot HA could check the plate's gpio settings and if finds them inappropriate, push down the right config.
Describe the solution you'd like
When publishing an empty payload to hasp/plate/config/gpio
it would be nice if the plate would respond with current GPIO settings in effect (if no GPIO setting present, respond none
or something easily detectable from an error). Optionally put it in state/statusupdate
.
Describe alternatives you've considered
n/a
Additional context
n/a
Currently the switchplate needs to be connected to wifi & mqtt, otherwise it will reboot after an extended time-out.
With local gpios connected in groups, it should be possible to use the switch in an offline mode, with only local gpio functions and GUI.
Not a issue, more a question.
While going over the code, i saw this option.
http://192.168.1.118/list?dir=
It will list all the file on the SPIFFS.
I am testing some different fonts and font size, now the SPIFFS is running full.
and the only option i found to remove them is to flash a empty image over the SPIFFS.
did you build some other (hidden) option to remove file's?
{"page":2,"comment":"---------- Page 2 ----------"}
{"obj":"btn","id":1,"x":0,"y":0,"w":240,"h":30,"text":"HÁLÓSZOBA","value_font":22,"bg_color":"#2C3E50","text_color":"#FFFFFF","radius":0,"border_side":0}
{"obj":"btn","id":3,"x":195,"y":0,"h":30,"w":40,"text":"22.1°C","val":"0","bg_color":"#2C3E50","text_color":"#FFFFFF","radius":0,"border_side":0}
{"obj":"label","id":4,"x":10,"y":40,"w":220,"h":30,"text":"Kívánt hőmérséklet:","align":1,"padh":50}
{"obj":"arc","id":5,"x":20,"y":75,"w":200,"h":200,"min":150,"max":350,"border_side":0,"type":0,"rotation":0,"start_angle":135,"end_angle":45,"start_angle1":135,"end_angle1":45,"value_font":44,"value_color":"#2C3E50","adjustable":"true","groupid":7}
{"obj":"switch","id":6,"x":89,"y":235,"w":66,"h":30,"toggle":"TRUE"}
(don't forget to adjust font sizes to values supported by your build)
Create an automation in Home Assistant to update values:
- alias: lanbon-arc-update
initial_state: 'on'
trigger:
- platform: mqtt
topic: 'hasp/plate/state/p2b5'
condition:
- condition: template
value_template: "{{ trigger.payload_json.event == 'changed' }}"
action:
- service: mqtt.publish
data:
topic: hasp/plate/command/p2b5.value_str
payload: "{{ trigger.payload_json.val / 10 | float }}"
Try to move the handle of the arc, relatively fast, to about 50%. You'll notice how slow the value updates in the middle.
The reason is that MQTT is flooded with a lot of messages, and Home Assistant tries to process all of them:
2021-03-09 22:34:54 WARNING (MainThread) [homeassistant.components.automation.lanbon_arc_update] lanbon-arc-update: Already running
2021-03-09 22:35:23 WARNING (MainThread) [homeassistant.components.automation.lanbon_arc_update] lanbon-arc-update: Already running
2021-03-09 22:35:25 WARNING (MainThread) [homeassistant.components.automation.lanbon_arc_update] lanbon-arc-update: Already running
2021-03-09 22:35:26 WARNING (MainThread) [homeassistant.components.automation.lanbon_arc_update] lanbon-arc-update: Already running
2021-03-09 22:35:26 WARNING (MainThread) [homeassistant.components.automation.lanbon_arc_update] lanbon-arc-update: Already running
2021-03-09 22:35:26 WARNING (MainThread) [homeassistant.components.automation.lanbon_arc_update] lanbon-arc-update: Already running
2021-03-09 22:35:26 WARNING (MainThread) [homeassistant.components.automation.lanbon_arc_update] lanbon-arc-update: Already running
2021-03-09 22:35:26 WARNING (MainThread) [homeassistant.components.automation.lanbon_arc_update] lanbon-arc-update: Already running
2021-03-09 22:35:26 WARNING (MainThread) [homeassistant.components.automation.lanbon_arc_update] lanbon-arc-update: Already running
2021-03-09 22:35:26 WARNING (MainThread) [homeassistant.components.automation.lanbon_arc_update] lanbon-arc-update: Already running
2021-03-09 22:35:26 WARNING (MainThread) [homeassistant.components.automation.lanbon_arc_update] lanbon-arc-update: Already running
2021-03-09 22:35:26 WARNING (MainThread) [homeassistant.components.automation.lanbon_arc_update] lanbon-arc-update: Already running
2021-03-09 22:35:26 WARNING (MainThread) [homeassistant.components.automation.lanbon_arc_update] lanbon-arc-update: Already running
2021-03-09 22:35:26 WARNING (MainThread) [homeassistant.components.automation.lanbon_arc_update] lanbon-arc-update: Already running
2021-03-09 22:35:26 WARNING (MainThread) [homeassistant.components.automation.lanbon_arc_update] lanbon-arc-update: Already running
2021-03-09 22:35:26 WARNING (MainThread) [homeassistant.components.automation.lanbon_arc_update] lanbon-arc-update: Already running
2021-03-09 22:35:26 WARNING (MainThread) [homeassistant.components.automation.lanbon_arc_update] lanbon-arc-update: Already running
2021-03-09 22:35:26 WARNING (MainThread) [homeassistant.components.automation.lanbon_arc_update] lanbon-arc-update: Already running
2021-03-09 22:35:26 WARNING (MainThread) [homeassistant.components.automation.lanbon_arc_update] lanbon-arc-update: Already running
2021-03-09 22:35:26 WARNING (MainThread) [homeassistant.components.automation.lanbon_arc_update] lanbon-arc-update: Already running
2021-03-09 22:39:58 WARNING (MainThread) [homeassistant.components.automation.lanbon_arc_update] lanbon-arc-update: Already running
2021-03-09 22:39:59 WARNING (MainThread) [homeassistant.components.automation.lanbon_arc_update] lanbon-arc-update: Already running
2021-03-09 22:39:59 WARNING (MainThread) [homeassistant.components.automation.lanbon_arc_update] lanbon-arc-update: Already running
2021-03-09 22:39:59 WARNING (MainThread) [homeassistant.components.automation.lanbon_arc_update] lanbon-arc-update: Already running
2021-03-09 22:39:59 WARNING (MainThread) [homeassistant.components.automation.lanbon_arc_update] lanbon-arc-update: Already running
2021-03-09 22:39:59 WARNING (MainThread) [homeassistant.components.automation.lanbon_arc_update] lanbon-arc-update: Already running
2021-03-09 22:39:59 WARNING (MainThread) [homeassistant.components.automation.lanbon_arc_update] lanbon-arc-update: Already running
2021-03-09 22:39:59 WARNING (MainThread) [homeassistant.components.automation.lanbon_arc_update] lanbon-arc-update: Already running
2021-03-09 22:39:59 WARNING (MainThread) [homeassistant.components.automation.lanbon_arc_update] lanbon-arc-update: Already running
2021-03-09 22:39:59 WARNING (MainThread) [homeassistant.components.automation.lanbon_arc_update] lanbon-arc-update: Already running
2021-03-09 22:40:02 WARNING (MainThread) [homeassistant.components.automation.lanbon_arc_update] lanbon-arc-update: Already running
2021-03-09 22:40:02 WARNING (MainThread) [homeassistant.components.automation.lanbon_arc_update] lanbon-arc-update: Already running
2021-03-09 22:40:02 WARNING (MainThread) [homeassistant.components.automation.lanbon_arc_update] lanbon-arc-update: Already running
2021-03-09 22:40:02 WARNING (MainThread) [homeassistant.components.automation.lanbon_arc_update] lanbon-arc-update: Already running
2021-03-09 22:40:02 WARNING (MainThread) [homeassistant.components.automation.lanbon_arc_update] lanbon-arc-update: Already running
2021-03-09 22:40:02 WARNING (MainThread) [homeassistant.components.automation.lanbon_arc_update] lanbon-arc-update: Already running
Of course if we use a smaller interval for arc, like "min":15,"max":35
messages will be much fewer, but that's not acceptable because of #81.
Hello,
I've bought a M5Paper with an e-ink screen. Do you know how to start to add this board to your project?
Kind regards
So tried to update to v5.0 and i get this when i use 1. esphome and this when i use 2. tasmo.
1
Using 'COM6' as serial port.
Connecting....
Detecting chip type... ESP32
Connecting....
Chip Info:
Is your feature request related to a problem? Please describe.
To enable Latin2 currently I have to manually replace in lv_conf_v7.h from latin1 to latin2 in 16 places.
Describe the solution you'd like
Make this selectable from user_config_override.h.
Describe alternatives you've considered
N/A
Additional context
N/A
x
Jan 8 23:06:50 plate_aad368 MQTT[PUB] - #033[91m[81008/130612 37]#033[92m[49480/50368 2]hasp/plate_aad368/state/p0b6 => {"val":"1"} x
Jan 8 23:06:50 plate_aad368 MQTT[PUB] - #033[91m[81008/130612 37]#033[92m[49480/50368 2]hasp/plate_aad368/state/p0b6 => {"txt":"Green Tea"} x
Jan 8 23:06:50 plate_aad368 MQTT[PUB] - #033[91m[81008/130612 37]#033[92m[49480/50448 2]hasp/plate_aad368/state/p0b6 => {"val":"2"} x
Jan 8 23:06:50 plate_aad368 MQTT[PUB] - #033[91m[81008/130612 37]#033[92m[49480/50448 2]hasp/plate_aad368/state/p0b6 => {"txt":"Oolong Tea"}
roller objects reports value changes in two separate mqtt messages. would probably be better to merge them together
hasp/plate_aad368/state/p0b6 = {"val":"2","txt":"Oolong Tea"}
Version tested on: v0.3.2, v0.3.1
Device: lanbon l8
I want to start by saying thanks for this wonderful project. It was exactly what i have been looking for! I recently purchased a lanbon l8 to give it a go. I just wanted to share some of the initial challenges i had faced:
user_config_override.h
. It then complained that my wifi password was too long, which i proceeded to change this line char wifiPassword[32] = WIFI_PASSW;
to match my password length in hasp_wifi.cpp
I hope this will help other people who are also trying the lanbon l8
Originally I submitted a feature request to get / set the gpio configuration via MQTT but it turned out that none of the config/submodule commands work.
Publish and empty paylod to hasp/<nodename>/config/gui
. No response.
Same experience for all config/submodules.
Go to web interface > Configuration > Display Settings. Check the value for Long Idle
, make sure it's not 224.
Publish payload {"idle2":224}
to hasp/<nodename>/config/gui
. Watch the debug console, nothing happens.
Check the value for Long Idle
in the web interface again by refreshing the page. Should have been changed, but it didn't.
Empty payloads to hasp/<nodename>/config/gui
should result in responses published to hasp/<nodename>/state/config
n/a
The object IDs currently are arbitrary and it would help to make better sense to group them according to their purpose. Here is a proposal to use the object name as obj
parameter instead of objid
. The current objid
still works, but will be obsoleted in the future.
Controls | objid | obj | implemented | note |
---|---|---|---|---|
OBJECT | 91 | obj | ✔️ | |
BUTTON | 10 | btn | ✔️ | |
BTNMATRIX | 13 | btnmatrix | ✔️ | add txt to return value |
IMGBTN | 14 | imgbtn | ❌ | |
CHECKBOX | 11 | cb | ✔️ | |
SWITCH | 40 | switch | ✔️ | |
SLIDER | 30 | slider | ✔️ | |
TEXTAREA | 16 | textarea | 🕘 | |
SPINBOX | 17 | spinbox | ❌ | |
CPICKER | 20 | cpicker | ✔️ | |
Visualizers |
id | obj | implemented | note |
LABEL | 12 | label | ✔️ | |
GAUGE | 31 | gauge | ✔️ | add more needles |
BAR | 32 | bar | ✔️ | |
LMETER | 33 | lmeter | ✔️ | |
LED | 41 | led | ✔️ | |
ARC | 22 | arc | ✔️ | |
PRELOADER | 21 | spinner | ✔️ | |
CHART | 37 | chart | 🕘 | |
Selectors |
id | obj | implemented | note |
DDLIST | 50 | dropdown | ✔️ | |
ROLLER | 51 | roller | ✔️ | |
LIST | 52 | list | 🕘 | |
TABLE | 53 | table | 🕘 | |
CALENDER | 54 | calendar | ✔️ | |
Containers |
id | obj | implemented | note |
CONTAINER | 60 | cont | ⭕ | Obsolete in v8 |
WINDOW | 61 | win | ❌ | |
MSGBOX | 62 | msgbox | 🕘 | |
TILEVIEW | 63 | tileview | ❌ | Simplified in v8 |
TABVIEW | 64 | tabview | ✔️ | |
TAB | 65 | tab | ✔️ | |
PAGE | 69 | page | ⭕ | Obsolete in v8 |
Graphics |
id | obj | implemented | note |
LINE | 70 | line | ✔️ | |
IMAGE | 71 | img | ✔️ | |
CANVAS | 72 | canvas | ❌ | |
MASK | 73 | objmask | ⭕ | Obsolete in v8 |
Is your feature request related to a problem? Please describe.
No
Describe the solution you'd like
For example when in Home Assistant a state changes from on / off (eg. lights) a popup is show with custom text and after x ms goes away.
Describe alternatives you've considered
NA
Additional context
NA
All objects on page 254 report to /p254b
topic
Jan 28 19:42:57 hasptest MQTT[PUB] - #033[91m[81008/136116 40]#033[92m[50860/50872 1]hasp/hasptest/state/p254b => {"event":"SHORT"}
Jan 28 19:42:59 hasptest MQTT[PUB] - #033[91m[81008/132944 39]#033[92m[50776/50844 1]hasp/hasptest/state/p254b => {"event":"DOWN"}
Jan 28 19:42:59 hasptest MQTT[PUB] - #033[91m[81008/134288 39]#033[92m[50776/50844 1]hasp/hasptest/state/p254b => {"event":"SHORT"}
Jan 28 19:43:00 hasptest MQTT[PUB] - #033[91m[81008/136116 40]#033[92m[50776/50844 1]hasp/hasptest/state/p254b => {"event":"DOWN"}
Jan 28 19:43:00 hasptest MQTT[PUB] - #033[91m[81008/136116 40]#033[92m[50776/50844 1]hasp/hasptest/state/p254b => {"event":"SHORT"}
As the lvgl is evaluating and iterating causing some incompatible issues. As stated lib_deps = https://github.com/littlevgl/lvgl.git ;[email protected] - Not in library yet
in the platformio.ini, modify it to https://github.com/littlevgl/lvgl.git#v6.1.2 ;[email protected] - Not in library yet
and then compile successfully.
Check the platform.ini and found out for [env:esp12e-st7735] using the
lib_deps = ${env.lib_deps} Ethernet@<2.0.0
Generally, Ethernet lib is applicable for W5100/5500 ethernet chip. That being said, for esp12e in our case, we should ignore this lib.
Append as below
`; -- Library options -------------------------------
lib_deps =
${env.lib_deps}
Ethernet@<2.0.0
lib_ignore =
Ethernet`
Then compile successfully.
Is your feature request related to a problem? Please describe.
To make custom builds even more tailored to specific hardware, offer a possibility to set the GPIOs from user_config_override.h
.
Describe the solution you'd like
Lanbon L8 GPIO config can be simply set through MQTT.
Have in user_config_override.h
an entry similar to:
#define GPIO "2360346,2491680,2623009,2097420,2097678,2097947,0,0"
Describe alternatives you've considered
Making an automation in HA system to first check if the hasp/<nodename>/config/gpio
has anything meaningful set, and if not OK, overwrite with command described in the docs.
Rather ugly but feasible, useless since this should be only set once in a lifetime. Waste of resources...
Additional context
Add any other context or screenshots about the feature request here.
Jan 30 17:10:47 lanbon MQTT[PUB] - #033[91m[81008/128256 36]#033[92m[53288/54216 2]hasp/lanbon/state/page => 1
Jan 30 17:10:52 lanbon MQTT[RCV] - #033[91m[81008/131432 38]#033[92m[54212/54224 1]hasp/lanbon/command/clearpage = 1
Jan 30 17:10:52 lanbon HASP #033[91m[81008/131432 38]#033[92m[54212/54224 1]Invalid page 1
Jan 30 17:12:19 lanbon MQTT[RCV] - #033[91m[81008/131388 38]#033[92m[54212/54224 1]hasp/lanbon/command/clearpage =
Jan 30 17:12:19 lanbon HASP #033[91m[81008/131388 38]#033[92m[54212/54224 1]Invalid page 1
issuing clearpage
or clearpage 1
doesn't clear page and throws invalid command
i have build and flashed your code but i get nothing in the display. i used the same libraries and configuration and i was able to run littlevgl with tft_espi just fine. looks something is missing from the project or instructions are not clear.
Can for example be used for integration with home assistant in the same way original HAPlate is used, throught "first time setup automation"?
Is it mandatory to upload fonts?
The definition of the array "char mqttServer[16]" is too short for using dynamic DNS urls.
I recommend using a larger number.
Thank you
Error:
src/mqtt/hasp_mqtt_pubsubclient.cpp:57:19: error: initializer-string for array of chars is too long [-fpermissive]
#define MQTT_HOST "homeswhome.dyndns.org";
^
src/mqtt/hasp_mqtt_pubsubclient.cpp:84:25: note: in expansion of macro 'MQTT_HOST'
char mqttServer[16] = MQTT_HOST;
Group items state is lost after reboot. To reproduce:
on
the relay turns on
on
(correctly), but after boot the object displays as off
, state in MQTT is on
(as no update came)Also inconsistent state occurs after power-cycling. To reproduce:
on
the relay turns on
off
(correctly), after boot the object displays as off
, state in MQTT is on
, incorrect (as no update came)I don't think we should save the state to the flash, instead we should check the state of the GPIO outputs in the group after boot and set the state of the objects accordingly. Also send an MQTT update about these to make sure real state is correct after reboot or power cycling and MQTT server reconnection.
It's important imho not to rely exclusively on the HA system to update states of the objects, when we're talking about outputs and objects on the same device. Reboots and power cycles are situations close to (prolonged) offline status. A plate boots in 1-2 seconds, a HA system can boot for minutes until plates are ready to connect. And states in the HA system can be really messed up after a boot.
Hi, i love your work. and start to see if i can use it for my project.
Got it working with a ESP32-CAM + 3.5" display (ILI9488) 320x480.
I can not figure out how to use a bigger font.
I got several .zi fonts and fontawesome.
i try uploading them via the GUI, but never gave me a hint on where to find them or how to use them
Please help.
Hi,
Is there a reason why the length of "HASP Node Name" is limited to 16 characters? I would need it longer.
What about making configurable the main topic "hasp/" ? That would add more flexibility to this nice software!
Thanks,
Jorge
I have uploaded custom font (via GUI)
Selected it (Via gui)
log.
[ 1.591][113792/268120 57][ 0/ 0 0]FILE: [SUCCESS] SPI flash FS mounted
[ 1.593][113792/268120 57][ 0/ 0 0]FILE: Listing files on the internal flash:
[ 1.728][113792/267372 57][ 0/ 0 0]FILE: * /pages.jsonl (1700 bytes)
[ 1.733][113792/266920 57][ 0/ 0 0]FILE: * /Ubuntu-Regular40.zi (29119 bytes)
[ 1.742][113792/266912 57][ 0/ 0 0]FILE: * /Ubuntu-Regular32.zi (22018 bytes)
[ 1.752][113792/266920 57][ 0/ 0 0]FILE: * /config.json (540 bytes)
[ 1.782][113792/266916 57][ 0/ 0 0]FILE: * /fontawesome32.zi (199639 bytes)
[ 1.811][113792/267672 57][ 0/ 0 0]CONF: Loading /config.json
[ 2.731][113792/184320 38][14804/14832 1]FONT: Loaded V5 Font File: /Ubuntu-Regular32.zi containing 224 characters
[ 2.735][113792/184736 38][14548/14580 1]HASP: Custom theme loaded
[ 2.787][113792/184736 38][13360/13368 1]HASP: Loading file /pages.jsonl
[ 2.789][113792/184076 38][13360/13368 1]DISPATCH: jsonl
[ 2.801][113792/183932 38][13232/13240 1]HASP: * p[0].b[1] = lv_label
[ 2.812][113792/183884 38][13000/13004 1]HASP: * p[0].b[2] = lv_btn
[ 2.822][113792/183900 38][12764/12768 1]HASP: * p[0].b[3] = lv_btn
[ 2.832][113792/183900 38][12528/12532 1]HASP: * p[0].b[4] = lv_btn
[ 2.842][113792/183900 38][12292/12296 1]HASP: * p[0].b[5] = lv_btn
[ 2.851][113792/183932 38][12032/12076 1]HASP: * p[1].b[1] = lv_slider
[ 2.861][113792/183932 38][11856/11876 1]HASP: * p[1].b[3] = lv_gauge
[ 2.870][113792/183932 38][11704/11712 1]HASP: * p[1].b[4] = lv_bar
[ 2.881][113792/183932 38][11588/11588 0]HASP: * p[1].b[5] = lv_linemeter
[ 2.890][113792/183932 38][11588/11588 0]HASP: Parent ID p[1].b[5] found
[ 2.901][113792/183932 38][11456/11460 1]HASP: * p[1].b[10] = lv_label
[ 2.913][113792/183932 38][11316/11316 0]HASP: * p[2].b[1] = lv_cpicker
[ 2.924][113792/183932 38][11168/11168 0]HASP: * p[2].b[2] = lv_cpicker
[ 2.935][113792/183884 38][10968/10968 0]MQTT: Not connected
[ 2.939][113792/183884 38][10968/10968 0]HASP: * p[3].b[1] = lv_dropdown
[ 2.968][113792/183868 38][10440/10480 1]MQTT: Not connected
[ 2.970][113792/183868 38][10440/10480 1]HASP: * p[3].b[2] = lv_roller
[ 3.001][113792/183932 38][10200/10212 1]HASP: * p[254].b[40] = lv_btn
[ 3.014][113792/183932 38][ 9928/ 9944 1]HASP: * p[254].b[50] = lv_btn
[ 3.026][113792/183932 38][ 9676/ 9688 1]HASP: * p[254].b[60] = lv_btn
[ 3.028][113792/184736 38][ 9676/ 9688 1]HASP: File /pages.jsonl loaded
[ 3.037][113792/184736 38][ 9676/ 9688 1]HASP: Changing page to 0
You want to have an arc with "min":120,"max":350
but you notice that in reality the arc goes from 0 to 350 instead.
To reproduce:
"min":10,"max":20
- OK"min":80,"max":350
- OK"min":120,"max":200
- Not OK, it will go from 0 to 350.It looks like min doesn't like values above 100.
Will this software also work with the M5Stack Core 2 which is ESP32 based?
https://m5stack.com/products/m5stack-core2-esp32-iot-development-kit
The display is 2.0"@320*240 ILI9342C with a FT6336U touch screen.
I have one currently using https://github.com/sieren/Homepoint on the Core 2 but that’s not working as expected for the Core 2 at the moment.
outputx without payload will set the output to off which should instead return the current state
Greetings, just created the pt_PT.h header file for src/lang/ with the definitions translated to Portuguese.
Would be grateful if you could add it to the repo.
First of all, Thanks for the massive, impressive effort. I have been trying to make use of these high-potential devices for more than a year. I managed to create several working prototypes using vanilla LVGL but no 2-way integration with HomeAssistant, and also with ESPhome (works nicely with HA but no touch!). I am beyond grateful for your generous contribution here.
Regarding the L8. Now with version 0.3.3, when I set up the backlight of L8 using moodlight (GPIOs r:26,g:32,b:33). The resulting entity in HomeAssistant (via MQTT auto-discovery) isn't working. I tried to create a manual MQTT light using the MQTT Light Template Schema in HA which worked only for on/off but not for color.
I created 3 sliders on a page and used groupid to link them to each GPIO directly from the HASP without HomeAssistant. This seems to work fine. Kindly take a look if have an L8.
Also, in general, I think it is possible to link a color-picker object with moodlight using groupid so we can directly control it without MQTT. It needs a bit of work but will make more sense than using HA or MQTT to change the backlight color on L8.
Best Regards!
Is your feature request related to a problem? Please describe.
Similar to group items, moodlight color, state (and brightness after implemented) should be remembered after reboot / powercycle.
If HA and plate both reboot while the moodlight was turned off, nobody remembers what was the pre-selected moodlight attribute. At HA reboot, the current of moodlight color is read from the plate because HA doesn't keep the color attribute when light is off. If plate also reboots during this time (eg. power outage affecting all devices), nobody remembers what was the pre-selected color.
Describe the solution you'd like
When moodlight
command comes in with color
key, check if moodlight color info is saved to the flash. If moodlight color info in flash is different of what came with the command, write to flash the new color info (save flash writes if every {"state":"true"}
command comes with the same color info every time...)
At boot restore moodlight color info (and state) from flash.
Describe alternatives you've considered
Only this
Additional context
Not applicable
Trying to generate a rectancular color picker, circular appears
{"page":3,"id":4,"obj":"cpicker","x":30,"y":90,"w":180,"h":180,"rect":"true"}
{"page":3,"id":4,"obj":"cpicker","x":30,"y":90,"w":180,"h":180,"rect":1}
results in a circular cpicker
should be rectangular
n/a
cpicker object doesn't always accept the color value
Using v0.4.1.
This example on a Lanbon L8.
Watch MQTT messages with mosquitto_sub.
In HA you are able to turn on backlight color of the plate.
On plate possible to select color and it gets updated accordingly in HA.
But in HA if you start clicking on colors (one color per second), the cpicker doesn't always sync to the color received in MQTT message.
Messages like hasp/plate/command/p7b3.color #ff07e
come correctly each time, but in 20% of the cases cpicker doesn't react to this. Moodlight changes every time correctly.
Every time I select in color dial of HA, the MQTT message appears correctly instructing cpicker to change color, and cpicker should do this immediately.
not applicable
Build for Lanbon L8 fails with:
Error: The program size (1447642 bytes) is greater than maximum allowed (1441792 bytes)
Nevertheless tried to flash to the unit, that didn't produce an error. But the device doesn't boot, only a white screen appears.
platformio_override.ini
where I only uncomment user_setups/esp32/*.ini
and lanbon_l8
pio run 2>&1 | tee build.log
See: build.log
Have a build without errors.
Is your feature request related to a problem? Please describe.
HASwitchPlate/openHASP-custom-component#36
Describe the solution you'd like
Reduce colorpicker value updates: update event handler like we did with sliders issue #88 and PR #111
Describe alternatives you've considered
n/a
Additional context
video
Colorpicker:
p2b6 => {"event":"down","color":"#8300ff","r":131,"g":0,"b":255}
p2b6 => {"event":"changed","color":"#7300ff","r":115,"g":0,"b":255}
p2b6 => {"event":"changed","color":"#6200ff","r":98,"g":0,"b":255}
p2b6 => {"event":"up","color":"#6200ff","r":98,"g":0,"b":255}
Currently slider
(+double slider) and arc
(adjustable) only support integer values (int16
) for min
, max
and val
.
Would be useful (for a thermostat control for example) to use decimals too. Perhaps float16
(if supported) would be enough for this. A new property precision
would be required to set precision of the adjustable objects:
0
(default) for no decimal (would behave just like now)1
for one decimal .1
-> .9
2
for two decimals .01
-> .99
First off, I came across this today as I was looking for a way to turn a WT32-SC01 into a thermostat to integrate into homeassistant. This project is fantastic, thank you for it.
Setting the orientation to anything other than 0 rotates the display but the touch is still detected in the 0 degree orientation.
Confirmed to be consistent at 90, 180, and 270 degree rotation.
Touch follows rotation setting the same as display.
Version tested on: v0.3.2
Device: lanbon l8
I recently tried to load fontawesome into my device but I have had very little success in getting it to work. Do I also need custom fonts in order for fontawesome to load?
x
Jan 17 04:52:24 lanbon ATTR #033[91m[81008/127792 36]#033[91m[ 644/ 776 18].value_str (1091) x
Jan 17 04:52:24 lanbon LVGL #033[91m[81008/127872 36]#033[91m[ 200/ 544 64]Couldn't allocate memory x
Jan 17 04:52:24 lanbon LVGL #033[91m[81008/127872 36]#033[91m[ 200/ 544 64]Couldn't allocate memory x
Jan 17 04:52:24 lanbon LVGL #033[91m[81008/127872 36]#033[91m[ 200/ 544 64]_lv_mem_buf_get x
Jan 17 04:52:24 lanbon LVGL #033[91m[81008/127872 36]#033[91m[ 200/ 544 64]Out of memory, can't allocate a new buffer (increase your LV_MEM_SIZE/heap size (0x00000000)
uptime {"status":"available","version":"0.3.1","uptime":286973,...
As mentioned those sequenced steps in Getting Started in Wiki the https://github.com/fvanroie/hasp-lvgl/wiki/Getting-Started, only MQTT Client is Connected then the lvgl will response to touch event (see void haspReconnect() function for the detail).
I use a Lanbon L8 with the Firmware lanbon_l8_full_8MB_v0.5.0.bin.
My Demo pages.jsonl is:
{"page":1,"comment":"---------- Page 1 ----------"}
{"obj":"btn","id":1,"x":10,"y":45,"w":220,"h":55,"toggle":true,"text":"Push Me \uf0a6"}
{"obj":"cb","id":2,"x":10,"y":100,"w":220,"h":55,"text":"A Checkbox"}
{"obj":"label","id":3,"x":10,"y":10,"w":220,"h":30,"text":"My Label","align":1,"padh":50}
{"obj":"switch","id":4,"x":70,"y":205,"w":100,"h":55}
{"obj":"led","id":5,"x":10,"y":205,"w":55,"h":55}
{"obj":"dropdown","id":6,"x":10,"y":150,"w":150,"options":"\uf007 Line 1\n\uf007 Line 2\n\uf007 Line 3"}
{"obj":"spinner","id":7,"x":165,"y":140,"w":70,"h":70}
{"page":2,"comment":"---------- Page 2 ----------"}
{"obj":"slider","id":1,"x":10,"y":170,"w":200,"h":50}
{"obj":"gauge","id":3,"x":13,"y":10,"w":100,"h":100}
{"obj":"bar","id":4,"x":10,"y":110,"w":200,"h":50}
{"obj":"lmeter","id":5,"x":127,"y":10,"w":100,"h":100}
{"obj":"label","id":10,"x":0,"y":0,"w":70,"h":50,"parentid":5,"text":"\uf00c OK"}
{"comment":"---------- Page 3 ----------"}
{"obj":"cpicker","id":1,"page":3,"x":20,"y":0,"w":200,"h":200}
{"obj":"cpicker","id":2,"page":3,"x":20,"y":210,"w":200,"h":50,"rect":true}
{"page":4,"comment":"---------- Page 4 ----------"}
{"obj":"dropdown","id":1,"x":10,"y":10,"w":220,"options":"Spring\nSummer\nAutumn\nWinter"}
{"obj":"roller","id":2,"x":40,"y":50,"w":160,"rows":3,"options":"2020\n2021\n2022\n2023\n2024"}
{"page":0,"id":1,"obj":"btn","action":"prev","x":0,"y":290,"w":79,"h":32,"bg_color":"#2C3E50","text":"\uE141","text_color":"#FFFFFF","radius":0,"border_side":0,"text_font":28}
{"page":0,"id":2,"obj":"btn","action":"back","x":80,"y":290,"w":80,"h":32,"bg_color":"#2C3E50","text":"\uE2DC","text_color":"#FFFFFF","radius":0,"border_side":0,"text_font":22}
{"page":0,"id":3,"obj":"btn","action":"next","x":161,"y":290,"w":79,"h":32,"bg_color":"#2C3E50","text":"\uE142","text_color":"#FFFFFF","radius":0,"border_side":0,"text_font":28}
Iobroker dont show events or values from slider,switch,dropdown,togglebutton
When i use the MQTT-Explorer, i can see a value receive from the Objects, but without events .
But when i use Openhab, i receive a correct event with value
The Mqtt-Explorer receive a correct event and value too with openhab
What the problem with Iobroker???
Thanks!!!
Less of an issue but more of a question.
I see in your project listing the items you'd like to add of which a few I've got working in a fork.
Are you open to pull requests for those?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.