- magnitudes vector grows by calling copy ctor, ensure filter never gets deleted
- ensure we can't use magnitude member instead of ctor arg
- more magnitude references instead of using index access
- additional checks for isnan, fix report never triggering
- drop event callback. at least for EventSensor, we already have
report with min / max value change triggers
- BaseFilter must have virtual dtor
- magnitude object is not trivial, we need to manage filter lifetime
- Ensure move also moves filter object
- Clean-up using magnitude object by value in functions
- (experimental) provide generic way to read magnitude values
- expose /api/metrics with values formatted specifically for prometheus, with relay and sensor data
- small tweaks to sensor init
Example config:
```
scrape_configs:
- job_name: 'espurna'
metrics_path: '/api/metrics'
params:
apikey: ['apikeyapikey']
static_configs:
- targets: ['espurna-blabla.lan:80']
```
Where ESPurna side has
```
apiKey => "apikeyapikey"
apiEnabled => "1"
```
ref. https://travis-ci.com/github/mcspr/espurna-nightly-builder/jobs/378203413#L698
> +env ESPURNA_FLAGS=-DGENERIC_ESP01_512KB ESPURNA_RELEASE_NAME=generic-esp01-512kb ESPURNA_BUILD_SINGLE_SOURCE=1 pio run -e esp8266-512k-base -s -t release
> /home/travis/.platformio/packages/toolchain-xtensa/bin/../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/bin/ld: .pio/build/esp8266-512k-base/firmware.elf section `.irom0.text' will not fit in region `irom0_0_seg'
Remove ~90Kb from the build.
- cache received rfbridge codes in the internal list, allow to operate on it via the rpn operators
- add `<N> <proto> <code> rfb_match`, matching when we receive specified protocol + code string at least N times
- add `<proto> <code> <proto> <code> rfb_sequence`, checking if specified protocol + code pairs happen in sequence
- add `<TIME> <N> <proto> <code> rfb_match_wait` - similar to `rfb_match`, but waiting for at least `TIME` (ms) via oneshot runner
- add `<proto> <code> rfb_info`, pushes code's latest timestamp and it's counter on the stack
- add `<proto> <code> rfb_pop`, which removes the specified protocol + code from the internal cache
- fix MQTT skip setting making RPN variables absent on initial connection
- default to no skip when receiving MQTT
(small issue still stands with us having non-clean MQTT session, broker will persist variable subscriptions even after unsubscribe event)
- build flags RF_... are renamed to RFB_...
- drop RFB_DIRECT boolean in favor of RFB_PROVIDER=..., adds RFB_PROVIDER_EFM8BB1 and RFB_PROVIDER_RCSWITCH
- rework rfbridge parser. drop serial buffering and combined processing of rcswitch / rfb data in favor of state-full parsing
- rework rcswitch integration, support variable length payload via bitlength and allow to output 64bit data via rc-switch fork from open-mqtt-gateway.
- apply bit-length comparison for the old rcswitch codes, bump cfg version to 5 to allow 1.14.1 config updates (broken on dev, since cfg setting was never updated on clean installations 😞)
- optional relay support for both, independent of mqtt
- rework settings scanning routine when trying to match rf payload with the relay ID, scan settings only once instead of relayCount()<sup>2</sup> times if we want to find something for relayCount()-1'th relay
- add broker callbacks list with proto id + stringified code. default rfbridge does not support more than one protocol, so send out ID 0 as default (which matches with what 0xa6 will show, supposedly as it does not work for me :?)
- send out 0xa6 and 0xb0 sniffer data from https://github.com/Portisch/RF-Bridge-EFM8BB1/ to the MQTT and internally via broker callback
- update receiver callback 'locking' to make sure specific relay ID is tracked instead of all at once
- update build tests and deprecation notices
Stock RFBridge & RCSwitch refactoring are closely related, so pulling all of this at once. We no longer use the same 'flow', using separate integration paths.
One sort-of breaking thing is the new internal _rfbMatch() change - we no longer update serialized 'buffer' string when matching in the receiver, thus we (very) likely send a different string to the MQTT when receiving the same device's code. This introduces non-trivial dependency on the output buffer though :/ And we don't always have relay support, so that would be another layer of preprocessor checks.
Instead, I am in favor of another option - special build / runtime setting to provide the same protocol + payload pair as new broker integration does. To simplify / make sure it is noticed, separate protocol and actual data with comma, colon (like IR) or space.
- for some reason we were never checking it's output
no need to increase +1 since we write the exact number
- allow hexEncode output be decoded, enforce even-ness
- raw msg must have at least 3 bytes - start+code+end
Per PR comment:
> I'm running simple 1-channel led dimmer and couldn't get brightness control working, as it was called only if lightHasColor().
> This PR changes conditions slightly, and allows domoticz's dimmer device to control brightness as well. I think this device type is more appropriate/comfortable in this case."
- remove lightHasColor() check, try to parse the payload and manually adjust the channels
- when domoticz payload does not have "Color" field, still fall-through to the brightness update