Thermostat controlled pellet stove relay.
Ultrasonic pellet fuel hopper level sensor.
I thought it would be helpful to monitor the pellet level of my wood pellet stove and automate refilling when necessary.
I had already set up a low-voltage relay connected to the stove for thermostat control, integrated with my Schedy heating schedule using input Boolean occupancy detection.
So, I simply swapped the old relay for a D1 mini and a relay shield.
I initially added a DS18B20 temperature sensor shield, but later removed it because it interfered with the ultrasonic sensor.
Here’s the cost breakdown of the components:
- D1 mini: $5
- D1 mini relay shield: $2
- Ultrasonic Module HC-SR04 Distance Sensor: $2
Temporary project box until I 3D print a new box to fit all the components.
ESPHOME
esphome:
name: pellet_controller
platform: ESP8266
board: d1_mini
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
power_save_mode: none
#IP Address: 192.168.2.105
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
web_server:
version: 3 # Specify the web server version
port: 80
captive_portal:
# Enable logging
logger:
# Enable Home Assistant API
api:
ota:
- platform: esphome
sensor:
- platform: ultrasonic
trigger_pin: D4
echo_pin: D3
name: "pellet level in percent"
update_interval: 60s
#removed
# - platform: dallas_temp
# name: "pellet stove Temperature"
# address: "0xB303139779A1FE28"
# Optional variables:
icon: "mdi:sack-percent"
accuracy_decimals: 0
filters:
# Calculates in %
# Replace 0.46 by the height of hopper. From the sensor to the bottom.
# I used this website to know how I should multiply my values :https://www.skillsyouneed.com/num/percent-change.html
- lambda: return (0.46-x)*(100/0.46);
unit_of_measurement: "%"
#- platform: ultrasonic
# trigger_pin: D4
# echo_pin: D3
# update_interval: 30s
#Optional variables:
# icon: "mdi:sack-percent"
# filters:
#Replace the 0.46 by the height of hopper. From the sensor to the bottom.
# I multiplied by 100 in order to get CM since the sensor works in meters
# - lambda: return (0.46-x)*100;
# unit_of_measurement: "cm"
################ diag ###################
#Device UPTIME
- platform: uptime
name: Uptime
id: sys_uptime
update_interval: 60s
#Device RSSI
- platform: wifi_signal
name: RSSI
id: wifi_signal_db
update_interval: 60s
entity_category: "diagnostic"
one_wire:
- platform: gpio
pin: D2
switch:
- platform: gpio
name: "pellet_stove_relay"
pin: D1
#Exposes control buttons
button:
- platform: restart
icon: mdi:power-cycle
name: "ESP Reboot"
time:
- platform: sntp
id: time_sntp
Node red flow for random alexa messages when level gets low.
[{"id":"5eec722a.87ac8c","type":"tab","label":"pellets","disabled":false,"info":""},{"id":"fd5738bb.a8f118","type":"api-call-service","z":"5eec722a.87ac8c","name":"turn off lights","server":"ceea5ac5.1b1658","version":1,"debugenabled":false,"service_domain":"switch","service":"turn_off","entityId":"switch.garage_light, switch.driveway_light","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":630,"y":80,"wires":[[]]},{"id":"81055a15.3fda38","type":"delay","z":"5eec722a.87ac8c","name":"","pauseType":"delay","timeout":"15","timeoutUnits":"minutes","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":470,"y":80,"wires":[["fd5738bb.a8f118"]]},{"id":"bd26d583.2beb68","type":"server-state-changed","z":"5eec722a.87ac8c","name":"pellet level","server":"ceea5ac5.1b1658","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"sensor.pellet_level_in_percent","entityidfiltertype":"exact","outputinitially":true,"state_type":"num","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":false,"for":"","forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"x":80,"y":100,"wires":[["195c90a5.5c30af"]]},{"id":"d0a5c7d9.3c0718","type":"api-call-service","z":"5eec722a.87ac8c","name":"alexa say ","server":"ceea5ac5.1b1658","version":1,"debugenabled":true,"service_domain":"notify","service":"alexa_media_moms_room_dot","entityId":"","data":"{\"message\":\"{{payload}}\",\"data\":{\"type\":\"tts\"}}","dataType":"json","mergecontext":"","output_location":"payload","output_location_type":"msg","mustacheAltTags":false,"x":680,"y":360,"wires":[[]]},{"id":"4354ce85.085d3","type":"api-call-service","z":"5eec722a.87ac8c","name":"alexa say ","server":"ceea5ac5.1b1658","version":1,"debugenabled":true,"service_domain":"notify","service":"alexa_media_kitchen_echo_dot","entityId":"","data":"{\"message\":\"{{payload}}\",\"data\":{\"type\":\"tts\"}}","dataType":"json","mergecontext":"","output_location":"payload","output_location_type":"msg","mustacheAltTags":false,"x":680,"y":320,"wires":[[]]},{"id":"11ae4a5a.95b376","type":"switch","z":"5eec722a.87ac8c","name":"","property":"payload","propertyType":"msg","rules":[{"t":"btwn","v":"10","vt":"num","v2":"28","v2t":"num"}],"checkall":"true","repair":false,"outputs":1,"x":370,"y":140,"wires":[["a0085c07.65023"]]},{"id":"195c90a5.5c30af","type":"range-for","z":"5eec722a.87ac8c","name":"","above":"","below":"28","for":"5","units":"min","continuous":false,"x":210,"y":160,"wires":[["11ae4a5a.95b376"],[]]},{"id":"7b2a5bfd.635a74","type":"inject","z":"5eec722a.87ac8c","name":"31","props":[{"p":"payload"},{"p":"topic","v":"","vt":"num"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"31","payloadType":"num","x":50,"y":280,"wires":[["195c90a5.5c30af"]]},{"id":"a0085c07.65023","type":"time-range-switch","z":"5eec722a.87ac8c","name":"","lat":"","lon":"","startTime":"07:00","endTime":"22:30","startOffset":0,"endOffset":0,"x":520,"y":200,"wires":[["c72d9bbc.14ee88"],[]]},{"id":"3d06733c.aa49dc","type":"api-call-service","z":"5eec722a.87ac8c","name":"turn off boolean","server":"ceea5ac5.1b1658","version":1,"debugenabled":false,"service_domain":"input_boolean","service":"turn_off","entityId":"input_boolean.pellets_low","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":420,"y":540,"wires":[[]]},{"id":"c72d9bbc.14ee88","type":"api-call-service","z":"5eec722a.87ac8c","name":"input need pellets on","server":"ceea5ac5.1b1658","version":1,"debugenabled":false,"service_domain":"input_boolean","service":"turn_on","entityId":"input_boolean.pellets_low","data":"","dataType":"jsonata","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":620,"y":140,"wires":[[]]},{"id":"51945849.e946f8","type":"switch","z":"5eec722a.87ac8c","name":"","property":"payload","propertyType":"msg","rules":[{"t":"btwn","v":"30","vt":"num","v2":"95","v2t":"num"}],"checkall":"true","repair":false,"outputs":1,"x":310,"y":480,"wires":[["3d06733c.aa49dc"]]},{"id":"c8160e0f.f0ddd","type":"range-for","z":"5eec722a.87ac8c","name":"","above":"30","below":"","for":"5","units":"min","continuous":false,"x":150,"y":520,"wires":[["51945849.e946f8"],[]]},{"id":"cf2df0ad.95a2e","type":"server-state-changed","z":"5eec722a.87ac8c","name":"pellet level full turn off","server":"ceea5ac5.1b1658","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"sensor.pellet_level_in_percent","entityidfiltertype":"exact","outputinitially":true,"state_type":"num","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":false,"for":"","forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"x":100,"y":440,"wires":[["c8160e0f.f0ddd"]]},{"id":"82e4c7b9.879a68","type":"api-call-service","z":"5eec722a.87ac8c","name":"alexa say ","server":"ceea5ac5.1b1658","version":1,"debugenabled":true,"service_domain":"notify","service":"alexa_media_carlene_s_echo_dot","entityId":"","data":"{\"message\":\"{{payload}}\",\"data\":{\"type\":\"tts\"}}","dataType":"json","mergecontext":"","output_location":"payload","output_location_type":"msg","mustacheAltTags":false,"x":680,"y":400,"wires":[[]]},{"id":"169b3b7.23a99c5","type":"server-state-changed","z":"5eec722a.87ac8c","name":"need pellets message on","server":"ceea5ac5.1b1658","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"input_boolean.pellets_low","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"30","halt_if_type":"str","halt_if_compare":"is","outputs":2,"output_only_on_state_change":true,"for":"1","forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"x":180,"y":380,"wires":[["1a08494.f4d8bb7"],[]]},{"id":"1a08494.f4d8bb7","type":"function","z":"5eec722a.87ac8c","name":"random message","func":"var line1 = [\"Heya anyone there?, \", \"Yo People of the house, \", \"Hello You yes you, \", \"howdy-do house guest, \"]\nvar line2 = [\n \"The pellet stove \", \"the heater \", \"the thing that keep you toasty \", \"The furnace \", \"The pellet stove \"\n ]\nvar line3 = [\n \"wanted you to know \",\n \"Asked me to tell you \",\n \"Told me to pass along to you \",\n \"Ordered me to tell you \",\n \"Shared with me \"\n ]\nvar line4 = [\n \"its hopper hungry, \", \"Its time to fill with Pellets, \", \" it needs stove chow, \", \" the hopper is low , \"\n ]\nvar line5 = [\n \"pellets now or cold later.\", \"time for a 40 pound workout.\", \"dont go to bed cold.\", \"I know I am annoying you \"\n ]\nmsg.payload =\n\nline1[Math.floor(Math.random() * line1.length)]+\nline2[Math.floor(Math.random() * line2.length)]+\nline3[Math.floor(Math.random() * line3.length)]+\nline4[Math.floor(Math.random() * line4.length)]+\nline5[Math.floor(Math.random() * line4.length)]\n\nreturn msg","outputs":1,"noerr":0,"initialize":"","finalize":"","x":490,"y":400,"wires":[["4354ce85.085d3","d0a5c7d9.3c0718","82e4c7b9.879a68"]]},{"id":"ceea5ac5.1b1658","type":"server","name":"Home Assistant","legacy":false,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true}]
My Background
I am no expert just learning and having fun.
I have been an avid user of smart home electronics, currently managing over 200 local, off-the-cloud smart devices in our home. I started off using eWeLink with IFTTT, then branched out to Home Assistant and began converting Sonoff and other devices with Tasmota in 2016. This has allowed me to automate various aspects of my home, including heating and evaporative cooling systems. My journey into the world of home automation took a significant leap with the help of creators like Digiblur DIY, Dr. ZZZs, and many other helpful people on Discord when I started experimenting with Home Assistant in 2016. The experience has been both rewarding and educational.
Some of my projects involve playing with WLED and ESPHome, which have been incredibly fun. Additionally, I’ve successfully created an automatic fish feeder, hacked lamps, and made my pellet stove smart, showcasing my penchant for blending technology with creativity.
With over 35 years of experience in installing and servicing hearth products, I specialize in gas and wood pellet-burning stoves. This extensive background has honed my skills and expertise in the industry, allowing me to provide top-notch service to my clients.
Home automation has become a much-needed hobby, offering a perfect blend of technical challenges and innovative solutions. I continue to explore new ways to enhance my living environment through automation.
Feel free to check out my Facebook page: DIY Redneck - The Stove Doc.
my Facebook page diyredneck.thestovedoc.com
and my stovedoc page