104 Commits

Author SHA1 Message Date
Maxim Prokhorov
bfc716894d webui: scheduler 2024-05-16 01:25:50 +03:00
Maxim Prokhorov
dd6bedeec7 webui: style save button 2024-04-15 01:23:08 +03:00
Maxim Prokhorov
452cd78c41 ha: handle homeassistant/status
birth message should trigger discovery, enabled by default
ref. #1637

clean-up discovery code to properly re-init when something goes wrong
also restore manual discovery trigger from WebUI
2024-03-19 19:51:35 +03:00
Maxim Prokhorov
b5a03dac72 light: experiment with relay state provider
* dynamic relays should not overlap with configuration
* prefer explicit relay configuration vs. dynamic addition

resolve #2568
2023-01-11 05:46:38 +03:00
Maxim Prokhorov
9126a9832b light: cct for rgb, rgbww and ww cases
- revert to ignoring rgb in color+white+cct case by resetting all its
  inputs to minimum and only controlling white channels
- ignore ww and cw in rgb+cct case; use approximated color, thus allowing
  us to set a different 'cold temperature' limit
- fix webui layout rules based on root element class(es) and consistent
  order for our control elements that does not depend on the order in which
  `processData` handles configuration kvs
- internal refactoring to flatten input processing funcs selection
  (to possibly replace our boolean flags with a simple list)
2022-12-01 00:30:26 +03:00
Maxim Prokhorov
4021c4d14d light: hide colorpicker when color is disabled 2022-11-27 03:43:41 +03:00
Maxim Prokhorov
909b2a0786 webui: lights styling through classes 2022-11-25 05:03:29 +03:00
Maxim Prokhorov
f37f380c04 webui: 2nd try at using css for light controls
register channels with their respective tags, instead of using count
both on backend and frontend

revert to useCCT mireds slider rule, disallow white channels with useWhite
2022-11-17 00:54:10 +03:00
Maxim Prokhorov
1be7623143 webui: emon hints visibility through css 2022-11-17 00:54:10 +03:00
Maxim Prokhorov
2a7cabb4d3 light: rework hsv input in webui
* make sure we don't apply hsv and brightnesss, only take hue and saturation
  when calculating inputs. use value as brightness percentage, wrapping
  the original function (which also makes other modules use this codepath)
* deduce interface elements based on both setting and incoming
  properties. wrap everything in {light: ...} in both inputs and
  outputs, alse allow to update multiple properties at the same time
* add light state toggle when special lights relay is not set up
* remove channel, state and brightness elements through css styling
  instead of going to the elements directly. no need to chech whether
  certain elements exist
2022-10-23 03:18:57 +03:00
Maxim Prokhorov
3275f4921f sns: the rest of magnitude settings
As mentioned in the #2491
Hides parent element when these groups are empty
2022-05-06 18:56:54 +03:00
Maxim Prokhorov
28aa9622bb rfbridge: handle rfb{ON,OFF} just like any other setting
removes the extra 'save' button from the ui and the code that handles it
also make sure to use the updated foreach_prefix when looking for the
match in the settings

resolve #2502
2022-02-09 16:00:41 +03:00
Maxim Prokhorov
5c6a6dacfb webui: fix class typos and add more control groups 2022-01-16 03:53:20 +03:00
Maxim Prokhorov
4c178948b5 webui: revamp grid elements
Make more use of control-groups instead of adding a manual alignment
class to each element. Surprisingly, this is slightly larger than the
previous .gz.html output, but not enough to not consider the readability.

Status page updated to take the lengthy hostnames and version strings
into an account, remove those from the sidebar.

Clean-up terminal module. Use the same style for both input and output,
move the terminal handler and debug handler into an appropriate .cpp
2022-01-13 02:16:28 +03:00
Maxim Prokhorov
b5dca42cbc webui: revamp group addition & deletion
Generate explicit events. Don't have a separate group observer that
tracks deletion, but handle it immediately from the 'button' event

Replace kv array with a direct key updates. While the backed part still
must optimize for size, from this side we should operate on keys directly
2022-01-12 17:26:30 +03:00
Maxim Prokhorov
5dd2009214 webui: fix checkbox styling under pure-form
Using a more 'specific' CSS rule to override it's width and height
2021-12-30 02:03:03 +03:00
Maxim Prokhorov
8f7f1c968f sns: unify settings & settings page actions
- remove 'local' index and replace sensor code depending on it with the
  existing 'slot' aka 'magnitude index' used in value() and type()
- common method to store and retrieve ratios for voltage, current,
  active power and energy. default implementation is no-op, sensor
  should implement ratio adjustment & calculations to use 'slot' indexes
- re-implement 'expected' values ui. display the actual ratio values,
  and have a separate page for updating them in a more apparent way
