46 Commits

Author SHA1 Message Date
Maxim Prokhorov
82feb95daa test(build): configurable paths & .gitignore test caches
add one more level of directories for build config & its cache
replace test/pio_cache w/ test/build/cache
2025-06-08 22:07:56 +03:00
toniSg
36e00df272 sns: DYP A02YYU ultrasonic sensor (#2622)
* a02yyu: add support for DYP-A02YYU ultrasonic sensor

* a02yyu: add missing defines

* a02yyu: fix type from char to uint8-t

* a02yyu: simplify read() implementation

* a02yyu: cosmetic reordering of sensor defines
2024-10-24 11:14:41 +03:00
Maxim Prokhorov
d2e18744dc scheduler: backport remainder impl, fix ambiguous name 2024-05-16 01:25:50 +03:00
Maxim Prokhorov
06e49ccf9b uart: swserial workaround for recent Core version
fix #2592 (for real this time)
2023-10-17 00:26:53 +03:00
Maxim Prokhorov
480c72dc07 sns: broken mqtt address publishing
cannot declare constexpr objects like that with old compiler
fix #2594
2023-10-16 23:25:39 +03:00
Maxim Prokhorov
574fbf1960 uart: standalone configuration
- setup uart at boot instead of delaying until some module needs it
  removes global `SERIAL_BAUDRATE` and `DEBUG_PORT` in favour or
  globally accessible numbered port configurations with `MODULE_NAME_PORT`
- automagically enable uart support for sensors that need it
- allow every sensor to configure uart0 (normal and swapped), uart1
  and an optional software-serial mode support with an extra build flag
  remove individual includes across the sensors
- settings queries and runtime port configuration (prefixed with uart)
- update dependencies header to cross-reference used ports at build time
- update deprecations header with serial baudrate notice
2022-09-25 08:26:22 +03:00
Maxim Prokhorov
5bc55cd1a5 hw: core -> minimal 2022-09-21 04:21:23 +03:00
hamed
660d8c339b sns: add INA219 (current / power monitor)
resolves #2501

Co-Authored-by: Maxim Prokhorov <prokhorov.max@outlook.com>
2022-05-18 21:22:32 +03:00
Maxim Prokhorov
c04cdff200 sns: build flag for dummy sensor 2022-05-06 18:56:54 +03:00
Xose Pérez
1c9553176d hw: add support for PM1006 (IKEA Vindriktning) (#2505)
IKEA Vindriktning Air Quality Sensor
https://www.ikea.com/gb/en/p/vindriktning-air-quality-sensor-80515910/
2022-05-06 14:37:49 +03:00
Maxim Prokhorov
001ec79c8e ir: clean-up and refactoring of the existing module
- provide a queue for the outgoing messages, don't depend on the MQTT
  callback implementation details and always postpone the actual transfer.
- generate user input parsers using re2c, adds special PlatformIO build handlers
- add terminal command to show GPIO info and send a simple payload
- rework button<->action presets into value<->terminal command presets and custom ones
  through the use of `irCmd<VALUE>` settings, where the VALUE is taken from the simple payload
  (yet, it does not understand repeated codes, but that's something to add later *or* use rpnlib)
- add tx message integration for the relay module via `irRelayOn#` and `irRelayOff#`
- rework simple payload to include 'repeats' value for the 'IRsend::send()'
  also adds internal 'series', 'delay' and includes full 64bit 'value'
  (as uppercase HEX, instead of decimal)
- rework raw payload to use 'series' instead of 'repeats', and provide a
  clear distinction between the usec time and the options of the message
  by moving the required options to the front and separating them using ':'
  (just like the simple variant)
- make RX and TX pin a runtime setting, make RX and TX support a build flag
- small test framework to check whether internal string encode<->decode works

Also updates the hexEncode & hexDecode implementations to use
'iterators' instead of just pointer + index.
2021-10-03 20:44:58 +03:00
Maxim Prokhorov
f748b6487c test: also check for small core webui 2021-09-03 15:23:19 +03:00
Maxim Prokhorov
c34acf1748 ci: latest Core and split webui test into a separate job 2021-06-20 17:25:20 +03:00
Xose Pérez
bb7ffe9b3c sensor: add support for SmartMeasure SM300D2-VO2 air quality multi-sensor (#2447)
* Support for SmartMeasure SM300D2-VO2 air quality multi-sensor

* Fix temperature sign, using hexDecode

* Update README.md
2021-05-12 16:24:59 +03:00
Maxim Prokhorov
4d8dc5d2a6 system: finish up cleaning broker code 2021-03-31 09:41:05 +03:00
Maxim Prokhorov
7434ea3878 lights: finish up provider settings
get rid of LIGHT_CHANNELS, but keep channel setting for the my92xx
also clean up recent changes, channel command did not actually work
2021-02-10 20:05:13 +03:00
Maxim Prokhorov
34d63c155d lights: refactor my92xx mapping build flags 2021-02-06 04:44:25 +03:00
Maxim Prokhorov
e50b6fe79a mdns: clean-up 2021-01-24 03:38:02 +03:00
Maxim Prokhorov
a40eca30ad ifan: refactor into a separate module 2021-01-14 14:10:45 +03:00
Max Prokhorov
8ceeebdb24 providers: relays, lights and buttons refactoring (#2414)
- 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
2021-01-14 10:39:18 +03:00
Maxim Prokhorov
15e3806b28 libs: renormalize line endings
Garland merge updated .gitattributes, fixup the difference before
merging anything else :>
2020-12-30 21:49:17 +03:00
DmitryBlinov
5aeb24f263 garland: new module (#2408)
Port of https://github.com/Vasil-Pahomov/ArWs2812 from Arduino to ESP8266
Implementing garland of WS2812

Co-authored-by: Dmitry Blinov <dblinov@blackberry.com>
2020-12-24 17:44:59 +03:00
Max Prokhorov
c7a95bf53f buttons: resistor ladder / analog buttons support (#2357)
- Buttons events source as button property instead of a global one
- Rename events source -> provider for all settings, consistent with the other things like relay and light providers
- AnalogPin to read between a certain analogRead() range
Trying to follow defaults here - analog 'press' is digital LOW, default value is HIGH, so no additional cfg entries are needed besides pin, level and changing evt source
- (debug) Refactor gpio command, add adc to show analogRead(pin)
- (debug) Add button command

Implemented based on:
https://gitter.im/tinkerman-cat/espurna?at=5f5d44c8df4af236f902e25d
https://gitter.im/tinkerman-cat/espurna?at=5f60e7f1f969413294e95370
2020-09-24 07:51:36 +03:00
Max Prokhorov
a496308d97 web: prometheus metrics support (#2332)
- (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"
```
2020-08-30 15:26:16 +03:00
Maxim Prokhorov
f890a06fc5 rfb refactoring
- RF_... -> RFB_...
- rework rcswitch integration, support variable length payload
- rework rfbridge parser (not tested)
- rework settings scanning routine when trying to match rf payload
  with the relay ID
- update build tests
2020-08-23 11:48:50 +03:00
Rui Marinho
6266930a4d sns: Add BME680 (#2295)
Add support for BME680 using libalgobsec proprietary algorithms for precise Indoor Air Quality (IAQ) measurement. Unlike traditional CO2 sensors - and good ones are expensive - it measures nearly all VOCs compounds in the air (plus other gases) and compensates those measurements with its built-in temperature and humidity sensors to determine indoor air quality.

Co-authored-by: Max Prokhorov <prokhorov.max@outlook.com>
2020-08-02 09:12:38 +03:00
Max Prokhorov
7b57274d1f sensor: Add PZEM004T V3.0 (#2283)
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.
2020-07-03 23:25:33 +03:00
Max Prokhorov
b8fc8cd1fd Terminal: change command-line parser (#2247)
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.
2020-05-25 23:41:37 +03:00
Albert Weterings
ff2718e8ca KingArt WiFi Curtain Switch (#2063)
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"
2020-05-01 12:45:41 +03:00
Maxim Prokhorov
455b5b1abc Add missing headers 2020-05-01 10:19:26 +03:00
Max Prokhorov
fcba0ce0fb Fix rfbridge function names and order (#2236)
* rfbridge: fix names and ordering

* build rfbridge
2020-04-30 22:08:44 +03:00
Alexander
49995d92d1 Add HDC1080, fix ADC_MODE_VALUE use in preprocessor (#2227)
* 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>
2020-04-25 07:46:37 +03:00
Max Prokhorov
b500273029 sns: add SI1145 sensor (#2216)
Co-authored-by: Joop Hilverink <33230021+HilverinkJ@users.noreply.github.com>
2020-04-08 01:48:45 +03:00
Maxim Prokhorov
ee7356b91a relay: clean-up for ota .bin 2020-03-13 09:28:15 +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
Max Prokhorov
d9482b917b rfm69: fix types of settings (#2141)
* rfm69: fix types of settings

* down
2020-02-09 04:41:31 +03:00
Max Prokhorov
80bff31d8a Thingspeak: cleanup (#2140)
* Thingspeak: cleanup

* fix sync client config, refactoring

* revert changes in tspk config

* inheritance

* fix empty wificlient
2020-02-09 04:41:18 +03:00
Max Prokhorov
0d40d2275a Load sensor classes later (#2128)
* Sensors: refactor configuration

- move sensor implementaion to the .ino,
  remove dependency undef / define from sensor files
- update test/build/sensor.h from SENSOR_SUPPORT
- allow to change sensor config variables externally
- `#include <...>` for global headers and libraries,
  fix relative path for math library

* add missing sns <-> i2c dependency

* ledrelay should return relay_none as default

* rollback to original test header

* include debug header when requested (relative)
2020-02-04 02:14:31 +03:00
Max Prokhorov
37763f1ad4 Test: check core feature build (#2080)
* Test: check core feature build

* order

* add missing
2019-12-21 16:13:29 +03:00
Max Prokhorov
ca56e0e4c1 Add THERMOSTAT_SUPPORT=1 to the sensor tests 2019-11-21 02:47: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
Niek van der Maas
f588893373 Use generic typechecks, OTA add followRedirects (#1974)
* Use generic typechecks, OTA add followRedirects

* revamp using is_detected

* relative include

* mention ts draft instead, fix c++17 includes (still not buildable)

* typo

* Always create WiFiClient pointer

* Remove old CREATE_CHECK macro

* do not create wificlient obj when running old Core
2019-11-18 02:45:49 +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
Maxim Prokhorov
b36e5ee396 test: allow to run a single configuration test, improve commandline handling 2019-10-22 15:17:22 +03:00
Max Prokhorov
d0a137ce94 Test: move travis boards outside of hardware header (#1943)
* travis: move build flags tests outside of hardware header

* mqtt: fix typo

* travis: use files instead of bundling test cases into script

* fixup! travis: use files instead of bundling test cases into script

* fix variable expansion, remove custom h at the end

* add ade7953 to sensors list

* custom.h path as variable

* shellcheck

* fix printf syntax, silent again

* fix bash 4.3 treating empty array as unset variable
2019-10-16 14:23:19 +03:00