Commit Graph

3046 Commits

Author SHA1 Message Date
Maxim Prokhorov
f5940b7083 webui: rework initialization for relay and scheduler
Send out keys as schema, fill given template based on the 4 common input types.
Also, refactor relayLastSch into schRestore and move into the schedule template.

Moving relayCount to a wide int, this will probably not build...
2021-03-31 09:41:04 +03:00
Maxim Prokhorov
04569c6a10 relay: stable configuration IDs
Custom provider cannot 'shadow' the relays from the config.
e.g. lights will use the id=0 when relay control is enabled, and
we should not use relayGpio0, relayPulse0, relayBoot0 and etc.
2021-03-31 09:41:04 +03:00
Maxim Prokhorov
14c69a4a52 webui: get rid of tabindex completely
Prefer tabindex=-1 to ignore elements instead of listing them
explicitly, as browsers already handle that based on what is visible
2021-03-31 09:41:04 +03:00
Maxim Prokhorov
d60fb47ca9 webui: external url clean-up
- .js injects both target and rel when class=external
- also inject tabindex so that TAB skips those links
2021-03-31 09:41:04 +03:00
Maxim Prokhorov
1627e3119f webui: remove hard-coded group key list
Custom attribute for key inputs to send them as lists.
Template proxy function to make sure we don't have to type that out each time.
2021-03-31 09:41:04 +03:00
Maxim Prokhorov
458fb7d936 webui: send alert messages directly 2021-03-31 09:41:04 +03:00
Maxim Prokhorov
dcc423ecaf relay: mqtt events and group topics refactoring
- fix relay-id check breaking group topics
- group -> pub and sub topics
- wildcard in subscription topic will be properly handled
- make sure on disconnect event only triggers when mqtt is changing
state from connected to disconnected, don't trigger every failed re-try
- replace receive-only mode with separate sub and pub topics
- some more build time settings (and some... questionable code to handle that)
2021-03-31 09:41:04 +03:00
Maxim Prokhorov
cab98cfd8e mqtt: fix relay dependency and some comments
Plus, heartbeat will send this regardless

For the clean session stuff... when changing configuration of something like RPN,
the old subscription never goes away and we also receive old messages when QoS > 0 is used