- remove legacy settings that were adjusting expected values
- remove legacy settings that were resetting ratios and analog calibration
- generic webui action caller, add ratios and analog calibration resets

all of 'emon' sensors were updated to utilize the new approach to the
ratio handling. pulsemeter is somewhat an outlier, but it is unclear
whether removing the energy ratio is justified

terminal part was also updated
- implement `expected` command that hooks into the new ratioFromValue
  (and what webui uses to calculate ratios)
- implement `energy` command to list only MAGNITUDE_ENERGY
- remove old pzem004t commands doing ratio reset and total energy count

another global update is related to espurna::duration
- rework module-local heartbeat and led durations into a global
  espurna::duration
- update sensor internals to use specific units instead of multiplying things
  on line-by-line basis. export count() to the api
2021-11-23 02:36:28 +03:00
Maxim Prokhorov
eb59726b4f sns: report both used & supported units to the webui
Generic way to find out which units the magnitude type supports.
Clean-up UI related to temperature, energy and power units.
Resolves #2482

Also apply some refactoring to the 'schema'-generated
payloads by using the EnumerableConfig helper class.
Class received some new features:
- optional callback, verifying that index should be used at all
  specific use-case is magnitudes list that needs only 'counted' ones
- std::iota / ranges::iota_view -like helper object for sequences
  starting with something other than 0

Reordered payloads, prefer queueing over sending everything at once.
2021-10-24 14:22:08 +03:00
Maxim Prokhorov
fa3deeffbf webui: remove jquery dependencies and clean-up websocket API
Refactor WebUI:
- remove jquery dependency from the base custom.js and use vanilla JS
- remove jquery + jquery-datatables dependency from the RFM69 module
- replace jquery-datatables handlers with pure-css table + some basic cell filtering
  (may be incomplete, but tbh it is not worth additional 50Kb to the .bin size)
- introduce a common way to notify about the app errors, show small text notification
  at the top of the page instead of relying on user to find out about errors by using the Web Developer Tools
- replace <span name=...> with <span data-settings-key=...>
- replace <div> templates with <template>, disallowing modification
  without an explicit DOM clone
- run `eslint` on html/custom.js and `html-validate` on html/index.html,
  and fix issues detected by both tools

Streamline settings group handling in custom.js & index.html
- drop module-specific button-add-... in favour of button-add-settings-group
- only enforce data-settings-max requirement when the property actually exists
- re-create label for=... and input id=... when settings group is
  modified, so checkboxes refer to the correct element
- introduce additional data-... properties to generalize settings group additions
- introduce Enumerable object to track some common list elements for
  <select>, allow to re-create <option> list when messages come in
  different order

Minor fixes that also came with this:
- fix relay code incorrectly parsing the payload, causing no relay names
  to be displayed in the SWITCHES panel
- fix scheduler code accidentally combining keys b/c of the way C parses
  string literals on separate lines, without any commas in-between
- thermostat should not reference tmpUnit directly in the webui, replace with
  module-specific thermostatUnit that is handled on the device itself
- fix index.html initial setup invalid adminPass ids
- fix index.html layout when removing specific schedules
2021-07-18 23:30:32 +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
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
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
Eric Chauvet
21e75bef51 Kingart curtain switch UI support (#2250)
* Completed kingart curtain switch support:
Added Web UI controls and view in status
Added power up behaviour (nothing, close, open, last position)
Added curtain style (Roller, etc...) for UI status and to be used in MQTT

* Checked commit before PR. Added html gulp static files generated.

* Corrected a code refactor error which make the MQTT messages not handling position from received messages. Added comment to debug tab to show how to enable debug

* Use the maximum compression for gzip. A byte is a byte :)

* Update code/espurna/curtain_kingart.cpp

Co-authored-by: Max Prokhorov <prokhorov.max@outlook.com>

* Variable name prefix update
Added public set position function and curtain count

* Added Scheduler new type : curtain

* Add curtain schedule support and correct the 12h bug when adding a slot (00:00 after refresh). Default Hour is 12h

* Code cleaning.
Schedule support.
Light support is having an issue with new schedules corrected here.

* I let do better by the specialists

* Curtain init statues

* Coding style corrections

* Removed debug stuff from now - will be back later with the right way

* rebuild webui

* revert 435f1c5e03 schHour default, rebuild ui

