MH-Z19B allows to enable/disable 'automatic baseline calibration',
which is enabled by default (MH-Z19B v1.2 datasheet).
It operates on too short 24hr interval. So if the place
where sensor is located is not ventilated well "every" day, ABC will
make sensor under-report CO2 value, since baseline (400ppm) is moved
to lowest observed value in 24hr.
With such short recalibrartion window, sensor often doesn't show
correct CO2 levels when ABS is left enabled. Disable it on boot
defaut and add 'automatic_baseline_calibration' option to allow
override from config.
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
it will allow to report exact sensor type in dump config
and later will be used for turning off autocalibration.
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reported CO2 might be not correct while sensor is booting and
while it boots it reports value 15000 in response at offset
6-7. So skip reporting till this value is being reurned.
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
When sensor is connected to hardware uart, sometimes on boot
uart's RX buffer contains several bytes of junk. Workaround it
by draining all of it before sending command.
Also turn on cleanup logic only if problem is detected (i.e.
when reply from sensor doesn't look correct.
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
update() is supposed to deal with reading and updating CO2/Temp,
while response checksum verification applies to other responses
as well.
Move check into mhz19_write_command_() that handles communications
with sensor.
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
it should help with debbuging issues if debugging is enabled.
Also it adds buffer dump function that will be used later
to dump invalid responses.
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
per spec request and response are of the same length,
simplify code by using the same length buffers. It should
help later when more code that uses buffers are added.
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
flush() is used to flush TX buffer, but there weren't anything
written to TX yet, so it's pointless to call flush() so early.
Remove unnecessary call.
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
* Erase all flash for USB uploads on ESP8266s
Previously, only erased "write regions".
Downside: Config for other FWs like tasmota could be affected
Upside: Potentially fixes some ESP8266 connection issues
Related: https://github.com/esphome/issues/issues/455#issuecomment-503524479
* Clear WiFi settings for ESP8266
Clears wifi settings from retained storage on ESP8266 (if set).
Unsure if this is the actual issue, but it won't cause problems either.
* Update wifi_component_esp8266.cpp
* Revert erase chip for testing
* Improve wait_time calculation
* Adding bitmask to narrow compare of received codes
Updated test to add mask configuration
* Lint
* Handle bitmask as ignore characters per review comment
* Fixed test to cover ignore bits
* Lint
* Eliminate separate set_mask method per review comment
* Provide the lights current color to the addressable_lambda_effect.
* Fix formatting
* More formatting
* Change the call signature of the lambda
* lint
Co-authored-by: olg <x>
* Enabling tilt control in the template cover
Added test
Add tilt option to publish action
* Added CONF_TILT to alidation schema per comment
* Removed default for CONF_TILT
* Atmel M90E32AS Energy Metering IC. Found in CircuitSetup 2can and 6chan energy meters
* fix style bugs
* Update esphome/components/atm90e32/atm90e32.cpp
Co-Authored-By: Otto Winter <otto@otto-winter.com>
* Properly put atm90e32_reg in namespace
* Use phase grouped config like ina3221
* Log why the component is marked failed, did not read back our register value
* 32bit register reads are 2s compliment
* Fix atm90e32 option name in test
* clang-format changes from travis-ci
* use new protected method names
* Whitespace changes to please Travis
* Update esphome/components/atm90e32/atm90e32.cpp
Co-Authored-By: Otto Winter <otto@otto-winter.com>
* Fix up type change for val_h/val_l
* Remove conditions around values with defaults
* Rename constants to match their value
* Remove 2's complement check
Co-authored-by: Andrew Thompson <andrew@whosonlocation.com>
Co-authored-by: Otto Winter <otto@otto-winter.com>