GithubHelp home page GithubHelp logo

nuttytree / esphome-devices Goto Github PK

View Code? Open in Web Editor NEW
106.0 12.0 14.0 23.1 MB

A collection of ESPHome custom components, configuration files, and custom code for my various ESP8266/ESP32 devices that integrate with Home Assistant.

License: MIT License

C++ 78.07% Python 19.31% PowerShell 2.62%
esphome esphome-config esphomeyaml home-automation homeassistant esp8266 esp32 tuya treo feit

esphome-devices's Introduction

ESPHome-Devices

Overview

This is a collection of ESPHome custom components, configuration files, and custom code for my various ESP8266/ESP32 devices that integrate with Home Assistant. I am using includes and packages pretty extensively in order to prevent duplication and allow for easy changing of common settings.

What is ESPHome

ESPHome is a system to control your ESP8266/ESP32 by simple yet powerful configuration files and control them remotely through Home Automation systems. For more information checkout ESPHome.io.

What is Home Assistant

Home Assistant is open source home automation that puts local control and privacy first. Powered by a worldwide community of tinkerers and DIY enthusiasts. Perfect to run on a Raspberry Pi or a local server. For more information check out Home-Assistant.io.

Folder Structure

  • / - Yaml files for my devices and other core files
  • /components - Custom components
  • /custom - Other custom code that are not components
  • /images - Pictures of some of my devices
  • /other - Other misc files
  • /packages - Shared packages used by my devices
  • /scripts - Couple of PowerShell scripts for managing the repo

Secrets Management

You will notice that throughout the various folders I have secrets.yaml files. These files all do an include of the secrets.yaml file in the root folder (that for obvious reasons is not included in the repo). On my computer the secrets.yaml file in the root folder is a symlink to a file in my OneDrive folder. This way I have multiple backups of this file and don't have to worry about losing it and getting locked out of all my devices.

Custom Components

I have been working on updating most of my custom code into components that can easily be pulled directly from GitHub into your device configuration using the external components component. I have run into frequent issues with changes in ESPHome breaking my components so I am now tagging my repo with the version of ESPHome it is compatible with. I generally upgrade pretty quickly so as soon as I have confirmed things are working and/or made the neccessary changes I will add a tag for the new version of ESPHome. While I primarily design these components for my own personal use cases I hope that at least some of them are useful for others. If you are using one of my components and have an enhancement/feature you would like to see feel free to add an issue and I will see what I can do to get it added.

Binary Light With Power

This an enhanced version of the standard binary light component that adds an option to include a sensor to report current power usage based on a configured wattage of the light(s) it controls. More details on how to use this component are available here.

GPIO Switch With Power

This an enhanced version of the standard gpio switch component that adds an option to include a sensor to report current power usage based on a configured wattage of the device(s) it controls. More details on how to use this component are available here.

Pool Controller

This is component is curently running on a Shelly 2.5 Double Relay Switch and is used to control the main pump and the auxiliary pump (that runs a pool cleaner) on my pool. Eventually I want to expand this to run on an ESP32 and manage all aspects of my pool (pumps, lights, heat, fill, drain, pH, ORP, etc.). More details on how to use this component are available here.

TREO LED Pool Light

This is a custom light component that works with TREO LED Pool Lights and exposes the different colors as "effects" so thay can be selected from Home Assistant. More details on how to use this component are available here.

Tuya Dimmer as Fan

This a modified version of the Tuya fan component I use with Feit Dimmers (but it will likely work with other Tuya dimmers) to control bathroom fans and adds several features. I created this component because I couldn't find a regular on/off switch with the same look and feel as the Feit dimmers so I decided to use the Feit dimmers but use this component to prevent "dimming" the fan. More details on features and how to use this component are available here.

Tuya Light Plus

This an enhanced version of the standard Tuya light component that adds a bunch of extra features. I use this component with Feit Dimmers but it will likely work with other Tuya dimmers. More details on features and how to use this component are available here.

Misc Devices

This is a WEMOS D1 Mini clone that is connected to a motion sensor, a temperature/humidity/pressure sensor, and a door sensor and is used to control the lights, fan, and heater (heat lamps in the fan) in my basement bathroom.

This is a NodeMCU that I installed in my Cuisinart Coffee Maker. It has GPIO's connected to the indicator lights for the bold setting and power and has a couple of relays connected to the bold setting button and the power button. Aside from the ability to trigger automations based on the state of the coffee maker and automate turning on the coffee maker I also added a "bloom" feature. Coffee tastes better if you let the carbon dioxide escape (bloom) after getting the coffee grounds wet before continuing the brew cycle.

