Open stas-sl opened 1 year ago
The simplest solution would be probably to run heater at the end of update()
after measurements being read on every (or every N) update_interval
. Thus we'll have max possible cool off time till next measurement. For example for update_interval=60s and Long(1s) heater duration effective heater duty will be 1/60=~1.7%.
As a workaround until this is implemented you can do it manually in config:
sensor:
- platform: sht4x
id: sht41
update_interval: 60s
temperature:
name: "SHT41 Temperature"
id: sht41_temp
on_value:
then:
- lambda: |-
id(sht41)->write_command((uint8_t)0x2F); // run heater: medium power, long duration (1s)
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
The problem
There are 2 issues with SHT4x heater implementation currently:
heater_command_
is actually a command not an index, so accessingMEASURECOMMANDS[heater_command_]
will result in out of bounds error.heater_max_duty: 0.01
andheater_time: Short (110ms)
, which resulted in turning heater on every 11 seconds for 110ms. As update_interval (e.g. 60s) is independent of heater_interval, some of them will inevitable co-occur in time.TBH I'm not sure what would be the best way how to solve the latter issue in general case as it depends on update_interval/max_duty/heater_time/heater_power.
Which version of ESPHome has the issue?
2023.2.0
What type of installation are you using?
pip
Which version of Home Assistant has the issue?
No response
What platform are you using?
ESP32
Board
No response
Component causing the issue
sht4x
Example YAML snippet
Anything in the logs that might be useful for us?
No response
Additional information
No response