646 Commits

Author SHA1 Message Date
Max Prokhorov
917ce8de83 Optional Web(UI) OTA (#2190)
* web: optional OTA support

* add prototype

* hide under websupport
2020-03-20 21:05:04 +03:00
Max Prokhorov
80825590a5 LED Updates (#2170)
* support GPIO setting in WebUI
* experimental led pattern support
* support loading settings in setup() (not yet fully working)
2020-03-13 07:01:14 +03:00
Max Prokhorov
ba3e6267e6 Button pin provider & runtime settings (#2162)
* wip

* cleanup buttons-through-serial code, remove hw mention from button module

* remove wip

* implement mqtt settings

* fixup struct members, dual no longer allocates debouncer

* add missing debounceevent lib

* fix missing event_handler, update names

* fix namespace

* drop lib

* fix int<->bool comparison

* Move gpio16 handling from DigitalPin to EventHandler

* Cleanup debounceevent headers

* Don't expect system headers to be included

* re 70b54c489f - no allocation, for real

* Adjust settings names

* dont retain by default

* unused

* typo

* Fix length type (ref 6017ad9474)

* Move pin class outside of debounce lib, lowercase ns

* move event handling inside of button_t

* refactor config. ..._MODE -> _CONFIG, ..._MODE_... -> ..._ACTION_...

* fix test

* naming

* move indexed value to header

* refactor actions into direct opts

* fix webui, fix buttons not respecting old user setting

* change button config format from bitmask to a struct, adjust settings conversion

* proxy some more header defautls, fix web kv

* gpiopin

* adjust webui func to support every setting

* clarify single-return event->string

* fix dual setting

* fix dual packet condition, de-duplicate funcs

* fix bogus warning
2020-03-13 04:42:40 +03:00
foxman69
bc1fb0ba38 WebUI: alert when WS closes (#2131)
* Added alert when websocket closes and trying to trigger it faster

* Added window before function...

* Changed from setTimeout to SetInterval

* Fixed position of if statement

* formatting

* images

Co-authored-by: Max Prokhorov <prokhorov.max@outlook.com>
2020-02-09 01:41:14 +03:00
Sammy BAUER
f73917decc Configure Thingspeak URL at runtime (#2124)
* Permit thingspeak urn edit

* Update thinkspeak.ino

* Update index.html

* Replace Host, Port, and URL with Address in Thingspeak

* Create AsyncThingspeak object

Create AsyncThingspeak object to contain the url of the component.

* replace pointer by class member

Thingspeak class improvement to answer Max's question:
why use a pointer when it can be a class member?
So now address parameter isn't a pointer anymore.

* Update Thingspeak address on post
2020-02-09 01:15:27 +03:00
Max Prokhorov
ba3ec47ed0 NTP: use sntp app from lwip on latest Cores, replace ntpclientlib (#2132)
* ntp: try using sntp app from lwip, drop ntpclientlib

* fix display

* thermostat: fix day and month getters

* test build sizes with scheduler

* use system timers for once-a-minute scheduling, no polling

* tick

* avoid timestamps, use tm

* drop utc rpn operator, add utc_hour and utc_dow

* try to build with old implementation too

* dep

* notify ws

* progmem

* cleanup types

* offset tm values by 1 to match existing schedules

* avoid using ntpclientlib with rpn

* test. show debug strings in sch

* fix secureclient

* consts, fix unsyncing when changing tz (and not triggering sntp after reinit for some reason)

* startup time in seconds

* same delay as lwip

* header

* assume build timestamp is unixtime

* cache server value

* fmt

* typo

* handle dhcp request

* rename

* web

* TZ.h

* add notice about what alias means

* fix disabling NTP_SUPPORT

* scheduled ticker

* same behaviour as old module

* rollback rpn dependency check, utc_ prefixes

* ...

* comments, refactor naming
2020-02-04 06:17:40 +03:00
Max Prokhorov
298ce8cac2 Refactor get/set/del/hasSetting (#2048)
* experimental: refactor get/set/del/hasSetting

* sensors

* lights

* cleaup

* r

* tuya

* fixup! sensors

* fixup! tuya

* header defaults types

* fix lights

* setup already checks for max

* helper for flashstring

* fix overload

* oops

* refactor includes

* warnings

* test with migrate

* add ids in a separate file

* cleanup

rev: crash

rev: domoticz

rev: encoder

rev: loopdelay

rev: hass

rev: i2c

rev2: hass

rev: mqtt

rev: rfm69

rev: relay

rev: rpn

rev: settings setup

rev: hb settings

rev: telnet preprocessor fix

rev: settings wrap

rev: tspk bool style

rev: wifi types

rev: util hb

rev: settings

fixup! rev: settings

* rev: cleanup wifi injections based on new getters

* hasSetting now can return true for empty key

* show hardcoded network in web

* oops

* fix ws referencing wrong index

* ensure empty strings are written

* c/p

* use experimental schema style for payload, mark network as not deletable

* allow to customize converter

* shorter syntax, try using with wifi

* use proper #if syntax to handle definitions that are missing

* fixup ota sc checks getter, cast schEnabled to bool

* add utils header to sensors
2020-01-20 16:39:35 +03:00
foxman69
e3887da8a0 WebUI: Fix scheduler panel tabindex= values (#2096)
* added data-settings-max value to html

* fixed: use the value and not the defenition of the function

* the schedules variable already starts from 0 not need to increment

* another misuse of function as variable
2020-01-13 14:33:28 +03:00
Max Prokhorov
4f5e9fa1b7 OTA: verify data stream and properly handle errors (#2067)
* webui: improve updater error message

* ota: properly check updater state and finalize on errors

* finish up ota handling refactor

* fail web upgrade when cannot find magic byte

* send updater status with no payload arg and always send payload with

* mention magic byte and flash mode in webui

* gzip magic

* make async ota at least usable. timeouts, show errors, try harder to find data after headers

* simplify setup and destruction

* cleanup class instantiations for ota and url

* handle default case of magicflashchipsize

* shorter

* blobs
2019-12-21 00:19:15 +03:00
Max Prokhorov
43cf926468 ha: try to avoid conflict with useCSS (#2075) 2019-12-21 00:07:10 +03:00
Max Prokhorov
0f02256860 Small fixes (#2071)
* web: fix rfb node generator syntax, do not send as basic settings

* ha: allocate discovery object later
2019-12-19 00:56:29 +03:00
Max Prokhorov
8e7854b04e WebUI fix change detection of input elements (#1986)
- use setOriginalsFromValues function right after elements had changed and
**only** with those elements
- add checkbox handling to setOriginalsFromValues to match hasChanged
- apply hasChanged after value is set to refresh originals after saving
- change parts that already set 'original' attribute manually

This was sort-of broken, because original attr never worked as intended. 
Also fix possible OOM for large WebUI images, since sending full config each time means that we need more memory to buffer and parse it.
2019-12-18 17:45:51 +03:00
foxman69
5cf687ffc1 WebUI: Fixed small aesthetic problem (#2038)
* Fixed small esthetic problem

* Changed to legend
2019-12-09 09:22:51 +03:00
Max Prokhorov
2ef21d840d WebUI: fix some issues
- fix colorpicker variable name
- var msg and var pre for debug messages
- add gpio16 to gpio list, remove unused template code
- fix lightfox endif matching rfbridge instead of lightfox
- formatting
2019-12-09 09:10:40 +03:00
Max Prokhorov
15accf8090 web: check sch_last existence (#2050) 2019-12-09 07:40:36 +03:00
Maxim Prokhorov
812c3ea8a0 web: init relay selectors inside relayConfig 2019-11-25 23:35:28 +03:00
Max Prokhorov
9a5698b342 Add TUYA_SUPPORT (#1997)
- add experimental `relayDummy` to configure dummy relays at runtime
- add tuya-generic-dimmer #1729
- cleanup broker interface to allow Tuya module to properly receive events, modify broker methods to allow different function signatures
- add basic tests for Tuya frame and data protocol
2019-11-21 01:14:17 +03:00
Max Prokhorov
ab186e057e Add missing / not implemented default getSettings values (#1996)
* scheduler: match webui defaults

* relay: inverse error condition

* api: simplify apikey handling

* thingspeak: use apikey default value

* web: fix checkbox value for haschanged

* fixup! scheduler: match webui defaults
2019-11-18 02:48:22 +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
James
d177634a70 Telaire T6613 Support (#1956)
* Added T6613

* Added T6613

* Added T6613

* Added T6613

* Added T6613

* Added T6613

* Added T6613

* Added T6613

* Added T6613

* Updated copyright string

* Buffer from 6 bytes to 8 bytes

Current gcc-4 does not mark this as warning, but gcc-9 notices the 3 char size requirement. Buffer should be 8

* Use 5000ppm max
2019-11-06 14:32:58 +03:00
foxman69
4343457b9e Support restore last schedule (#1948)
* Added restore last schedule support

* Merged RestoreLastScheduleState function into the _schCheck function

* handle lights in restore action

* hide webui chbox when not using scheduler

* use settings instead of struct member, hide under ifdef scheduler_support

* relayLastSchedule uses SCHEDULER_RESTORE_LAST_SCHEDULE as default

* Changed all the variable names to be the same so there would be no confusions

* Fixed client side to create an array from relayLastschedule

* Fixed cosmetic issue with the toggle display in webui

* Fixed variable name and disabled comparison at the end

* Added another check if the switch type is light provider

* Changed variables naming

* Naming mistake
2019-11-06 14:25:42 +03:00
Max Prokhorov
6d9d4ae149 light: provide mired warm / cold limits to webui 2019-10-15 19:14:22 +03:00
Xose Pérez
8b7eea6c72 ESPurna base image for Tuya Convert 2019-10-11 17:44:47 +02:00
Max Prokhorov
deb465763f Fix WiFi scan results in Web (#1913)
* web: re-add wifi scan action, send as json array

* ws: forcibly inline send functions
2019-09-20 15:37:54 +03:00
Max Prokhorov
a2688ec376 lights: don't show v for hsv picker, use brightness instead 2019-09-10 12:39:28 +03:00
Max Prokhorov
f8deb535b5 lights: selector typo 2019-09-10 12:36:09 +03:00
Max Prokhorov
8dbd25c548 lights: initColor args 2019-09-10 12:35:12 +03:00
Max Prokhorov
e233fd5b08 web: move hsv picker conversions into functions 2019-09-07 12:48:35 +03:00
Max Prokhorov
0bf07f166e web: update to jquery 3.4.1 and wheelcolorpicker 3.0.8 2019-09-07 12:37:31 +03:00
Max Prokhorov
68270310c7 web: parse host query via browser api, logging 2019-09-06 14:37:39 +03:00
foxman69
d66b8a9bed Syncronize js when saving configuration (#1863)
* Syncronize js when saving important data

* update webui
2019-08-27 01:15:24 +03:00
Max Prokhorov
d4311211ad Lock relay status on boot (#1705)
* relays: locked status

* remove debug

* Disable relay toggle when locked

* fixup! Disable relay toggle when locked

* Send lock with status, fix "disable" condition

* typo

* Update WebUI
2019-08-13 00:33:27 +03:00
Max Prokhorov
d4dea17f94 Fix missing WS debug messages (#1851)
Amend #1843 , since we have updated ESPAsyncWebServer
Fixes (again) #1300

Gather WS debug messages in a buffer and flush every N times
info,keys,crash actually output data now
2019-08-13 00:18:45 +03:00
Max Prokhorov
21423431ce Fixed size json payload & other WS bugfixes (#1843)
- update every dynamicjsonbuffer with fixed size constructor argument
- change to ws callback registration to use a class builder (just cosmetic)
- test multiple ws data callbacks for each module
- remove some of the static strings in favour of ws data callback
- improve sensor ws callback data size, remove duplicated strings
- use static buffer in wsDebugSend
- postpone wsSend until loop, implement wsPost to allow other modules to queue message callbacks. remove Ticker based ws callbacks for data
- update WebUI files
2019-08-12 23:24:52 +03:00
copyrights
9ceca44770 Two channel CCT (#1732)
* add CCT support for 2 channel boards

* update webinterface description

* add 2 channel CCT to homeassistant and domoticz

* remove domoticz two channel cct support.
2019-05-27 02:47:58 +03:00
m-kozlowski
471a6387fb Separate device name for alexa integration (#1727)
Allow defining custom device name for alexa integration, other than hostname.
Still uses hostname as a fallback.
2019-05-23 06:22:18 +03:00
Max Prokhorov
193cebdbab RF/RFBRIDGE Update (#1693)
- remove optional RFRAW_SUPPORT
- enable module when RF_SUPPORT=1, optionally enable RCSwitch
- reorder ifdef checks to treat RFB_DIRECT and old RF_SUPPORT the same
- rename RF_PIN to RFB_RX_PIN
- depend on RF_SUPPORT instead of ITEAD_SONOFF_RFBRIDGE
- runtime TX & RX PIN setting
2019-05-08 23:57:18 +03:00
DmitryBlinov
bb33dfd102 Thermostat upgrade (#1711)
* Add "Enable Thermostat" switch

* Add heater/cooler thermostat mode
2019-05-02 01:06:14 +03:00
Xose Pérez
9c3a6e6548 Merge branch 'webui/switch-typo' of https://github.com/mcspr/espurna into mcspr-webui/switch-typo 2019-03-25 12:41:28 +01:00
Xose Pérez
f40b621637 Merge branch 'sync_first' of https://github.com/foxel/espurna into foxel-sync_first 2019-03-25 12:39:35 +01:00
Xose Pérez
5d5e9155e5 Merge pull request #1603 from ElderJoy/thermostat
Add thermostat module
2019-03-25 12:23:11 +01:00
Indu Prakash
d1c852eee5 Fix for #1653 2019-03-25 05:05:06 -05:00
Max Prokhorov
920c205d61 spaces 2019-03-23 06:41:55 +03:00
Max Prokhorov
58d911d3ed Merge remote-tracking branch 'origin/dev' into webui/switch-typo 2019-03-23 06:39:38 +03:00
Xose Pérez
0987e01950 Allow to configure all LEDs from UI (#1429) 2019-03-21 22:31:11 +01:00
Max Prokhorov
494427402a WebUI: selector typo 2019-03-21 05:14:11 +03:00
Dmitry Blinov
add499e245 Update custom.js 2019-03-08 01:57:53 +02:00
Dmitry Blinov
cb582b711d Update custom.js 2019-03-08 01:42:19 +02: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
ec39ac5c88 Fix conflicts:
1. Add thermostat to the espurna_modules in progmem.h
2. Add thermostat to webui, gulp, html, js.
3. in general.h MQTT_USE_JSON returned to 0 by default and 1 if thermostat enabled.
2019-03-08 01:02:11 +02:00