This is a WEMOS D1 Mini Pro that is connected to a couple of relays and a couple of water proof push buttons red and blue. The multi-click config on the fire pit switch is so that any press will turn it off but to turn it on you have to press it for 3 seconds (to try and prevent kids from turning it on). This is used to control the combination fire pit and fountain in my backyard. I just got this hooked up and is working good other then the fire pit doesn't always come on on the first try (I think I am getting some bounce in the switch but haven't had a chance to troubleshoot further).

This is a M5Stack ATOM HUB SwitchD mounted in a box on the side of my garage fridge with a PZEM-004T. It is paired with 2 Inkbird IBS-TH1 sensors for monitoring the temperature in the fridge and freezer sections. One of the relays on the M5Stack ATOM HUB SwitchD is used to control a pair of heaters that are inside the fridge to keep the fridge from dropping below freezing (frozen beer is no fun). I am not entirely happy with the parameters for the PID controller, I would like it to reach an equlibrium where the heater is on just enough to maintain the temperature at all times but instead it tends to ramp up and down quite a bit. The good news is even with the varying heat output it keeps the temperature pretty close to the desired temp. Using the autotune feature doesn't work because the bluetooth seems to cause periodic reboots which resets the autotune process. Maybe next winter I will try to create a temporary custom autotune that can survive restarts.

This is a NodeMCU that I have installed under my bed and is connected to a pair of Force Sensitive Resistors that are placed between the mattress and box spring of my bed, one for my side and one for my wife's side. Because the ESP8266 has only one analog input I had to add some transistors connected to pins D0 and D1 that are used to select which FSR is connected to the A0 analog input. The custom sensors in bed_sensor.h handles switching between the FSR's and reading the values from the FSR's. Generally when the bed is empty the reading is the full 1024 (or at least close to this). If someone is on one side of the bed or the other the reading is typically around 100. However if you lay in the middle of the bed I tend to get readings of around 600-700 on both sides. Thus the 3 different binary sensors (Chris is in Bed, Melissa is in Bed, Someone is in Bed). There is also a Master Bed Count that reports the total number of people in bed, I compare this to a sensor in Home Assistant that tracks the number of "masters" (my wife and me) that are home so that I can activate night mode when everyone is in bed.

This is a WEMOS D1 Mini Pro that is connected to a relay to control the power to the landscape lights around my patio. I used the WEMOS D1 Mini Pro because it has an external antenna. I initially used a WEMOS D1 Mini clone but the power supply for my lights was to far from the house and I kept having connectivity issues.

This is a Shelly 2.5 Double Relay Switch that is controlling the main pump on my pool and the auxillary pump that runs the pool cleaner via my custom Pool Controller Component.

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 powered by a lithium battery and TP4056 lithium battery charger module and driving a Waveshare 7.5inch 800ร—480 E-Ink display. 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, updates the display with the verse, and goes back to sleep.

FrontBack

Energy Monitor

This device is sinificantly cheaper then a Sense Energy Monitor, can monitor 16 circuits in addition to the mains (Sense can only do 2 additional), and comes with all of the additional CT clamps. Like the Sense it is intended to work with a cloud service but because it is based on an ESP32 it can be flashed with ESPHome and made a local only device. More details can be found here.

Smart Plugs

I have a bunch of these smart plugs that I use for various things where I want to monitor the power consumption and/or be able to completely turn off the power (because they have a significant standby power draw). The TOPGREENER units are cheap, can be flashed with Tuya-Convert (or they could last time I bought one), and have power monitoring.

Switches

I plan to use dimmer switches for anything that is dimmable just for consistency and you never know when you might want to have the ability to dim a light. However there are times when a dimmer isn't an option.

My basement bathroom has 4 devices (main light, fan, shower light, and heat lamps) but only 2 single gang boxes (and not enough room to swith to dual gang) so these were a perfect fit. The price is right, the buttons feel solid, and I was able to flash them using Tuya-Convert. They do seem to have corners that are squarer then typical so I had a little bit of trouble getting a standard cover to fit but nothing I couldn't fix with a file.

This is installed in place of the switch that controled my TREO LED Pool Lights. These lights have the option to select different colors by briefly turning them off and back on again and they do remember the last color when turned on again. The custom TreoLedPoolLight.h component handles tracking the current color and exposes custom "effects" for each of the colors to Home Assistant. I went with the triple switch so that I could use the third button to control my Patio Lights which otherwise do not have a physical switch. The one issue I am having with this is occasionally the "effect" on the switch gets out of sync with the actual color of the lights. It has only happened a couple of times so I haven't gotten around to investigating why it happens.

My garage lights are not dimmable so I decided to try out a Shelly device, I have this connected to a Leviton 5657-2W Momentary Center-Off Decora Rocker. Overall I am fairly happy with it I just wish the rocker switch wasn't so expensive or there was another similar option.

Dimmer Switches

After trying several dimmers I finally decided to standardize on the Feit dimmers.
Things I like about these dimmers:

  • Can be flashed using Tuya-Convert Unfortunately Feit has started shipping these with updated firmware that does not currently work with Tuya Convert. Hopefully the excellent Tuya Convert team can figure out how to work around the new firmware. Until then I did find this tutorial on flashing these devices (I have not tried this yet).
  • Have a solid feel to them
  • They can be linked via a traveler wire (this works even when flashed with ESPHome and while not mentioned in the documentation you can link more than 2 switches this way)
  • Are readily available from Amazon or Costco for an affordable price.

