Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support MQTT or Home Assistant #8

Open
runty opened this issue Aug 22, 2024 · 10 comments
Open

Support MQTT or Home Assistant #8

runty opened this issue Aug 22, 2024 · 10 comments

Comments

@runty
Copy link

runty commented Aug 22, 2024

This would also make it easy to import into other home platforms

@babldev
Copy link
Contributor

babldev commented Aug 22, 2024

also requested by @glenrobertson

@babldev
Copy link
Contributor

babldev commented Aug 27, 2024

I hear Home Assistant has some time series features as well so maybe that will also help with #3

@runty
Copy link
Author

runty commented Aug 28, 2024

yes, automatically with graphing, many ways to show data, etc

@dogshapedangel
Copy link

This would be an extremely powerful addition. +1

@dogshapedangel
Copy link

It might be worth taking a look at the Aranet4's HA implementation as it actually uses Bluetooth (I think BLE specifically), granted this is only the HA half of that.

https://github.com/home-assistant/core/tree/dev/homeassistant/components/aranet
https://www.home-assistant.io/integrations/aranet/

It would be ideal to have this data accessible via both Wi-Fi and Bluetooth but I can understand if pursuing one option first would be simpler.

@dogshapedangel
Copy link

dogshapedangel commented Oct 20, 2024

@runty @glenrobertson If you are OK with forgoing display support in the interim, I have crafted an ESPHome config that allows you to run Bitclock with ESPHome firmware, sending data straight to Home Assistant.

https://github.com/manedfolf/bitclock/blob/esphome/bitclock-esphome/bitclock-esphome.yaml

It does not support the included display at this time since ESPHome doesn't have component support for the 2.71in Pervasive Displays E2271KS0C1 e-ink display. It would be possible to craft a custom component/driver for ESPHome, but that is admittedly not something I readily know how to do. It would still be very cool to be able to do custom screens directly within ESPHome. Granted, all of that is well outside of the scope of this project/repo so I have no expectation of support on this unless it piques the developer's interest.

Screenshot 2024-10-19 at 10 31 55 PM

@babldev
Copy link
Contributor

babldev commented Oct 20, 2024

@manedfolf nice work!

Pretty amazing you can do that with just a few lines in a YAML file

@babldev
Copy link
Contributor

babldev commented Oct 20, 2024

@manedfolf One thing to note is if you use direct sensor readings I assume you'll lose the "fudge factors" to correct temp + humidity.

// SHT4x is supposed to be "factory calibrated" but at least
// in my testing it reads overly hot by 4 deg C.
//
// This could be from various factors:
// - Self-heating via sensor / PCB
// - Bad enclosure ventilation
// - PCBA manufacturing errors
// - Sensor not meeting specification
//
// So let's modify it in a linear fashion based on a reference thermometer
// at 2 points.
//
// Linear calibration based on semi-scientific testing with the rev5
// enclosure Observations: 29.06 deg C should be 25.61
// 7.59 deg C should be 3.67
degCEnclosureOffset = degC * 0.022 - 4.08;
degC = degC + degCEnclosureOffset;

// Because are temperature is offset by PCB/Enclosure heating
// We need to compensate the RH too. See
// "App Notes Humidity at a Glance" for the source of this equation:
//
// RH2 = RH1*exp(4283.78*(T1-T2)/(243.12+T1)/(243.12+T2));
//
// T1 = degC - degCEnclosureOffset
// T2 = degC
//
// It's ~1.22x at 26deg C compensated temp
//
relativeHumidityEnclosureMultiplier =
exp((4283.78 * -degCEnclosureOffset) /
((243.12 + degC - degCEnclosureOffset) * (243.12 + degC)));
rh_pRH *= relativeHumidityEnclosureMultiplier;

@dogshapedangel
Copy link

dogshapedangel commented Oct 20, 2024

@babldev I can’t speak to the actual code behind it, but I believe the library does include configuration options for some kind of compensations

https://esphome.io/components/sensor/sht4x.html

@glenrobertson
Copy link

@dogshapedangel I like the esphome solution you have! Before I discovered that, I put together these changes that will report data over MQTT in the homeassistant discovery message format: #13

It would just need some changes to the web UI as well to accept an MQTT url.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants