Max Prokhorov
cae50fa544
sensor/emon: refactoring ( #2213 )
- 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.
4 years ago
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
4 years ago
Xose Pérez
175fcbf6cf
Support for WPS in core build. Using UNUSED macro to prevent warnings
5 years ago
Xose Pérez
546c8f09b2
Update Copyright notice
5 years ago
Xose Pérez
feffc290cc
Sensor type, value and slot methods should not set error values
7 years ago
Xose Pérez
c0215f0a16
Error reset on _pre for different sensors
7 years ago
Xose Pérez
947f9bab73
I2C sensors using new i2c interface
7 years ago
Xose Pérez
af805ab045
Update copyright notices
7 years ago
Xose Pérez
18c69f0a1e
Several fixes related to dependencies between modules
7 years ago
Xose Pérez
e1baf48b9b
Option to disable completely new sensors module
7 years ago
Xose Pérez
2bc8794919
Move I2C code in BaseSensor to I2CSensor
7 years ago
Xose Pérez
6e839e3d72
Added sensor IDs
7 years ago
Xose Pérez
c975b11226
Tentative to sensor manifest
7 years ago
Xose Pérez
de4780efbc
Added getters for sensors
7 years ago
Xose Pérez
3ca68576f5
ExpectedPower method for EMON sensors
7 years ago
Xose Pérez
4e454331d4
Improved I2C auto-discover avoiding collissions
7 years ago
Xose Pérez
feeebf9fb3
Move multiple channel support in EMON to base class
7 years ago
Xose Pérez
42f5ee5376
Flag sensor changes to avoid reinitializing them if unnecessary
7 years ago
Xose Pérez
8728d55b7b
Change sensor API, force parameter-less constructors
7 years ago
Xose Pérez
ef04f72228
Headers for Sensor and Filter classes
7 years ago
Xose Pérez
65831b95e4
Fix read call in EmonAnalog and EmonADC121
7 years ago
Xose Pérez
1b3927615e
Enable/disable magnitudes for Emon sensors
7 years ago
Xose Pérez
edf9d465ba
Improve ADS1115 speed to 1450 SPS, keep separate pivot for each channel
7 years ago
Xose Pérez
bfb9cb3a54
Properly name ADC channels
7 years ago
Xose Pérez
6f58170ace
Support for energy monitor based on ADS1115, still WIP
7 years ago
Xose Pérez
2d37a53e2a
Improve EMON sensors
7 years ago
Xose Pérez
808528c507
Porting EMON_ADC121 to new sensor module
7 years ago