- revert unintended change to include 2 bytes as part of empty value
fixes compatibility with old versions including Embedis and having empty values
- overwrite now empty space when moving
- re-shuffle internal logic to be more strict with cursor oob read / writes
- update comments
- bump to espressif8266@2.5.3 (but, 2.5.4 will be here soon...)
- pwm asm -> __asm__
- re-shuffle dependencies a bit, remove brzo from -git and -latest, ref https://github.com/pasko-zh/brzo_i2c/issues/40
- replace `apmode` with `wifiApMode`
- deprecate `WIFI_FALLBACK_APMODE` in favour of the AP mode setting
- allow to set custom SSID and passphrase for the softAP via `wifiApSsid` & `wifiApPass`
- identifier fallback for hostname
Add new V3.0 version of PZEM004T, not tested. Default to factory default address 0xf8, configurable through pzemv30Addr 8-bit number
Add 'frequency' measurement & 'hz' unit
Add pz.address that configures address
Implemented energy reset
Right now we only support a single device. No way to test this properly (mostly, how exactly we need to connect this stuff), so left as not implemented.
- introduce zero threshold setting to reset value to 0 below a certain point (resolve#2264)
for example, set pwrPZeroThreshold0 10.0 for active power (or pwrQ... for apparent, pwrModS... for reactive) will reset always reset value to 0, similar to what turned off relay does. Default value is nan, since we can't use 0.0 on account of negative values.
- fix energy magnitude indexes usage, properly reset in API
- simplify sending pwr and emon Visible flags
- allow to use settings prefixes more, remove snsMinDelta & snsMaxDelta and use relative magnitude indexes
* wip based on early draft. todo benchmarking
* fixup eraser, assume keys are unique
* fix cursor copy, test removal at random
* small benchmark via permutations. todo lambdas and novirtual
* fix empty condition / reset
* overwrite optimizations, fix move offsets overflows
* ...erase using 0xff instead of 0
* test the theory with code, different length kv were bugged
* try to check for out-of-bounds writes / reads
* style
* trying to fix mover again
* clarify length, defend against reading len on edge
* fix uncommited rewind change
* prove space assumptions
* more concise traces, fix move condition (agrh!!!)
* slightly more internal knowledge (estimates API?)
* make sure cursor is only valid within the range
* ensure 0 does not blow things
* go back up
* cursor comments
* comments
* rewrite writes through cursor
* in del too
* estimate kv storage requirements, return available size
* move raw erase / move into a method, allow ::set to avoid scanning storage twice
* refactor naming, use in code
* amend storage slicing test
* fix crash handler offsets, cleanup configuration
* start -> begin
* eeprom readiness
* dependencies
* unused
* SPI_FLASH constants for older Core
* vtables -> templates
* less include dependencies
* gcov help, move estimate outside of the class
* writer position can never match, use begin + offset
* tweak save_crash to trigger only once in a serious crash
* doh, header function should be inline
* foreach api, tweak structs for public api
* use test helper class
* when not using foreach, move cursor reset closer to the loop using read_kv
* coverage comments, fix typo in tests decltype
* ensure set() does not break with offset
* make codacy happy again
Change the underlying command line handling:
- switch to a custom parser, inspired by redis / sds
- update terminalRegisterCommand signature, pass only bare minimum
- clean-up `help` & `commands`. update settings `set`, `get` and `del`
- allow our custom test suite to run command-line tests
- clean-up Stream IO to allow us to print large things into debug stream (for example, `eeprom.dump`)
- send parsing errors to the debug log
As a proof of concept, introduce `TERMINAL_MQTT_SUPPORT` and `TERMINAL_WEB_API_SUPPORT`
- MQTT subscribes to the `<root>/cmd/set` and sends response to the `<root>/cmd`. We can't output too much, as we don't have any large-send API.
- Web API listens to the `/api/cmd?apikey=...&line=...` (or PUT, params inside the body). This one is intended as a possible replacement of the `API_SUPPORT`. Internals introduce a 'task' around the AsyncWebServerRequest object that will simulate what WiFiClient does and push data into it continuously, switching between CONT and SYS.
Both are experimental. We only accept a single command and not every command is updated to use Print `ctx.output` object. We are also somewhat limited by the Print / Stream overall, perhaps I am overestimating the usefulness of Arduino compatibility to such an extent :)
Web API handler can also sometimes show only part of the result, whenever the command tries to yield() by itself waiting for something. Perhaps we would need to create a custom request handler for that specific use-case.
* broker: declare and define per module
We no longer need to specify each Broker type in broker.h
But, we exchange that bit for explicit initialization of the instance
Define helper macros to generate boilerplate code
- namespace with Instance, Register(), Publish()
- forward Register(...) -> Instance.Register(...),
Publish(...) -> Instance.Publish(...)
* don't check for broker when deps enable it
* 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>
* emon: configure ratios without reboot
* settings: serialize() support
* debug: use vsnprintf from newlib, not from sdk
* settings/experimental: show defaults via `get`
* emon: override base methods, fix defaults
* sensor/emon: expose internal index calculation
- refactor configuration to use the correct index when accessing indexed
sensor methods. store index value on magnitude, refactor loops to
accomodate this new functionality
- rename slot(index) -> description(index), since we use 'slot' as
numeric value
This will add support for the KingArt Wifi Curtain Switch. There are no buttons in the web interface as I could not figure out how to create them (any help on that is welcome).
For now the switch can be controlled over MQTT:
"{hostname}/curtain/set"
"{hostname}/curtain"
* hardware: Add support for Aoycocr X5P Plug.
This change allow espurna to control Aoycocr X5P Plug devices, which has
the same behaviour as the GOSUND WP3 but using different GPIO pins for
relay, button and leds.
* Update platformio.ini
Co-authored-by: Max Prokhorov <prokhorov.max@outlook.com>
- general conversion from .ino modules into a separate .cpp files
- clean-up internal headers, place libraries into .h. guard .cpp with _SUPPORT flags
- fix some instances of shared variables instead of public methods
- tweak build system to still build a single source file via os environment variable ESPURNA_BUILD_SINGLE_SOURCE
* hlw8012: load hardware-specific ratios
* hlw8012: read energy in pre() callback
* dcz: nvalue should be integer
* sns: fix pressure constrain
* sns: load ratios based on index too
* sns: per-magnitude corrections (still limited by type)
* sns: attach units to index
* ADC_VCC is not macro
* In esp.h ADC_VCC and ADC_TOUT is not macro, so define macro.
* ADC_VCC and ADC_TOUT fixes in utils.ino and sensors.h
* Adding support for I2C temperature and humidity sensor HDC1080 / 831R
* Added HDC1080 to test\build\sensor.h and arduino.h
* added brackets
* Revert ADC_MODE_VALUE to initial values
* Eof newline
* Eof newline
Co-authored-by: Max Prokhorov <prokhorov.max@outlook.com>
https://github.com/xoseperez/espurna/pull/1772#issuecomment-609847420
> Without the patch btnRepDel overrides every btnRepDel0, btnRepDel1 etc., btnRepDel0 read second, then hard-coded value.
With the patch btnRepDel0 is read first, then btnRepDel, then hard-coded value.
Indexed key can only be set via settings upload or in terminal, WebUI can change only the global override setting. Allow more 'specific' key to override global setting.
- Domoticz only accepts svalue <pressure>;<forecast>,
failing to display anything otherwise.
We don't have any forecast calculation (yet?), simply send dummy value.
- Move Domoticz code outside of sensor.ino
- Update sensor classes to support a generic way to store energy values
- Update sensor conversion code to deal with units and not magnitudes
- Add magnitude<->unit for sensors, generic way of defining used unit. Convert from sensor magnitude unit to the one used for display.
- Reset energy value based on index through external means (MQTT, HTTP)
- Rework energy timestamping, update webui with 'last saved' value
While this solves the energy conversion issues and we are finally seeing the real value, what I don't really like:
- KilowattHour and WattHour are separate enum tags, thus sort-of are different types altogether
- Conversion code in Energy object should probably use some generic 'ratio' calculation? (https://en.cppreference.com/w/cpp/numeric/ratio/ratio)
- We are still using runtime checks to do calculations and depend that sensor outputs only one specific value type.
Consider this a fix for energy display / storage and preliminary work on sensor.ino
Further sensor refactoring... soon.