c/p PSTR attribute from Core files
dostring declaration with a macro instead of a scary looking boilerplate
saves varying amount of code space, mostly deals with our key and cmd strings
* stateless callbacks for mqttRegister. no module uses the lambda / std
func with captures or otherwise, so it is kind of pointless to have it
* make sure we know topic and payload length at all invocations and
not constantly trying to re-parse the same string over and over again
* clean-up api related to string parsing and make sure we allow
stringview as input
* clean-up id / unsigned number parsing to work with views instead of
using a generic strto{,u}l; sometimes this works, sometimes doesn't.
as noticed previously with IR implementation, it *will* parse until
the '\0' is found in the input and we can't interpret parts of the
string without doing a copy for the strtoul
* fixing additional bugs caught in ifan, leds, sensors and lights that
were causing build failures. plus, more range-based parsing code for
the same reason as described above
get rid of board module, replace with system calls for hostname, board
and password. move boot (quirks) handlers to system as well
espurna::build { ... } namespace for our app const values
One namespace for sensor functions and types.
Fix discrepancy between topic and indexed topic funcs.
Energy types fixes, make sure we use known ratios.
Sensor fixes, moving certain pin settings and defaults into the sensor
classes, using those in the actual sensor init code.
Energy is still within the sensor module, pending version bump before moving.
schedule immediately with module functions, don't wait
more flash-strings in the module and utility functions
support rare condition when body cannot be sent on connect, use poll to send it
don't wait for header line in body, and bail out when done parsing
make sure data is copied into the async variant, and remains there for
the duration of the connection
general async api is... more complicated that it needs to be
until wolfssl / brssl port is here, though, there is no other choice
secureclient config becomes a simple struct, pending further rework
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.
Otherwise, some things are still hidden
(or, depend on the order of incoming messages)
Make thermostat code use those as well, instead of injecting
thermostatVisible in every json payload
Common functions moved into namespace domoticz { ... }
Module functions moved into namespace { ... }
Remove templates and favour simple function for nvalue & svalue formatting,
and also use ArduinoJson for the JSON serialization.
Detach lights from the 1st relay, introduce `dczLightIdx`
Use named channel functions instead of counting channels manually.
Try to migrate the old settings.
Introduce stronger type for Idx to avoid entity id vs. domoticz idx confusion in function arguments,
since both are numeric and there's no distinction besides the name itself.
Make sure 'custom provider' `lightAdd()` scheduled function locks further channel modifications,
and take care of light sanity checks before the light update is even scheduled.
Reworked rtcmem reader / writer to use default values, instead of accidentaly using
the unitialized mem of the stack. Also, reworked const names used by the lights module
to distinguish them from the build flags.
- 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
* 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
- 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
- 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
- mask is defined as (relay# status << number)
- transparently handle base-2 and base-10 numbers
- if the relay mode requires us to save the mask, it will be saved as base-2
- 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
* Light: proper printf format for HSV, use lround
* core: warn about map() and 2.3.0, type-strict constrain()
* use generic format
* value already has brightness
- 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
* send all ws config at once on start
* reduce ws json overhead by creating message buffer manually
* use k:[values] instead of k1:value1, k2:value2 etc. for lists