mirror of
https://github.com/nuttytree/ESPHome-Devices.git
synced 2024-08-30 18:12:19 +00:00
Finalize scripture of the day
This commit is contained in:
parent
e89f14c63d
commit
a353464bf6
@ -32,7 +32,7 @@
|
|||||||
> This is a [Shelly 2.5 Double Relay Switch](https://www.amazon.com/gp/product/B07RRD13DJ/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&psc=1) that is controlling the main pump on my pool and the auxillary pump that runs the pool cleaner. It turns the pump on and off through out the day and off at night (when we are least likely to be using the pool and when you get the most heat/water loss if the pump is running) and turns on the cleaner for a couple of hours in the morning. It also has some modes for Off (during the winter) and Continous when I need extra cleaning.
|
> This is a [Shelly 2.5 Double Relay Switch](https://www.amazon.com/gp/product/B07RRD13DJ/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&psc=1) that is controlling the main pump on my pool and the auxillary pump that runs the pool cleaner. It turns the pump on and off through out the day and off at night (when we are least likely to be using the pool and when you get the most heat/water loss if the pump is running) and turns on the cleaner for a couple of hours in the morning. It also has some modes for Off (during the winter) and Continous when I need extra cleaning.
|
||||||
|
|
||||||
> ### [Scripture of the Day Melissa](./devices/scripture_of_the_day_melissa.yaml)/[Scripture of the Day Mayson](./devices/scripture_of_the_day_mayson.yaml)
|
> ### [Scripture of the Day Melissa](./devices/scripture_of_the_day_melissa.yaml)/[Scripture of the Day Mayson](./devices/scripture_of_the_day_mayson.yaml)
|
||||||
> This is a project I just started working on recently, the code is complete but the build is not quite done. I am planning on building 2 of them as Christmas presents for my wife and son. It will consist of a [ESP32 e-Paper Panel Driver Board](https://www.waveshare.com/product/displays/e-paper-esp32-driver-board.htm) powered by a [lithium battery](https://www.amazon.com/dp/B0867KDMY7/?coliid=IE0LBNACFHG4U&colid=1LOK862UA8LA0&psc=1&ref_=lv_ov_lig_dp_it) and [TP4056 lithium battery charger module](https://www.amazon.com/dp/B06XQRQR3Q/?coliid=I1B2ELKKLLKAK0&colid=1LOK862UA8LA0&psc=1&ref_=lv_ov_lig_dp_it) and driving a [Waveshare 7.5inch 800×480 E-Ink display](https://www.waveshare.com/7.5inch-e-paper.htm) all mounted inside a wood frame I am building. The plan is to have it sit in deep-sleep most of the time but wake up every night, grab a random scripture from the [Our Manna Daily Verses API](http://www.ourmanna.com/verses/api/), update the display with the verse, and go back to sleep. I need to take the display back out of the frame, do some sanding, stain the wood, build the circuit board, and assemble it all but this is what the first one looks like so far.
|
> This project was one of the first projects I have done that I would call woodworking. I made 2 of these as Christmas presents for my wife and son. They consist of an [ESP32 e-Paper Panel Driver Board](https://www.waveshare.com/product/displays/e-paper-esp32-driver-board.htm) powered by a [lithium battery](https://www.amazon.com/dp/B0867KDMY7/?coliid=IE0LBNACFHG4U&colid=1LOK862UA8LA0&psc=1&ref_=lv_ov_lig_dp_it) and [TP4056 lithium battery charger module](https://www.amazon.com/dp/B06XQRQR3Q/?coliid=I1B2ELKKLLKAK0&colid=1LOK862UA8LA0&psc=1&ref_=lv_ov_lig_dp_it) and driving a [Waveshare 7.5inch 800×480 E-Ink display](https://www.waveshare.com/7.5inch-e-paper.htm). The ESP32 sits in deep-sleep most of the time but wakes up every night, grabs a random scripture from the [Our Manna Daily Verses API](http://www.ourmanna.com/verses/api/), updates the display with the verse, and goes back to sleep.
|
||||||
> <br/><br/>
|
> <br/><br/>
|
||||||
> <img src="./images/scripture_of_the_day/front.jpg" alt="Front" width="600" /><img src="./images/scripture_of_the_day/back.jpg" alt="Back" width="600" />
|
> <img src="./images/scripture_of_the_day/front.jpg" alt="Front" width="600" /><img src="./images/scripture_of_the_day/back.jpg" alt="Back" width="600" />
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ using namespace esphome;
|
|||||||
class ScriptureOfTheDay : public Component {
|
class ScriptureOfTheDay : public Component {
|
||||||
public:
|
public:
|
||||||
float get_setup_priority() const override { return setup_priority::LATE; }
|
float get_setup_priority() const override { return setup_priority::LATE; }
|
||||||
void setup() override { update_at_ = millis() + 4000; }
|
void setup() override { update_at_ = millis() + 6000; }
|
||||||
void loop() override;
|
void loop() override;
|
||||||
|
|
||||||
void set_http_request(http_request::HttpRequestComponent *http_request) { http_request_ = http_request; }
|
void set_http_request(http_request::HttpRequestComponent *http_request) { http_request_ = http_request; }
|
||||||
@ -43,7 +43,7 @@ class ScriptureOfTheDay : public Component {
|
|||||||
|
|
||||||
void ScriptureOfTheDay::loop()
|
void ScriptureOfTheDay::loop()
|
||||||
{
|
{
|
||||||
// If we try to make the request to soon it fails so we delay 4 seconds
|
// If we try to make the request to soon it fails so we delay 6 seconds
|
||||||
if (millis() > update_at_)
|
if (millis() > update_at_)
|
||||||
{
|
{
|
||||||
// If we get an especially long verse that won't fit on the display we try again.
|
// If we get an especially long verse that won't fit on the display we try again.
|
||||||
@ -60,6 +60,7 @@ void ScriptureOfTheDay::loop()
|
|||||||
|
|
||||||
void ScriptureOfTheDay::display_scripture()
|
void ScriptureOfTheDay::display_scripture()
|
||||||
{
|
{
|
||||||
|
// Don't do anything if we haven't gotten the new scripture yet
|
||||||
if (scripture_.size() == 0)
|
if (scripture_.size() == 0)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
@ -69,7 +70,6 @@ void ScriptureOfTheDay::display_scripture()
|
|||||||
int currentPosition = STARTING_POSITION + (SPACE_BETWEEN_LINES / 2) * (MAX_VERSE_LINES - verseLineCount);
|
int currentPosition = STARTING_POSITION + (SPACE_BETWEEN_LINES / 2) * (MAX_VERSE_LINES - verseLineCount);
|
||||||
for (int i = 0; i < verseLineCount; i++)
|
for (int i = 0; i < verseLineCount; i++)
|
||||||
{
|
{
|
||||||
ESP_LOGD("Nuttytree", scripture_[i].c_str());
|
|
||||||
display_->print(400, currentPosition, verse_font_, TextAlign::CENTER, scripture_[i].c_str());
|
display_->print(400, currentPosition, verse_font_, TextAlign::CENTER, scripture_[i].c_str());
|
||||||
currentPosition += SPACE_BETWEEN_LINES;
|
currentPosition += SPACE_BETWEEN_LINES;
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
substitutions:
|
substitutions:
|
||||||
device_id: scripture_of_the_day_mayson
|
device_id: scripture_of_the_day_mayson
|
||||||
device_name: Scripture of the Day Mayson
|
device_name: Scripture of the Day Mayson
|
||||||
log_level: debug
|
|
||||||
|
|
||||||
packages:
|
packages:
|
||||||
device_base: !include ../packages/scripture_of_the_day.yaml
|
device_base: !include ../packages/scripture_of_the_day.yaml
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
substitutions:
|
substitutions:
|
||||||
device_id: scripture_of_the_day_melissa
|
device_id: scripture_of_the_day_melissa
|
||||||
device_name: Scripture of the Day Melissa
|
device_name: Scripture of the Day Melissa
|
||||||
log_level: debug
|
|
||||||
|
|
||||||
packages:
|
packages:
|
||||||
device_base: !include ../packages/scripture_of_the_day.yaml
|
device_base: !include ../packages/scripture_of_the_day.yaml
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 2.0 MiB After Width: | Height: | Size: 3.4 MiB |
Binary file not shown.
Before Width: | Height: | Size: 1.4 MiB After Width: | Height: | Size: 3.1 MiB |
@ -13,11 +13,6 @@ esphome:
|
|||||||
build_path: ../build/${device_id}
|
build_path: ../build/${device_id}
|
||||||
includes:
|
includes:
|
||||||
- ../custom/scripture_of_the_day.h
|
- ../custom/scripture_of_the_day.h
|
||||||
# on_boot:
|
|
||||||
# priority: -100
|
|
||||||
# then:
|
|
||||||
# - delay: 4s
|
|
||||||
# - lambda: Scripture->update_scripture();
|
|
||||||
|
|
||||||
<<: !include ../components/wifi/wifi_dhcp.yaml
|
<<: !include ../components/wifi/wifi_dhcp.yaml
|
||||||
|
|
||||||
@ -33,11 +28,11 @@ custom_component:
|
|||||||
Scripture->set_fonts(verse_font, reference_font);
|
Scripture->set_fonts(verse_font, reference_font);
|
||||||
return {Scripture};
|
return {Scripture};
|
||||||
|
|
||||||
# Setting run duration to 15s, if we aren't done by then something went wrong so we restart to save battery
|
# Setting run duration to 30s, if we aren't done by then something went wrong so we shutdown to save battery
|
||||||
# Setting a default sleep time of 15min that will only apply if we forced a shutdown after the 15s run duration
|
# Setting a default sleep time of 15min that will only apply if we forced a shutdown after the 30s run duration
|
||||||
deep_sleep:
|
deep_sleep:
|
||||||
id: deep_sleep_cmp
|
id: deep_sleep_cmp
|
||||||
run_duration: 15s
|
run_duration: 30s
|
||||||
sleep_duration: 15min
|
sleep_duration: 15min
|
||||||
|
|
||||||
display:
|
display:
|
||||||
|
Loading…
Reference in New Issue
Block a user