Commit Graph

2957 Commits

Author SHA1 Message Date
Maxim Prokhorov
8e659c9486 relay: type is always valid
resolve #2416
2021-01-17 12:11:41 +03:00
Maxim Prokhorov
ca15752f3b pio: fixup generic build 2021-01-16 20:41:08 +03:00
Maxim Prokhorov
8df23392a9 webui: clean-up cfd6e36dbe
update to terser v5
replace gulp-remove-code with a rough equivalent in the gulpscript itself
replace gulp-inline with gulp-inline-source-html
remove base64 modules as redundant when running inline-source (does both)
remove crass as redundant when running inline-source (uses csso)
fixup jquery source map comment (but still keep the actual file)

at least now this seems stable enough to start more of the ui tweaking
2021-01-16 20:40:23 +03:00
Maxim Prokhorov
e7f97c09e4 webui: some more version bumps
pure-css 1.0.0 -> 2.0.3
datatable 1.10.16 -> 1.10.23
generic jquery-slim -> custom jquery/jquery@a32cf6324f slim build with an addition of -sizzle

does not seem to be breaking anything (yet)
2021-01-15 23:54:16 +03:00
Maxim Prokhorov
df24cf0036 webui: fix missing files and bump jquery 2021-01-15 23:18:15 +03:00
Maxim Prokhorov
3e0291e534 webui: bump old deps 2021-01-15 23:06:19 +03:00
Maxim Prokhorov
c6e2dbbc5a webui: show the actual error when compressJs fails
note that this does not show the correct error line b/c we filter this
through the remover() first
2021-01-15 22:46:55 +03:00
Maxim Prokhorov
808981ca39 webui: update colorpicker
ref. https://github.com/xoseperez/espurna/issues/1132#issuecomment-431868924
it is slightly bigger, but better looking and no jquery dependency

rework colorpicker style as well, hide to prevent sending garbage when
lights are off. update lights module to send `lightState()` and separate
state from status payloads

yes, input[type="color"] is an option, but it does not look good
2021-01-15 22:46:55 +03:00
Maxim Prokhorov
cfd6e36dbe webui: use terser as js minifier
support es6 syntax
use js comment style in custom.js
only minify the custom.js