Co-authored-by: Eric Chauvet <eric.chauvet@test-tree.com>
Co-authored-by: Max Prokhorov <prokhorov.max@outlook.com>
2020-05-18 02:19:50 +03:00
Max Prokhorov
849f8cf920 Rules RPN (#1984)
* RPN rules (WIP)

* RPN rules web interface, MQTT inputs

* Stickyness, rpn.ops,...

* Perform light updates only when value changes

* Improve wsSend performance

* Revert PR test

* Check TERMINAL_SUPPORT for _rpnInitCommands and remove unused variable

* Fix merge

* formatting

* disable by default (?)

* changelog

* comment

* remove debug function wrappers in favour of var activation

* fixup! comment
2019-11-10 07:01:50 +03:00
DmitryBlinov
bb33dfd102 Thermostat upgrade (#1711)
* Add "Enable Thermostat" switch

* Add heater/cooler thermostat mode
2019-05-02 01:06:14 +03:00
Dmitry Blinov
376205c9bb Merge branch 'dev' into thermostat
# Conflicts:
#	code/espurna/config/webui.h
#	code/espurna/data/index.all.html.gz
#	code/espurna/data/index.light.html.gz
#	code/espurna/data/index.rfbridge.html.gz
#	code/espurna/data/index.rfm69.html.gz
#	code/espurna/data/index.sensor.html.gz
#	code/espurna/data/index.small.html.gz
#	code/espurna/espurna.ino
#	code/espurna/static/index.all.html.gz.h
#	code/espurna/static/index.light.html.gz.h
#	code/espurna/static/index.rfbridge.html.gz.h
#	code/espurna/static/index.rfm69.html.gz.h
#	code/espurna/static/index.sensor.html.gz.h
#	code/espurna/static/index.small.html.gz.h
#	code/espurna/web.ino
#	code/gulpfile.js
#	code/html/index.html
2019-03-08 01:35:36 +02:00
Dmitry Blinov
af07494f00 Add thermostat module 2019-03-03 12:17:34 +02:00
Andrey F. Kupreychik
8b4713dee1 UI for LightFox 2019-01-04 18:57:07 +07:00
Max Prokhorov
9cdf59f1b2 Fix selector order 2018-09-29 04:49:15 +03:00
Max Prokhorov
3c91389c20 Update password UI
* revise first-time-use screen
* generate password (policy applies)
* hide/reveal password text for sta/admin settings
* changed autocomplete='...' for some inputs to avoid completion
2018-09-17 05:22:21 +03:00
Xose Pérez
e0f72bee0e Fixing look & feel 2018-07-23 11:09:50 +02:00
userName
df9fecd16a removed blind copy/paste console.log....
improved CSS to comply with CODACY rules
2018-07-22 09:00:02 +03:00
userName
4094adbae6 changed the look and feel of the checkboxes to resolve Edge issue and bring disabled state
also minor html fixes
2018-07-21 23:45:48 +03:00
Max Prokhorov
712cbe4942 Safari needs -webkit- prefix for clip-path 2018-07-05 17:58:45 +03:00
Xose Pérez
7b0d062190 Fix RFM69 message buttons in Web UI 2018-06-28 19:30:41 +02:00
Xose Pérez
8411e7bfe6 Fix filter buttons color 2018-06-25 13:46:49 +02:00
Xose Pérez
a39c4689ec Merge branch 'dev' into rfm69 2018-06-25 13:45:18 +02:00
Xose Pérez
b4761323b0 Revert button font style 2018-06-25 13:40:30 +02:00
Xose Pérez
3cd58e7f7c Initial support for RFM69GW board 2018-06-24 22:39:06 +02:00
Xose Pérez
1ac653b5e7 Fix button height 2018-06-20 10:40:04 +02:00
Xose Pérez
32553192e5 Replaced checkboxes with pure css version 2018-06-20 09:53:50 +02:00
Xose Pérez
0a1ad46100 Show hostname is right case in menu header (#799) 2018-04-17 12:41:13 +02:00
Xose Pérez
448ce2ccb9 Revert "Escape html for weblog in the client"
This reverts commit 8da3f54e91.
2018-03-30 23:59:41 +02:00
Xose Pérez
abcd23b41d Merge pull request #728 from mcspr/h1-height
Resize WebUI elements for narrow screen
2018-03-30 23:06:38 +02:00
Maxim Prokhorov
6f31111e7f Downsize header to fit the screen 2018-03-29 17:36:48 +03:00
Maxim Prokhorov
b6256fa24f Recalculate header line-height 2018-03-26 02:58:44 +03:00
Maxim Prokhorov
8da3f54e91 Escape html for weblog in the client 2018-03-26 02:44:20 +03:00
Xose Pérez
e46a904ff4 Fix codacy issues 2018-03-12 13:44:36 +01:00
Xose Pérez
2e872525f3 Added button to clear weblog 2018-03-12 11:49:31 +01:00
Xose Pérez
8777d29f7c Merge branch 'pwm-dimmer' of https://github.com/wysiwyng/espurna into wysiwyng-pwm-dimmer
Conflicts:
	code/espurna/data/index.html.gz
	code/espurna/static/index.html.gz.h
	code/html/custom.js
2018-03-12 11:07:53 +01:00