Quantcast
Channel: ESPHome - Home Assistant Community
Viewing all 1486 articles
Browse latest View live

Multiple Esphome sensors versus entity id collision

$
0
0

I’m using a couple of ESP32 boards with BME280 sensors, running Esphome and posting their readouts via MQTT to Home Assistant. The boards have unique name, mqtt client_id and topic_prefix, this is one based on ESP32 TTGO-T-Display board:

esphome:
  name: garden_tdisplay
  platform: ESP32
  board: featheresp32

mqtt:
  broker: 192.168.1.56
  port: 1883
  username: notimportant
  password: notimportant
  client_id: garden_tdisplay
  topic_prefix: garden_tdisplay

The sensors (temperature and pressure) readouts get posted into MQTT into properly namespaced topics.

The problem is: Home Assistant adds them with very generic entity ids, sensor.outside_temperature and sensor.outside_pressure. This causes a mess and mixup when second sensor (with different name, client_id and topic_prefix) gets on the same network and starts posting its readouts: Home Assistant also maps them to sensor.outside_temperature and sensor.outside_pressure, mixing with/replacing readouts of the first sensor.

How do I force Home Assistant to assign them different, namespaced separate entity IDs? Other than renaming every sensor readout in Esphome configuration yaml? Or is the latter the only way?
I’ve tried renaming entity IDs in HA configuration, to sensor.garden_tdisplay_outside_temperature but this didn’t help, the collision still happens so somewhere internally they’re still treated as sensor.outside_temperature and mixed up.

(I’m new to HA and running on auto-generated Lovelace dashboard)

3 posts - 2 participants

Read full topic


LILYGO Internet POE board integration

$
0
0

Has anyone tried this board ??
“LILYGO TTGO T-Internet-POE ESP32-WROOM LAN8720A”

I have it at home with a programming card, but I can’t load FW there. The board must be started in flash mode before recording. It is necessary to press the Reset button, hold down and then briefly the BOT button. Then I managed to load the program, but it doesn’t work.
The board will not connect to Wifi. I have such a hunch that there could be a problem in Device Type, but unfortunately nowhere can I find even a mention of what to set there. According to the ESPHome website, the board should be supported, for example, to be seen in the ethernet settings section.

Did anyone manage to set it up ??

1 post - 1 participant

Read full topic

How to parse data from UART Text Sensor (Cozir Co2 sensor)

$
0
0

I have a CoZir CO2 sensor.
It outputs data in plane ASCII “Z 01234 z 01234”

I want to parse these 2 numbers to use a an entity in HA.
I already managed to setup a Text Sensor to get this string into HA.

Used this example: https://esphome.io/components/text_sensor/uart.html

Yaml is completly new for me, but I wonder if it is possbile to parse these 2 numbers?

Or should I take another aproach?

1 post - 1 participant

Read full topic

Wireless Doorbell Speaker: How to detect if it's playing/has power (and for how long?)

$
0
0

Hi,

I am replacing my existing smart doorbell system due to it being unreliable and I think the wiring that runs in the walls to the buttons is broken somewhere as it works intermittently at best. I have bought a cheap wireless doorbell from my local hardware store that runs on 3 C batteries and has two chimes (one for the front and one for the back door) and I have two buttons. There is no LED; only a speaker. Is it possible for an ESP8266 to read when there is power going to a speaker and for how long? Ex. If it can read there is power for only xx milliseconds; then it is the front door. If it reads power for xx seconds; it is the back door?

I’m completely new to ESPhome as I haven’t really needed to program in Arduino (outside of 3D printer firmware) for a couple of years now so i’m a little rusty.

Thanks,

2 posts - 2 participants

Read full topic

ESP8266 Light_Sleep

$
0
0

Has anyone got light_sleep to work reliably with the ESP8266?

I’m trying to use both a timed sleep and an interrupted sleep together and am just getting weird results and going round in circles. Maybe you can only do one or the other; it would be good to know.

1 post - 1 participant

Read full topic

Automated valvecontrol with PWM

$
0
0

Hi folks,

I’m currently trying to use a PWM-driven valve to control water flow from our distillery.
On the cooling tower are 5 Dalls-temperature-sensors.
4 From the top to the bottom and one to check the temperature of the alcohol.