using 4.x branch, since 5.x wants async / await and more changes to the gulp script
2021-01-15 22:45:44 +03:00
Maxim Prokhorov
3a34d555d5 ci: don't mention travis 2021-01-14 18:11:14 +03:00
Maxim Prokhorov
252b98e0f7 utils: make version string parsable by semver utils 2021-01-14 17:22:27 +03:00
Maxim Prokhorov
df0f1a2e19 ifan: make sure pin is initialized 2021-01-14 16:59:17 +03:00
Maxim Prokhorov
2223184c25 ifan: more fixes, clean-up relays 2021-01-14 16:51:16 +03:00
Maxim Prokhorov
ef194c9c24 button: custom action + ifan fixes 2021-01-14 15:24:08 +03:00
Maxim Prokhorov
a40eca30ad ifan: refactor into a separate module 2021-01-14 14:10:45 +03:00
Max Prokhorov
8ceeebdb24 providers: relays, lights and buttons refactoring (#2414)
- gpio module now tracks the known providers (right now, hardware and mcp expander)
- refactored relay struct to use 'Provider' implementing setup,notify,change,boot instead of just BasePin actions
- refactored button module to use gpio provider instead of referencing types itself
- removed dual & stm code from buttons, migrate both to relay module
- added status notify and change callbacks for relayStatus (i.e. 'notify' when relay status was called, but not changed. and 'changed' when it did)  
- relays runtime configuration keys
- relay command now shows configured relays and current & target statuses
- refactor the code using relayStatus(0, blah) under LIGHT_PROVIDER check to use lightState instead
- remove rfbridge code form relay module. implement through a basic state listener in the rfbridge module, depend on RELAY_SUPPORT
- allow to bind rf codes to real relays
- drop tuya-specific lights provider, remove tuya code from relays and lights modules
- integrate tuya via relay listeners and providers, use lights custom provider
- implement channel transitions for tuya. disabled by default, and transition time and step are overridden to 2000 + 100. needs to be set to some value below the total time (i.e. `total transition time / step time == number of steps`, we need to figure out a correct time that serial comms could handle)
- lights custom provider (global, not per-pin) and state listeners
- remove lights code from relay module. implement through providers & listeners in the lights module, depend on RELAY_SUPPORT
- lights per-channel relay provider (unused atm), depend on RELAY_SUPPORT
- refactored channel transition - calculate step only once, make sure time + step values are sane, generate quick transitions with very small delay (10ms hardcoded) for transitions during OFF state i.e. we no longer waste 500ms (or whatever transition time is set to) on boot doing nothing
- transition time + step parameter for the lightUpdate
- report mask parameter for the lightUpdate
- minor fixes across the board

resolve #2222
2021-01-14 10:39:18 +03:00
DmitryBlinov
c1243fda31 garland: updates (#2412)
- Update README.md - add garland description
- Add new animation - Dolphins
2021-01-14 10:36:32 +03:00
Maxim Prokhorov
2a2650f769 webui: fit title on one line 2021-01-04 06:27:03 +03:00
Maxim Prokhorov
29caf0036d wifi: yield after disconnecting 2021-01-04 06:25:44 +03:00
Maxim Prokhorov
f0f6f1b8c9 utils: simplify version + revision into just version 2021-01-04 06:05:04 +03:00
Maxim Prokhorov
3ba6011d49 ntp: fix build when ntp is disabled 2021-01-04 05:23:06 +03:00
Maxim Prokhorov
83edf629cc ntp: simplify uptime info, drop legacy timelib funcs & consts 2021-01-04 05:18:24 +03:00
Maxim Prokhorov
c100696f7b ws: correctly send 64bit time_t to the webui 2021-01-04 05:07:25 +03:00
Maxim Prokhorov
d04b85ac97 domoticz: send co2 ppm as nvalue
ref. https://gitter.im/tinkerman-cat/espurna?at=5ff1f6934eba353cdf164311
tnx @w00ty
2021-01-04 05:02:28 +03:00
Maxim Prokhorov
e7d92369fb pio: notice about macOS big sur 2021-01-04 05:01:14 +03:00
Maxim Prokhorov
d1916014c3 pio: git toolchain version bump
see https://github.com/esp8266/Arduino/issues/7792#issuecomment-750861423
2021-01-04 05:01:03 +03:00
Maxim Prokhorov
f11468abba ci: github actions
- remove .travis.yml
- ./travis_{script,install}.sh -> ./ci_{script,install}.sh
- flush stdout in test script to see logs more promptly
- adjust git config to ignore 'detachedHead' warnings
2020-12-30 22:44:28 +03:00
Maxim Prokhorov
15e3806b28 libs: renormalize line endings
Garland merge updated .gitattributes, fixup the difference before
merging anything else :>
2020-12-30 21:49:17 +03:00
DmitryBlinov
5aeb24f263 garland: new module (#2408)
Port of https://github.com/Vasil-Pahomov/ArWs2812 from Arduino to ESP8266
Implementing garland of WS2812

Co-authored-by: Dmitry Blinov <dblinov@blackberry.com>
2020-12-24 17:44:59 +03:00
Maxim Prokhorov
f166f6c792 sns: fix typo 2020-12-24 17:28:25 +03:00
Maxim Prokhorov
54f51ad2cd sns: more lenient eneTotal parser 2020-12-24 16:21:20 +03:00
Maxim Prokhorov
cd96f1ca6d sns: load energy from settings unconditionally
fixes #2407
avoid depending on other settings

technically, it could be another block in the snsConfigure for
magnitudes, however it also should be a new type of one-shot logic
2020-12-24 16:21:20 +03:00
Maxim Prokhorov
227d3e6620 api: allow to handle the request only once 2020-12-24 16:21:20 +03:00
Maxim Prokhorov
b0fb6b9851 api: make sure to return when GET response is done
calling request->send() multiple times does not work as expected
2020-12-24 16:21:20 +03:00
m-kozlowski
51ad030adf alexa: bump fauxmoesp to 3.1.2
As of October 2020, this project is now being maintained at https://github.com/vintlabs/fauxmoESP

Co-authored-by: mkozlowski <gitcmt@empeka.pl>
2020-12-22 15:05:05 +03:00
Maxim Prokhorov
1ed5f43980 btn: switches toggle again
- revert hardware.h changes from f497312f29 to
avoid changing existing devices.
- update hardware.h comments related to the _CONFIG and actions
2020-12-15 01:28:33 +03:00
Maxim Prokhorov
3287dbcee7 pio: small helper to use libdeps installer 2020-12-15 01:02:45 +03:00
Maxim Prokhorov
e0e5377da7 terminal: small workaround for _tempObject from API
Exchange sneaky memory leak with a squeaky wheel...
Web server will immediatly delete the request object, so not really much
point in tracking the pointer via some external means.
2020-12-06 00:33:40 +03:00
Maxim Prokhorov
cb4c1a12ff sns: log typo 2020-12-06 00:13:20 +03:00
Maxim Prokhorov
5fdbd1df5b terminal: both API implementations to use line param instead of value 2020-12-06 00:13:09 +03:00
Maxim Prokhorov
e6dc5051ba test: update terminal strings 2020-12-05 22:03:32 +03:00
Maxim Prokhorov
9f24e6a325 terminal: make sure API is loaded after the web server
New apiRegister depends on `webServer()` returning a valid object.
2020-12-05 20:32:28 +03:00
Maxim Prokhorov
9aa0bdfe0e terminal: enforce F(...) as commands
- store name+callback pairs in list instead of a hash map
  remove vector reserve() overhead
- rework callbacks to expect flash strings
- comments...

Small difference is that now there's no way to know if command already
exists. Meaning, while we do override the existing callback, comman
names list will have more than one entry.

Flash strings are quite weird. In case we finally get all `const char*`s
in PROGMEM (which is the case for ESP32?), this could use a comment-proposed
method of having handlers per-module instead of handlers per-command.
2020-12-05 20:31:55 +03:00
Max Prokhorov
8e80a7786c api: rework plain and JSON implementations (#2405)
- match paths through a custom AsyncWebHandler instead of using generic not-found fallback handler
- allow MQTT-like patterns when registering paths (`simple/path`, `path/+/something`, `path/#`)
Replaces `relay/0`, `relay/1` etc. with `relay/+`. Magnitudes are plain paths, but using `/+` in case there's more than 1 magnitude of the same type.
- restore `std::function` as callback container (no more single-byte arg nonsense). Still, limit to 1 type per handler type
- adds JSON handlers which will receive JsonObject root as both input and output. Same logic as plain - GET returns resource data, PUT updates it.
- breaking change to `apiAuthenticate(request)`, it no longer will do `request->send(403)` and expect this to be handled externally.
- allow `Api-Key` header containing the key, works for both GET & PUT plain requests. The only way to set apikey for JSON.
- add `ApiRequest::param` to retrieve both GET and PUT params (aka args), remove ApiBuffer
- remove `API_BUFFER_SIZE`. Allow custom form-data key=value pairs for requests, allow to send basic `String`.
- add `API_JSON_BUFFER_SIZE` for the JSON buffer (both input and output)
- `/apis` replaced with `/api/list`, no longer uses custom handler and is an `apiRegister` callback
- `/api/rpc` custom handler replaced with an `apiRegister` callback

WIP further down:
- no more `webLog` for API requests, unless `webAccessLog` / `WEB_ACCESS_LOG` is set to `1`. This also needs to happen to the other handlers. 
- migrate to ArduinoJson v6, since it become apparent it is actually a good upgrade :)
- actually make use of JSON endpoints more, right now it's just existing GET for sensors and relays
- fork ESPAsyncWebServer to cleanup path parsing and temporary objects attached to the request (also, fix things a lot of things based on PRs there...)
2020-12-05 14:14:38 +03:00
Maxim Prokhorov
850db61b76 pio: filter single-source files by absolute path
Specifically, this will break RFM69_SUPPORT on case insensitive
filesystems due to the RFM69.cpp from the RFM69 lib being ignored
when adding ESPurna's rfm69.cpp
2020-11-16 10:52:54 +03:00
Maxim Prokhorov
12ae9d15be sns/hlw8012: default ratios at compile time 2020-11-16 03:32:26 +03:00
Maxim Prokhorov
99cb8e0094 hw: restore sonoff-mini switch actions defaults 2020-11-16 03:31:24 +03:00
Maxim Prokhorov
f497312f29 btn: option to read default value on initialization
- provide a generic way to read default status of the pin after boot
  allows us to use switch as both on and off, independent of the position on boot
- add BUTTON_DEFAULT_LOW & BUTTON_DEFAULT_BOOT (now it's not just BUTTON_DEFAULT_HIGH)
  wiki described raw numbers for some reason :/ this will break that
- clean-up 'constexpr const' and 'const' function args, both are redundant
- clean-up debounce event member defaults, put things in the header
2020-11-16 03:31:24 +03:00
Maxim Prokhorov
a62d1cdd13 pio: -latest-base -> -base for envs
Already using the "latest" stable release, no need to split things (at least for now)
2020-11-16 03:25:19 +03:00
Maxim Prokhorov
b24b0a2369 pio: fix git builds & bump current platform
- platform == platform_latest
- mcspr/toolchain-xtensa via https://github.com/platformio/platformio-core/issues/3612

Yet, this does not avoid useless warnings that platform does
not specify platformio/* prefix in the package spec :(

It should be available in the next espressif8266 version:
0859336019
2020-11-16 03:16:09 +03:00