Pending changes in the MQTT client(s) to make this work more reliably
2021-03-31 09:41:03 +03:00
Maxim Prokhorov
06c9b4947b ha: call stop() when out of retries
Also, more logging
2021-03-31 09:41:03 +03:00
Maxim Prokhorov
4854f91b3d api: allow to use path helper without api enabled 2021-03-31 09:41:03 +03:00
Maxim Prokhorov
39c08fc1e5 api: fix parsing of values after a wildcard 2021-03-31 09:41:03 +03:00
Rui Marinho
bfa704c2fd sns: remove need to patch bme680 static library (#2429)
Upstream released a version of their proprietary library which does not require any modification to the linker script.
2021-03-31 08:48:09 +03:00
DmitryBlinov
acfead4229 garland: add waves animation (#2430)
* Add anim_waves

* Minor fixes

Co-authored-by: Dmitry Blinov <dblinov@blackberry.com>
2021-03-30 16:36:59 +03:00
Maxim Prokhorov
f013e04e22 lights: make sure channel target stays consistent
Make gamma & invert flags only apply to the transition itself.
Revert to previous behaviour, where the modified value is only ever seen
by the provider function.
2021-02-26 23:33:32 +03:00
Maxim Prokhorov
707d0f0ea2 lights: update webui 2021-02-26 18:44:12 +03:00
Maxim Prokhorov
f9cbd507de mqtt: cancel heartbeat when disconnected 2021-02-26 18:44:12 +03:00
Maxim Prokhorov
1a5f95c02e lights: more color refactoring
- clamp values via helper functions
- unify channel access as long
  slightly more ram, but we no longer cast values that are 32bit-wide anyway
- remove css option, send unconditionally as /hex
- reimplement hsv conversion functions (based on HA / python's colorsys)
  simplify calculations and allow to return standalone value structs for
  RGB and HSV
- named channel accessors
- implement HA color inputs / outputs
2021-02-26 18:44:12 +03:00
Maxim Prokhorov
2a08ccb211 tuya: always run the discovery
ref. https://github.com/xoseperez/espurna/issues/2422#issuecomment-786242302
2021-02-26 18:34:47 +03:00
Maxim Prokhorov
65c8db72fb lights: fix rtcmem implementation shifts
ref. https://github.com/xoseperez/espurna/issues/2422#issuecomment-786171934

stop including mireds into the brightness when unpacking uint64 value
clamp brightness via the helper function
2021-02-26 18:34:06 +03:00
Maxim Prokhorov
59269789dc mqtt: improve qos support an additional callbacks
- return PID when sending and subscribing, allow to subscribe
to a special event when receiving acknowledgement from the broker
(separate from normal lifecycle callback, since we allow a generic callable)
- rework HomeAssistant to publish with QoS 1 and wait until the broker responds.
lwmqtt sync library already did that, so this change only affects async library
- re-add `ha.send` command
- don't send HomeAssistant config when disabled, unless requested
- some more comments
2021-02-26 18:19:17 +03:00
Maxim Prokhorov
33f6f2b124 hass: remove pointless check for buffer size 2021-02-26 18:19:12 +03:00
Maxim Prokhorov
16b3f16902 garland: clean-up whitespace 2021-02-26 16:55:50 +03:00
DmitryBlinov
46daa929f5 garland: add anim_fountain 2021-02-26 16:52:38 +03:00
DmitryBlinov
a79c7c4e95 ntp: timelib header is no longer included by default 2021-02-26 16:52:34 +03:00
DmitryBlinov
d11f82d098 garland: update documentation
- instructions for mqtt commands in the source
- update README
2021-02-26 16:52:31 +03:00
DmitryBlinov
4923377eac garland: animation improvements
- add hidden animation Glow for one color glowing
- implement one color Palette for mqtt controlled animation.
2021-02-26 16:52:27 +03:00
DmitryBlinov
6508f6bda8 garland: implement command sequence 2021-02-26 16:52:23 +03:00
DmitryBlinov
24550a5b80 garland: implement commands queue 2021-02-26 16:52:19 +03:00
DmitryBlinov
4efc417a39 garland: more mqtt improvements
implement mqtt command "reset" that set default params and enabled garland
2021-02-26 16:52:15 +03:00
DmitryBlinov
f640cd8ecb garland: control parameters through mqtt 2021-02-26 16:52:10 +03:00
DmitryBlinov
518d56b442 garland: mqtt support 2021-02-26 16:52:06 +03:00
DmitryBlinov
0f73df7c36 garland: set animation interval from 7 to 12 sec 2021-02-26 16:52:03 +03:00
DmitryBlinov
3fe6874863 garland: improve anim_assemble 2021-02-26 16:51:57 +03:00
DmitryBlinov
dad8878ccf garland: disable software watchdog
prevent Soft WDT exception with long strips
2021-02-26 16:51:53 +03:00
DmitryBlinov
660ae138d4 garland: fix Stars animation with more than 255 leds 2021-02-26 16:51:20 +03:00
Maxim Prokhorov
7434ea3878 lights: finish up provider settings
get rid of LIGHT_CHANNELS, but keep channel setting for the my92xx
also clean up recent changes, channel command did not actually work
2021-02-10 20:05:13 +03:00
Maxim Prokhorov
00b470bc83 lights: always check for transformation flags
amend bdbd127bfb
2021-02-09 23:50:10 +03:00
Maxim Prokhorov
009021118b lights: fix my92xx build 2021-02-09 22:17:41 +03:00
Maxim Prokhorov
bdbd127bfb lights: handle value transformations in the transition 2021-02-09 22:06:41 +03:00
Maxim Prokhorov
ec5311c850 lights: terminal output specific values 2021-02-09 21:36:01 +03:00
Maxim Prokhorov
f6527e4325 lights: fix channel description, remove tags table from globals 2021-02-09 13:49:34 +03:00
Maxim Prokhorov
489813864e lights: match original rtcmem union layout 2021-02-09 13:48:47 +03:00
Maxim Prokhorov
ecaa5fa457 lights: explain the brightness stub and fix the gcc-4.8.2 build 2021-02-09 12:26:20 +03:00
Maxim Prokhorov
5c620723dd lights: one more try at fixing the boot sequence
Make sure 'custom provider' `lightAdd()` scheduled function locks further channel modifications,
and take care of light sanity checks before the light update is even scheduled.

Reworked rtcmem reader / writer to use default values, instead of accidentaly using
the unitialized mem of the stack. Also, reworked const names used by the lights module
to distinguish them from the build flags.
2021-02-08 21:39:46 +03:00
Maxim Prokhorov
af4477999d lights: allow to trigger an update when brightness is 0 2021-02-06 08:37:09 +03:00
Maxim Prokhorov
012c3818a5 tuya: send channel value directly 2021-02-06 05:53:52 +03:00
Maxim Prokhorov
b35a565126 lights: fix changing channel value while state is the same 2021-02-06 05:53:31 +03:00
Maxim Prokhorov
0f723b0248 settings: handle old keys in the respective modules
fixes #2419
2021-02-06 04:44:26 +03:00
Maxim Prokhorov
12747bf8ce lights: fix inconsistent code generation with gcc-4.8.2
Make sure transition is always pushed into the vector the same way

Only happens with ESPURNA_BUILD_SINGLE_SOURCE=1:

/home/runner/.platformio/packages/toolchain-xtensa/xtensa-lx106-elf/include/c++/4.8.2/bits/vector.tcc:405:31: error: __c causes a section type conflict with __c
    _M_check_len(size_type(1), __EXCSTR("vector::_M_emplace_back_aux"));
                               ^
/home/runner/.platformio/packages/toolchain-xtensa/xtensa-lx106-elf/include/c++/4.8.2/bits/vector.tcc:71:23: note: '__c' was declared here
  __throw_length_error(__EXCSTR(__N("vector::reserve")));
2021-02-06 04:44:25 +03:00
Maxim Prokhorov
b3d9168b4a pio: bump to espressif8266 @ 2.6.3 2021-02-06 04:44:25 +03:00