Now the problem:
I created a ledc-Output on the ESP32 and used the light-tool to create a “valve”.

 output:
   - platform: ledc
     pin: 13
     frequency: 3000Hz
     id: ventcontrol
 light:
   - platform: monochromatic
     output: ventcontrol
     name: "Control"
     default_transition_length: 0s

I can use this control to change the valve from homeassistant but not within a temperature-driven automation.

Here my attempt:

 - if:
   condition: #cooling not active
     and:
       - sensor.in_range:
         id: temp_02
         above: 40
       - lambda: return id(varcooling) <= 0;
     then:
       - logger.log: "cooling off"
       - lambda: id(ventcontrol).set_level(0.3);
       - globals.set:
           id: varcooling
           value: '30'

Unfortunately the lambda won’t set the PWM-Output to 30%.

Is there a solution to my problem or does anybody knew a better solution?

greeting Stephan

2 posts - 2 participants

Read full topic

Fastled vs Neopixel problems

$
0
0

I am working on a project to have an ESP32S with WS2812B leds on each step of my staircase. I chose ESPhome running under HA in Docker to run the sequences with PIR sensors. The project has 796 LED’s in total that are split into 14 partitions (variable lenghts).

I am now working multiple days to get rid of the problems that I experience but can’t get my head around it. Basically, the created YAML file is functional with the fastled integration. Some chunks of the code (forget indentation, in YAML it is correct and it works):

light:

  • platform: fastled_clockless
    chipset: WS2812B
    rgb_order: GRB
    internal: true
    pin: GPIO4
    num_leds: 796
    name: “staircase”
    id: staircase

.# Creating 14 partitions for each step
.# LED strip WS2812B, total 796 LEDs

. # Step 1: 52 LEDS - LED 0 to LED 51

  • platform: partition
    name: “step1”
    id: step1
    internal: true
    segments:
    • id: staircase
      from: 1
      to: 50
      etc.

.# Run light on from bottom to top

  • id: lightdownup
    then:
    • light.turn_on:
      id: step1
      transition_length: !lambda |-
      return id(transition);
      brightness: !lambda |-
      return id(brightness);
      red: !lambda |-
      return id(red);
      green: !lambda |-
      return id(green);
      blue: !lambda |-
      return id(blue);
    • light.turn_on:
      id: step2… etc,

Skipping further code as it doesn’t contribute to the problem.

To start, I do experience the well known flickering that has been described in many other topics. These glitches increase when either monitoring live with the ‘log’ function and when connected to HA via the API. Without, flickering is rather limited. Cause is to be found in interrupt issues as I see.

To solve that, I’ve tried to step to NeoPixelBus instead:

light:

  • platform: neopixelbus
    type: GRB
    variant: WS2812X
    method: ESP32_I2S_1
    pin: GPIO4
    num_leds: 796
    name: “staircase”
    id: staircase

However, it became clear to me that NeoPixelBus either or not combined with partitions screws up as soon as more than 350 LED’s are used.

I have ran endless attempts to fix these problems.
Played with different NeoPixelBus and FastLed libraries (not at the same time of course):

platformio_options:
lib_deps:
- NeoPixelBus@2.6.0 (by the way, the currently standard distrubution 2.5.7 doesn’t work at all)
(- AsyncTCP)
(- FastLED@3.4.0)

None of them solved the issue.

The final suggestion that I see around is playing with interrupt handling, such as including one of the following above the #include “FastLED.h” in fastled_light.h:

#define FASTLED_INTERRUPT_RETRY_COUNT
#define FASTLED_ALLOW_INTERRUPTS 0

Unfortunately it is not easy to do this as the subsequent libraries (in this case fastled_light.h) are overwritten each time when compiled with the one from the source base, which is somewhere out of the ESPHOME docker container.

So now after explaining I have some questions that somebody may be able to answer:

  1. I prefer NeoPixelBus as it handles the output to the LED’s via DMA or other non-interrupt based method, which is a root solution. Would it be possible to address ~800 LED’s in the way described above flawlessly in an ESP32S with ESPhome? How?

  2. If Fastled is the option left (which by itself functions, but with the glitches), how can I play with the abovementioned inclusion of the #defines for the fastled interrupts, I have no clue how to change the source base outside the HA ESPhome container.

  3. Any other solution would be welcome, if you need additional info, please phrase as I am out of creativity here…

1 post - 1 participant

Read full topic

Ttp229 Capacitive Touch Sensor issues

$
0
0

Could someone help me to get the ttp229 keypad to work? I want to use it for a DIY alarm pad.

I asked for help on Reddit one week ago, and got some great help, debugging the sensor.

I came to the conclusion that the problem lies in the Ttp229 sensor component in esphome, because I tested my board with this Arduino code and it worked, I also found a person on discord who had described the same problems I have (I asked him for help one week ago, but he didn’t respond, until now).

I think the problem with the Ttp229 sensor in esphome is that there are two versions of this board (one with i2c and one without i2c) with very confusing and contradictory documentation.

The author of the code probably only tested the i2c Version, because the version without i2c (which i have) creates an error if you don’t configure the i2c component.

Here is the code and my wiring.

Maybe someone can help me to further debug my issue with the sensor or help me to write a custom component with the help of this working code.

Ps: this is my first post on this site, sorry if this post doesn’t belong here.

1 post - 1 participant

Read full topic


1 click upload command line with .bat file and Python virtual environment for latest beta release

$
0
0

What you can do is make a file called run.bat and just add "esphome 433_switch_control.yaml run || cmd /k" to it (without “”)
replace “433_switch_control” with whatever your .yam file are called and just place this file in the same folder as your .yam file just double click and it will run
and then make one more file for log

this have saved a lot of time for me

now to test the latest beta release without messing with your current install you can install it in a Python virtual environment

Installing in a Python virtual environment
C:…> py -m venv esphome_210121
C:…> cd esphome_210121
C:…> Scripts\activate.bat
C:…> pip install --pre -U esphome

this will make a Python virtual environment called esphome_210121 in your current path
I wont try to explain how it works because well I’m not a expert in either python or command line things and I would probably just mess it up… I’m just good at google and trial and error…

The .bat file for 1 click upload are a bit more complicated and well it took a lot of google help but this is what i ended up with "cd C:\Users\stefan\esphome_210121 && Scripts\activate.bat && cd %~dp0 && esphome 433_switch_control.yaml run || cmd /k"
C:\Users\stefan\esphome_210121 is the path to the virtual environment change to whatever you have

there is probably easier/better ways so make this but this have worked for me and might save a bit of time for someone

1 post - 1 participant

Read full topic

Curtain icon and device class created using ESPHome

$
0
0

I may be going mad, but I cant seem to get the device class - curtain to work. I have built my own DIY shades which work perfectly, the icons update to indicate when the shade is open or shut and it appears as the correct device type on my dashboards.

I have recently started making DIY curtain openers and I can see there is a usable device class of curtain, however when I use it (which should update the icons and how it appears in the front end) it doesnt show any differences to that of the shade. The icon defaults to Hass:blinds-open. I even stripped away all the complexities of controlling the motor and just had the cover template in the code and it still just shows as a default shade. If I switch it to Garage it updates the image to a garage door. However for curtains there doesnt seem to be any default customisations within the Lovelace UI for the cover type. Am I doing this wrong? Is there a way to show curtains as icons in the front end that simply illustrate when the curtain is open and shut just like it works for shades?

I have updated a screenshot of my front end (as a card) as well as it listed under the entity view. The snapshot of my 5 lines of code in esphome is pasted below too.

cover:
  - platform: template
    device_class: curtain
    name: "Lounge Curtain"
    id: lounge_curtain

1 post - 1 participant

Read full topic

ESPhome switch invert to Home Assistant

$
0
0

I have an 8 relay board I am using to power multiple plugs and I want to invert the state to Home Assistant. I thought adding inverted: yes to the ESPHome side would invert the state sent to HA, but it seems HA is not reflecting the inverted state but the raw toggle. Is there an easy way to do this without making a binary sensor to control the invert?

switch:
  - platform: gpio
    name: "Biocube AC Relay 1"
    pin: 17
    inverted: yes
    restore_mode: RESTORE_DEFAULT_OFF

State change:
[D][switch:029]: ‘Biocube AC Relay 1’ Toggling ON.e
[D][switch:045]: ‘Biocube AC Relay 1’: Sending state OFFe

Home Assistant then does not reflect the state but more the relay toggle position and shows ON for the state of the sensor.

4 posts - 2 participants

Read full topic

RGB indicator for Climate status

$
0
0

I’m going to try to use an IR remote with an ESP32 and get my AC unit into home assistant. As there will be an ESP board connected to the IR led’s, I figured I could add a single WS2812 led too, and have it shine in red if heating mode is selected, in blue if cooling… etc.

However, I cant work out how to do it!
I’ve got the climate integration working (software only, the IR LED’s have not arrived yet) and I have the WS2812 working as a ‘light’ too.
So I can ‘control’ the AC from home assistant, and I can control the color of the LED, but I’m not sure how to best get them to link together.

I want to have code in the .yaml file, that detects when the mode is changed, and changes the color of the LED depending on the selected mode.

Here’s what I have so far, just the basics:

substitutions:
  devicename: ir1
  upper_devicename: IR 1
  platform: ESP32
  board: wemos_d1_mini32
  ip: 192.168.3.219

packages:
  standard: !include includes/standardConf.yaml

esphome:
  platformio_options:
    lib_deps: NeoPixelBus@2.6.0

status_led:
  pin: 
    number: GPIO02
    inverted: False

sensor:
  - platform: homeassistant
    id: sensor_br
    internal: true
    entity_id: sensor.temperature_br

remote_transmitter:
  pin: GPIO32
  carrier_duty_percent: 50%

climate:
  - platform: daikin
    name: "Bedroom AC"
    receiver_id: reciever
    sensor: sensor_br
    supports_cool: true
    supports_heat: true
    visual:
      min_temperature: 16 °C
      max_temperature: 24 °C
      temperature_step: 1.0 °C
    
remote_receiver:
  id: reciever
  dump: all
  pin:
    number: GPIO33
    inverted: True
    mode: INPUT_PULLUP
  tolerance: 55%

light:
  - platform: neopixelbus
    type: GRB
    pin: GPIO16
    method: ESP32_I2S_1
    num_leds: 1
    id: ${devicename}_mode_led
    name: ${upper_devicename} mode light

1 post - 1 participant

Read full topic

How can I set a minimum brightness in ESPHome fastLEDs?

$
0
0

I have an LED strip connected to ESPHome. It works well, however when I set it to anything below 20%, the LEDs start malfunctioning/stop working. What’s the best way to map the brightness? I know I could use a template light, but I would like to avoid additional entities if possible.

1 post - 1 participant

Read full topic

Custom components, libraries etc

$
0
0

New to HA and ESPHome, so bear with me.

I’ve already made a few custom components to get the feel of it, as I have tons of stuff that will need customization and/or are not supported.
All works fine so far, but now, I’m getting bolder and wanted to do something with a DPS310 sensor.
There is two libraries for that in the “regular” PlatformIO, but these libraries does not seem to exist in ESPHome.
Question is, HOW do I get these in there, if possible at all.

I ended up with, as a quick fix, writing my own class to handle a DSP310 sensor over I2C.
That worked fine, but, I had to do it the ugly Arduino way (actually even uglier). I had to write ALL the code in the mycustomclass.h file.

Is there any way this can be split up in a decent way, so I can have separate h (and cpp?) files for the sensor class and a basic, minimalistic mycustomclass.h file, that just implements the actual esphome/hassio interface?
I tried a few variants, but as the mycustomclass.h file (and only that) is moved from the custom_component folder (or where-ever you specify in the YAML), to the /cofig/esphome//src, it didn’t work.

All tips and ideas are much appreciated.

1 post - 1 participant

Read full topic

Inverting inputs

$
0
0

Can someone help with this code please, Im going round in circles trying to solve this:

A mosfet controlling the tape brightness led’s is connected to goip33,
A relay is connected to gpio32 for the power supply control
and a relay is connected to gpio27 for the pixel control on and off.

output:
  - platform: ledc
    pin: GPIO33
    id: dimming
    frequency: 10000 Hz
    power_supply: power_supply_5v
    
  - platform: gpio
    pin: GPIO27
    id: string
    inverted: true
    power_supply: power_supply_5v
    
power_supply: 
  - id: power_supply_5v
    pin: GPIO32
    enable_time: 10s

light:
  - platform: monochromatic
    output: dimming
    name: Tape brightness

  - platform: binary
    name: Pixels
    output: string

Im trying to invert the power supply output pin gpio32 without effecting the tape on/off.

Basically, when the esp is powered on the Pixel switch and the Tape brightness switch are both off.
Screenshot 2021-01-24 at 11.18.01

But the power supply relay connected to pin gpio32 on on and engaged.

Swiching on the Tape brightness will disengage the power supply relay.
And the same with the Pixels, turning them on disengages the power supply relay.

The idea is when switching either switch, the power supply comes on 10 seconds before the Pixel or Tape comes on. At the moment the power supply is on and switched off after 10 seconds of switching the Pixel or Tape brightness on.

Hope this makes sense.

1 post - 1 participant

Read full topic


Nextion Gauge Needle

$
0
0

Hi Everyone,

I started programming the nextion touch display with ESPHome. I have a little problem with the gauge component of nextion. I can write to the display gauge a value (e.g. position of the gauge needle) of a homeassisant sensor of my choice. But if that value changes, the new and (all) the old needle positions of the gauge stay on the screen.
Of course, I would like to have all old needle positions disappear and only show the newest.

Part of my ESPHome Code looks like this:

display:
  - platform: nextion
    id: nextiondisplay
    update_interval: 5s
    lambda: |-

            auto date = id(sntp_time).now().strftime("%b. %d");
            auto time = id(sntp_time).now();
            
            it.set_component_text("date", date.c_str());
            it.set_component_text_printf("time","%02d:%02d",time.hour,time.minute);
            it.set_component_value("gauge", id(power_total).state/1000*200);

and the according home assistant value is being added like that:

sensor:

  - platform: homeassistant  
    id: power_total
    entity_id: sensor.power_total_usage_house  
    accuracy_decimals: 1

Does anyone have found a solution for that or can hint me in the right direction?

Thanks

1 post - 1 participant

Read full topic

Cache and analyze past ESPHome data based on current sensor readings

$
0
0

I have ESPHome running on an ESP8266 and I’m using it to monitor my whole house water filtration system with pressure sensors on both sides of the filter system. As soon as I built it and started monitoring the sensors I realized that in order to really measure the “filter health”, I need water demand. If no water is flowing through the “plugged” filters then there will be no pressure drop across the filters (which is what I’m looking for).

Because of that, I ended up looking at both sensors ever 1-2 seconds and calculating the delta. This is very wasteful since most of the day there is no flow through the filters. I thought about this for a while and what I really want is a real-time flow value that I can use to trigger a higher-resolution view of the drop across the filters. So, I bought a water flow meter.

Unfortunately, the water flow meter I got doesn’t have very granular output. It outputs a single pulse for every gallon and since a lot of the time we’re flushing a toilet or washing our hands the reading is very small. What’s worse is if I look at that output once in a minute the pulse(s) may have happened early on in the minute and now the water flow is actually off so calculating delta doesn’t work reliably.

What’s the best way to organize my ESPHome data to capture “filter health” most accurately?

I’m wondering about this approach:

  • When flow is over 3gpm (which means I got at least three pulses in one minute)
  • And the previous measurement was also over 3gpm (sustained usage for over a minute)
  • Now take the cached pressure measurements from over the previous minute and calculate delta from it

I’m thinking I have “high-flow” and maintain a “high-flow” state from one minute to the next, then that previous minute’s pressure measurements are probably most likely to be during a high-flow state. I’m just not sure what the best way to approach this using ESPHome methods. I know this is a very complex way to handle it but it should be possible, right?

Alternatively, I could:

  • When flow is over 3gpm, start temporary recording of pressure values
  • If the next minutes flow is also over 3gpm, record temporary values as permanent values (publish to HA?)
  • If the next minutes flow is under 3gpm, throw the temporary values out

Any ESPHome pros want to take a shot at trying to build that? :smiley: I’ve got something complicated and it’s working but neither of these ways.

1 post - 1 participant

Read full topic

Help with cm to % on D1 mini and HC-SR04

$
0
0

having errors displaying my tank level to my ssd1306 display. I am very new to coding and ive been researching this topic. here is what i have:

HC-SR04 sensor

sensor:

  • platform: ultrasonic
    trigger_pin: D6
    echo_pin: D7
    name: “Level Sensor”
    id: level
    update_interval: 250ms

  • platform: template
    sensors:
    level_sensor:
    entity_id: sensor.level_sensor
    value_template: ‘{{100-((states(“sensor.level_sensor”) | int) / 11 * 100) | int }}’
    unit_of_measurement: ‘% Full’
    friendly_name: Tank Level
    icon_template: ‘mdi:ruler’

font:

  • file: “font.ttf”
    id: font1
    size: 15

  • file: “font.ttf”
    id: font2
    size: 28

##SSD1306 display
i2c:
sda: D1
scl: D2

display:

  • platform: ssd1306_i2c
    model: “SSD1306 128x64”
    reset_pin: D0
    address: 0x3C
    lambda: |-
    it.print(25, 0, id(font1), “Water Level”);
    if (id(level).has_state()) {
    it.printf(100, 20, id(font2), TextAlign::TOP_RIGHT , id(level).state);
    }

1 post - 1 participant

Read full topic

ESPhome connection problem fixed ip adress from other network

$
0
0

I’m having a problem with connecting to my ESPhome node. I am moving all the nodes to another network. Everything went fine, but after a few I got a little sloppy and forgot to hash (#) the static ip adress in the yaml file. Result: I uploaded the new SSID credentials for the new network network (192.168.2.x) with the old fixed IP adress (192.168.1.x) from the old network.

The node is connected (green in the ESP home addon) and visible in my router, but I cannot reach it anymore from the ESPhome addon and cannot upload anything. I also tried ‘use_adress’ with the static adress from the old network but that does not work either.

Someone any ideas? The node is behind a lot of wires and I really woul not like to take it out for a new USB flash.

Thanks!

1 post - 1 participant

Read full topic

Relay triggering on boot

$
0
0

Hey ladies and gents,

I have a Powertech MS6106 wall plug here, Tuya chip on the inside, flashed to ESPhome Here
When the device is powered up it cycles power to the relay.

I have been through the previous topic ESP8266 Relay (active low): how to prevent triggering on boot or reset (SOLVED) here.

None of the restore modes worked, relay still cycles.

restore from flash also has not worked

Not defining the switch (the relay) causes it to turn on and stay on, turns of when power is removed obviously.

Removing the on_press has no change not he fault.

Removing the inverted: true has no change on the fault.

I have yet to try manually adding the digital writes to code yet, Replys seem to say this was implemented with restore modes.

The real kicker here is when I don’t define the binary sensor for the built in switch, the relay is fine and remains off doing power up. So I tried a debounce filter on the switch as will which doesn’t change anything.

So a little lost here on what to do next.

I also have a aliexpress inching relay on the garage door that’s worked seamless and safe for the last year or more, that in the last month has triggered the door to open with out command. Once during a small brown out (was 4 hours from home for Christmas. that stressed me out, ontop of the router breaking an hour later knocking out the wifi for all my smart devices lol) the 2nd time was a few days ago when I killed the HA instance for a hardware upgrade. seems like after a period of time with no server connection esphome devices were rebooting themselves.

(Important info removed from code)

esphome:
  name: 
  platform: ESP8266
  board: esp8285
#  esp8266_restore_from_flash: true

captive_portal:

# Enable logging
logger:

# Enable Home Assistant API


status_led:
  pin:
    number: GPIO00
    inverted: yes 
    
# INPUT AREA 

binary_sensor:
  - platform: gpio
    name: "Jaycar1 S1"
    pin:
      number: GPIO013
      mode: INPUT_PULLUP
      inverted: True
    filters:
     - delayed_on: 50ms
    on_press:
      - switch.toggle: relay
      
switch:
  - platform: gpio
    restore_mode: ALWAYS_OFF
    name: "Jaycar1 relay"
    pin: GPIO15
    id: relay

1 post - 1 participant

Read full topic

Viewing all 1486 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>