Things I don't like about these dimmers:

  • Have to click repeatedly to change the brightness (can't hold to change)
  • All buttons are managed by the Tuya MCU so adding things like double-taps is kind of a hack

All of my dimmers are using my custom Tuya Light Plus component.

Dimmer Switches as On/Off Fan Switches

I tried to find an on/off switch that looked/felt like the Feit dimmers to use for controlling bathroom fans but didn't find anything so I decided to use the Feit dimmers. I don't want the fans "dimmable" so I created a custom Tuya Dimmer as Fan component that changes the "brightness" back to the maximum value if changed at the switch.

esphome-devices's People

Contributors

deepsource-io[bot] avatar nuttytree avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

esphome-devices's Issues

Availability of Feit Dimmers

I got 6 through Costco, they are still available. I got two 3-packs for $39 each. I saw 2-packs in the store a few months ago. The 3-packs are available online from Costco for $45. , so they have gone from $13/each to $15/each.

They are $18 through Amazon, and there is an affiliate that has them for $16. The advantage here is that you can buy just one versus the Costco tactic of forcing you to buy 2 or 3 at a time. I don't know which is the greater evil, Costco or Amazon. :-)

I will be disassembling mine to reprogram them, they do not work with Tuya-Convert. This means taking them out of the wall, sigh. They work fine as Tuya devices but they will be so much better!

Default level not working

I have discovered that my latest code broke the default level feature on the Tuya dimmers. I have a partial fix that works if you don't have double tap enabled that I will be pushing shortly. Still hoping to find a fix when using double tap.

Scripture Of the Day Display Error

First off, I'm using the ESP32-WROOM-32D board and the same display as you had in your sample.
I'm trying to use your code to create a Quote of the Day display and I keep having my device crash. I believe I have narrowed it down ScriptureOfTheDay::display_scripture(). If I take out the following code:

  for (int i = 0; i < verseLineCount; i++)
  {
    display_->print(400, currentPosition, verse_font_, TextAlign::CENTER, scripture_[i].c_str());
    currentPosition += SPACE_BETWEEN_LINES;
  }
  display_->print(760, currentPosition, reference_font_, TextAlign::CENTER_RIGHT, scripture_[verseLineCount].c_str());

Here is the crash dump

Guru Meditation Error: Core  1 panic'ed (LoadProhibited). Exception was unhandled.
Core 1 register dump:
PC      : 0x400dcfcb  PS      : 0x00060230  A0      : 0x800dd00f  A1      : 0x3ffb1c60  
A2      : 0x00000000  A3      : 0x000000ff  A4      : 0x0000bb80  A5      : 0x3ffc6f0c  
A6      : 0x3f401960  A7      : 0x00000000  A8      : 0x00060023  A9      : 0x3ffb8098  
A10     : 0x00000000  A11     : 0x00000000  A12     : 0x80089e3c  A13     : 0x3ffb1b60  
A14     : 0x00000000  A15     : 0x3ffb0060  SAR     : 0x00000010  EXCCAUSE: 0x0000001c  
EXCVADDR: 0x000000bc  LBEG    : 0x4000c28c  LEND    : 0x4000c296  LCOUNT  : 0x00000000  

ELF file SHA256: 0000000000000000

Backtrace: 0x400dcfcb:0x3ffb1c60 0x400dd00c:0x3ffb1c80 0x400d256f:0x3ffb1ca0 0x400d2596:0x3ffb1cc0 0x400d62e6:0x3ffb1ce0 0x400ddd85:0x3ffb1d00 0x400dde1f:0x3ffb1e30 0x400dcdd9:0x3ffb1e50 0x401a815b:0x3ffb1e70 0x401a7c03:0x3ffb1e90 0x400d5f33:0x3ffb1eb0 0x400d4fc1:0x3ffb1ed0 0x401a7f85:0x3ffb1f20 0x401a8061:0x3ffb1f40 0x400dac6e:0x3ffb1f60 0x400dd01a:0x3ffb1f90 0x400ec215:0x3ffb1fb0 0x40089c2a:0x3ffb1fd0

It will not crash. I have zero experience with C++ and have been trying to troubleshoot the best I can.

Also in the follow code I'm have problems with the http_request_->send();

std::vector<std::string> ScriptureOfTheDay::get_scripture()
{
  http_request_->set_url(SCRIPTURE_URL);
  http_request_->set_method("GET");
  
  http_request_->send();
  if (http_request_->status_has_warning())
  {
    // If the request failed we shutdown and try again in 15 minutes
    shutdown(15 * 60);
  }
  const char *json = http_request_->get_string();
  
  DynamicJsonBuffer jsonBuffer(JSON_BUFFER_SIZE);
  JsonObject& scripture = jsonBuffer.parseObject(json);
  
  http_request_->close();

  std::vector<std::string> formattedScripture = split_verse_into_lines(std::string(scripture["verse"]["details"]["text"].as<char*>()));
  formattedScripture.push_back(std::string(scripture["verse"]["details"]["reference"].as<char*>()));

  return formattedScripture;
}

The error is below

In file included from src/main.cpp:37:0:
src/random_quote.h: In member function 'std::vector<std::__cxx11::basic_string<char> > ScriptureOfTheDay::get_scripture()':
src/random_quote.h:85:23: error: no matching function for call to 'esphome::http_request::HttpRequestComponent::send()'
   http_request_->send();
                       ^
In file included from src/esphome.h:12:0,
                 from src/main.cpp:3:
src/esphome/components/http_request/http_request.h:47:8: note: candidate: void esphome::http_request::HttpRequestComponent::send(const std::vector<esphome::http_request::HttpRequestResponseTrigger*>&)
   void send(const std::vector<HttpRequestResponseTrigger *> &response_triggers);
        ^
src/esphome/components/http_request/http_request.h:47:8: note:   candidate expects 1 argument, 0 provided

I have managed to update the ArduinoJson to 6.18.5. I am running ESPHome V2022.3.2.
This is my first time creating an issue, sorry if it doesn't contain everything needed or if the formatting if off.
Any help or pointers would be much appreciated. Thank you!

Help needed setting up light with power

I've added light with power component as described in readme:

external_components:
  - source: github://nuttytree/esphome
    components: [ binary_light_with_power ]

But it doesn't wan't to work, giving me an error:

Result:

Failed config

external_components: [source /config/switch.yaml:13]
  - source: github://nuttytree/esphome
    components: 
      
      Could not find __init__.py file for component binary_light_with_power. Please check the component is defined by this source (search path: /config/.esphome/external_components/63b570de/esphome/components/binary_light_with_power/__init__.py).
      - binary_light_with_power

Any ideas what I am doing wrong? :)

Incorrect brightness value retrieved for gosund dimmer switch

Just a quick note, I've been trying out your yaml for the Tuya and Gosund dimmers and quite liking them but found an issue with the value that is retrieved form the LightState class specifically the current_values_as_brightness. This value gets gamma corrected before being returned (a power factor of 2.8 by default I believe) which does not give the correct percentage value expected by serial output. Setting the gamma_correct value as 1 in the light section of your yaml ie lights will correct this value. Alternatively you could use a different class call to get the correct value but this was the easiest way to accomplish this at this time. This is noticeble if you turn off the switch manually at one level, it will turn back on at a lower level because of the descrepency.

  • id: gosund_light
    name: ${device_name}
    default_transition_length: 0s
    gamma_correct: 1.0

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.