Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LED Redux, Exposing Options through Web, Live Web Mode Switching #4865

Conversation

EphemeralPersistence
Copy link

Been procrastinating on this req... (while figuring bits out), so there are quite a few deviations..
Serious apologies in advance for the bungle/bundle of work here. - or any GIT weirdness...

Some suggestions - these coming from integrating this into home light switches..
(I'm concerned with the deviations that the switch I'm working with has from the sonoff devices.. I may get a sonoff to ref against) :

  • Module definition and integration for the KingArt light switch series
  • LED blink pattern concept (LEDRedux - the LED proved quite important for the module I was working with.. so this is where most of the work started.)
  • LED state definitions based on use representing Activity,State and Power information
  • Global activity monitoring through flag structure
  • Web mode switching based on user login (and logout) - I've put the detail up here; proof is coded with a temp user/password for 'user'
  • Web scripting testing device 'up' state before reloading & OTA (and some general web bits while getting a handle... translation chunks and consistency on my work def not withstanding)
  • Web MQTT en/dis-able in the MQTT section
  • Web options for :
    -- Setting LED usecase (Activity/Status/Power.. or none to disable) - bit masking for the LED
    -- Managing saving to flash of state (useful.. esp for setting a default, and its a light switch - not really concerned with prev state as its managed by home integration - also just the option of reducing unnecessary flash writes.)
    -- Managing single button mode (very useful after setup is complete to stop accidental fiddling! instantaneous switch response is awesome, esp for a light switch :P)

Appreciate input, ideas and critique!

There's more needed to finish some of this.. def WIP

EphemeralPersistence and others added 21 commits January 3, 2019 22:17
…g touch light switch

Added LED blink patterns support and mode configuration
Added blink patterns for IDLE and known error/status states, pattern play rate also setable
 - idle      : 1s off, 1s on
 - error     : fast (250ms - default) flashes
 - wifi down : 2 short flashes
 - mqtt down : 3 short flashes
Added 'Powered' state LED blinks xor's with blink patterns - so status patterns shown

Added LED status/indicator LED disable option
Changed ledstate ops to use enums and mask flags - still working on figuring out the orig intent of the LED control scheme.
Added blink patterns for IDLE and known error/status states, pattern play rate also setable
 - idle      : 1s off, 1s on
 - error     : fast (250ms - default) flashes
 - wifi down : 2 short flashes
 - mqtt down : 3 short flashes
Added 'Powered' state LED blinks xor's with blink patterns - so status patterns shown

Added LED status/indicator LED disable option
Changed ledstate ops to use enums and mask flags - still working on figuring out the orig intent of the LED control scheme.
…etween user/admin if using password)

Added General configuration menu
 - Option to set LED status indicator control to allow disabling the status LED completely (for 'normal' operation); needed for controlling LED mods
 - Option to set Saving mode, to stop constant flash writes of current status for every single operation..
Some javascript mods
 - Added scripts for testing whether the client is online before attempting to reload
 - Scripts and code for achieving a HTTP:basic auth 'logout' - needed for user switching

Notes:
The webserver upgrade for user access level escalation affects all usecases of the http user validation
If a password is set for the webserver, then the authorsation kicks in.. the current user is hardcoded to "user"/"password" - need to move this out
If a password is expected and no valid auth is done, the the webserver will not be usable to a client - ie: client *has* to login
Translations are only for English.. still need to add in the extra defines for other builds
Support for KINGARTS-N1 touch panel
Added LED blink patterns and mode blink mode configuration
WebServer updates for user access management and some function extensions
LED status enum flags are now bits.. (& cases work)
- Activity state managed from global_activity.flags - replacing the LED_MQTTSUB/PUB etc state enums
- Status state managed through existing global_status.flags
- Power state managed from 'power' global state flag
Reworked LED blinks
- Blink modes are now fully patternable (not a word, but useful)
Removed references to led_disable setting
Moved MQTT enable to MQTT config (with fix so the menu does not disappear)
Added Single Button mode general option (much faster response, nice to be able to enable once configured)
Added autorefresh functions to all waiting screens
Fixed issue with checkbox conversions
@ascillato
Copy link
Contributor

Too many changes together. You modified a lot of files.

It is better and more readable if you make a separated pull request for every idea.

Copy link
Collaborator

@ascillato2 ascillato2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, separate each idea on differents Pull Requests
Please, update to latest version.

@EphemeralPersistence
Copy link
Author

I agree.. will redo from start.

@EphemeralPersistence
Copy link
Author

Sorry.. I've stared, fought and fought and come to the conclusion that GIT is as its name..
I'm just not up to speed enough on GIT yet to figure out how to unpick its commit system and even attempt a piece by peace merge...
Iol, I've made a right mess of it trying to figure a way.

I did manage to update and merge with the head.. but I just am not bothered enough to create and then resplice in every change into each own branch and then submit a pull.. wasted a day figuring it out first of all even how! and its not worth the time.

Sorry guys, I'll maintain it separate.

arendst added a commit that referenced this pull request Jan 10, 2019
Change web authentication (#4865)
gemu2015 pushed a commit to gemu2015/Sonoff-Tasmota that referenced this pull request Jan 27, 2019
Change web authentication (arendst#4865)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants