mirror of
https://github.com/HASwitchPlate/openHASP.git
synced 2025-07-26 20:56:37 +00:00
add active page mqtt number entity
This commit is contained in:
parent
7676fa3d0f
commit
b3ae2a64f0
141
platformio_override copy.ini
Normal file
141
platformio_override copy.ini
Normal file
@ -0,0 +1,141 @@
|
|||||||
|
; USAGE: Copy this file and rename it to platformio_override.ini
|
||||||
|
;
|
||||||
|
; The platformio_override.ini file is not overwritten or monitored by git
|
||||||
|
; ONLY edit platformio_override.ini to make local changes to the parameters
|
||||||
|
|
||||||
|
[platformio]
|
||||||
|
extra_configs =
|
||||||
|
; Uncomment or edit the lines to show more User Setups in the PIO sidebar
|
||||||
|
user_setups/esp32/*.ini
|
||||||
|
; user_setups/esp8266/*.ini
|
||||||
|
; user_setups/stm32f4xx/*.ini
|
||||||
|
|
||||||
|
[override]
|
||||||
|
; -- Hasp config options --------------------------------------
|
||||||
|
build_flags =
|
||||||
|
; -- Uncomment the next line to use the file src/user_config_override.h settings
|
||||||
|
-DUSE_CONFIG_OVERRIDE
|
||||||
|
;region -- Default Build Environments : Used when Build All ---
|
||||||
|
extra_default_envs =
|
||||||
|
; Comment unneeded environments or create extra
|
||||||
|
; d1-mini-esp32_ili9341
|
||||||
|
; d1-mini-esp8266_ili9341
|
||||||
|
; lolind32pro-lolintft24
|
||||||
|
; esp32dev-mrb3511
|
||||||
|
; esp12e-st7735
|
||||||
|
; d132-unoshield
|
||||||
|
; nodemcu32s-raspi
|
||||||
|
; esp32dev-ili9488
|
||||||
|
lanbon_l8
|
||||||
|
; wt32-sc01
|
||||||
|
; esp32_ili9341_spi
|
||||||
|
; my_custom_build
|
||||||
|
;endregion
|
||||||
|
|
||||||
|
;region -- Define your local COM ports for each environment ---
|
||||||
|
[env:d1-mini-esp32_ili9341]
|
||||||
|
monitor_port = COM6 ; Change to the correct port
|
||||||
|
upload_port = ${env:d1-mini-esp32_ili9341.monitor_port}
|
||||||
|
|
||||||
|
[env:d1-mini-esp8266_ili9341]
|
||||||
|
monitor_port = COM4 ; Change to the correct port
|
||||||
|
upload_port = ${env:d1-mini-esp8266_ili9341.monitor_port}
|
||||||
|
|
||||||
|
[env:esp32dev-mrb3511]
|
||||||
|
monitor_port = COM3 ; Change to the correct port
|
||||||
|
upload_port = ${env:esp32dev-mrb3511.monitor_port}
|
||||||
|
|
||||||
|
[env:d132-unoshield]
|
||||||
|
monitor_port = COM9 ; Change to the correct port
|
||||||
|
;upload_port = ${$env:d132-unoshield.monitor_port}
|
||||||
|
upload_port = 192.168.4.4 ; IP of the ESP
|
||||||
|
upload_protocol = espota ; Use ArduinoOTA after flashing over serial
|
||||||
|
upload_flags = --port=3232 ; --auth=haspadmin ; OTA password
|
||||||
|
|
||||||
|
[env:ttgo_esp32_poe-lolintft24]
|
||||||
|
monitor_port = COM9 ; Change to the correct port
|
||||||
|
;upload_port = ${env:ttgo_esp32_poe-lolintft24.monitor_port}
|
||||||
|
upload_port = 192.168.4.5 ; IP of the ESP
|
||||||
|
upload_protocol = espota ; Use ArduinoOTA after flashing over serial
|
||||||
|
upload_flags = --port=3232 ; --auth=haspadmin ; OTA password
|
||||||
|
|
||||||
|
[env:lolind32pro-lolintft24]
|
||||||
|
monitor_port = COM3 ; Change to the correct port
|
||||||
|
upload_port = ${env:lolind32pro-lolintft24.monitor_port}
|
||||||
|
|
||||||
|
[env:lanbon_l8]
|
||||||
|
monitor_port = COM10 ; Change to the correct port
|
||||||
|
upload_port = ${env:lanbon_l8.monitor_port}
|
||||||
|
|
||||||
|
[env:wt32-sc01]
|
||||||
|
monitor_port = COM3 ; Change to the correct port
|
||||||
|
upload_port = COM3
|
||||||
|
;endregion
|
||||||
|
|
||||||
|
;region -- Custom Environment configuration example -----------------
|
||||||
|
[env:my_custom_build]
|
||||||
|
platform = espressif32
|
||||||
|
board = nodemcu-32s
|
||||||
|
monitor_port = COM3
|
||||||
|
upload_port = ${env:my_custom_build.monitor_port}
|
||||||
|
debug_tool = esp-prog
|
||||||
|
debug_init_break = tbreak setup
|
||||||
|
build_flags =
|
||||||
|
${esp32.build_flags}
|
||||||
|
;region -- TFT_eSPI build options -----------------------------------
|
||||||
|
${lcd.raspberrypi}
|
||||||
|
${esp32.vspi}
|
||||||
|
-D TFT_CS=5
|
||||||
|
-D TFT_DC=4
|
||||||
|
-D TFT_RST=32
|
||||||
|
-D TFT_BCKL=-1 ; None, configurable via web UI (e.g. 21)
|
||||||
|
-D TOUCH_CS=22
|
||||||
|
;endregion
|
||||||
|
|
||||||
|
;-- ILI9341 SPI version ------------------------
|
||||||
|
[env:esp32_ili9341_spi]
|
||||||
|
platform = espressif32
|
||||||
|
platform_packages = framework-arduinoespressif32
|
||||||
|
framework = arduino
|
||||||
|
board = esp32dev
|
||||||
|
monitor_port = COM4
|
||||||
|
upload_port = ${env:esp32_ili9341_spi.monitor_port}
|
||||||
|
monitor_filters = esp32_exception_decoder
|
||||||
|
board_build.partitions = user_setups/esp32_partition_app1300k_spiffs1216k.csv
|
||||||
|
|
||||||
|
build_flags =
|
||||||
|
${env.build_flags}
|
||||||
|
${esp32.build_flags}
|
||||||
|
-D ILI9341_DRIVER=1
|
||||||
|
-D TFT_WIDTH=240
|
||||||
|
-D TFT_HEIGHT=320
|
||||||
|
-D TFT_ROTATION=0 ; see TFT_ROTATION values
|
||||||
|
-D INVERT_COLORS=1 ; to fix colors
|
||||||
|
-D SPI_FREQUENCY=60000000
|
||||||
|
-D SPI_TOUCH_FREQUENCY=2500000
|
||||||
|
-D SPI_READ_FREQUENCY=20000000
|
||||||
|
-D USER_SETUP_LOADED=1
|
||||||
|
-D TOUCH_DRIVER=2046 ; XPT2046 Resistive SPI touch panel driver
|
||||||
|
-D SUPPORT_TRANSACTIONS
|
||||||
|
${esp32.vspi} ; Use VSPI hardware SPI bus:
|
||||||
|
; TFT_MISO=19 | TFT_MOSI=23 | TFT_SCLK=18
|
||||||
|
; MISO = 8 | MOSI = 4 | CLK = 3
|
||||||
|
; wiring recommendations, change pins according to your wiring
|
||||||
|
-D TFT_DC=5 ; DC, lcd pin 3
|
||||||
|
-D TFT_RST=15 ; RES, lcd pin 5
|
||||||
|
-D TFT_BCKL=-1 ; BLK, lcd pin 7 (configurable via web UI (e.g. 21))
|
||||||
|
-D TFT_CS=26 ; CS1, lcd pin 9
|
||||||
|
-D TOUCH_CS=22 ; CS2, lcd pin 10
|
||||||
|
|
||||||
|
lib_deps =
|
||||||
|
${env.lib_deps}
|
||||||
|
${esp32.lib_deps}
|
||||||
|
|
||||||
|
lib_ignore =
|
||||||
|
${env.lib_ignore}
|
||||||
|
${esp32.lib_ignore}
|
||||||
|
|
||||||
|
extra_scripts =
|
||||||
|
${env.extra_scripts}
|
||||||
|
${esp32.extra_scripts}
|
||||||
|
;endregion
|
@ -226,8 +226,30 @@ void mqtt_ha_register_idle()
|
|||||||
mqtt_ha_send_json(buffer, doc);
|
mqtt_ha_send_json(buffer, doc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void mqtt_ha_register_activepage()
|
||||||
|
{
|
||||||
|
char buffer[128];
|
||||||
|
DynamicJsonDocument doc(640);
|
||||||
|
mqtt_ha_add_device(doc);
|
||||||
|
|
||||||
|
snprintf_P(buffer, sizeof(buffer), PSTR("%s HASP active page"), mqttNodeName);
|
||||||
|
doc[F("name")] = buffer;
|
||||||
|
|
||||||
|
doc[F("cmd_t")] = F("~command/page");
|
||||||
|
doc[F("stat_t")] = F("~state/page");
|
||||||
|
doc[F("avty_t")] = F("~LWT");
|
||||||
|
|
||||||
|
snprintf_P(buffer, sizeof(buffer), PSTR("%s_hasp_activepage"), halGetMacAddress(0, "").c_str(), mqttNodeName);
|
||||||
|
doc[F("uniq_id")] = buffer;
|
||||||
|
|
||||||
|
snprintf_P(buffer, sizeof(buffer), PSTR("%s/number/%s/activepage/config"), discovery_prefix, mqttNodeName);
|
||||||
|
|
||||||
|
mqtt_ha_send_json(buffer, doc);
|
||||||
|
}
|
||||||
|
|
||||||
void mqtt_ha_send_backlight()
|
void mqtt_ha_send_backlight()
|
||||||
{
|
{
|
||||||
|
mqtt_ha_register_activepage();
|
||||||
mqtt_ha_register_button(0, 1);
|
mqtt_ha_register_button(0, 1);
|
||||||
mqtt_ha_register_button(0, 2);
|
mqtt_ha_register_button(0, 2);
|
||||||
mqtt_ha_register_backlight();
|
mqtt_ha_register_backlight();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user