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

ESPHome - control servo using REST-ful API

$
0
0

@kljuka wrote:

Hey,
I’ve followed the servo component tutorial for esphome (https://esphome.io/components/servo.html?highlight=servo).

My servo.yaml configuration for ESPHome is:

output:
  - platform: esp8266_pwm
    id: pwm_output
    pin: GPIO2
    frequency: 50 Hz

servo:
  - id: my_servo
    output: pwm_output

web_server:
  port: 80
  auth:
    username: <secret>
    password: <secret>

I can access the web server through my browser (http://<ip_of_esp>), but there doesn’t seem to be any option to control the servo from it.

Is there a way to control the servo using REST-ful API? What command would I need to type in CURL?

Posts: 1

Participants: 1

Read full topic


ESPHome Automation using sun as condition

$
0
0

@JellyBeans wrote:

Hi guys,
I am trying to add a “if condition” to my yaml file in esphome, but keep getting a error, "Unable to find condition with the name ‘sun.is_above_horizon’.
I’m following esphome docs as in the following link: https://esphome.io/components/sun.html#sun-is-above-below-horizon-condition

See code attached.

esphome:
  name: master_bedroom_cupboard
  platform: ESP32
  board: esp32doit-devkit-v1

wifi:
  ssid: "ssid"
  password: "password"

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Master Bedroom Cupboard"
    password: "Iw0MTmL1zWsW"

captive_portal:

# Enable logging
logger:

# Enable Home Assistant API
api:

ota:


binary_sensor:
  - platform: gpio
    pin: 36
    name: "Nathan Door"
    device_class: door
    on_press:
      - if:
          condition:
            - sun.is_above_horizon:
          then:
            - light.turn_on:
                id: nathanlight
                brightness: 30%
            
    on_release:
      then:
        - light.turn_off:
            id: nathanlight
    
  - platform: gpio
    pin: 39
    name: "Mariska Door"
    device_class: door
    on_press:
      then:
        - light.turn_on:
            id: mariskalight
            brightness: 100%
    on_release:
      then:
        - light.turn_off:
            id: mariskalight

  - platform: gpio
    pin: 34
    name: "Mirror"
    device_class: door
    on_press:
      then:
        - light.turn_on:
            id: mirrorlight
            brightness: 100%
    on_release:
      then:
        - light.turn_off:
            id: mirrorlight

  - platform: gpio
    pin: 35
    name: "Drawer"
    device_class: door
    on_press:
      then:
        - light.turn_on:
            id: drawerlight
            brightness: 100%
            red: 100%
            green: 0%
            blue: 0%
    on_release:
      then:
        - light.turn_off:
            id: drawerlight

output:
  - platform: ledc
    id: nathan
    pin: 15
  - platform: ledc
    id: mariska
    pin: 2
  - platform: ledc
    id: mirror
    pin: 4
  - platform: ledc
    id: red1
    pin: 1
  - platform: ledc
    id: green1
    pin: 22
  - platform: ledc
    id: blue1
    pin: 3
  - platform: ledc
    id: red2
    pin: 18
  - platform: ledc
    id: green2
    pin: 19
  - platform: ledc
    id: blue2
    pin: 17 

light:
  - platform: monochromatic
    output: nathan
    id: nathanlight
    name: "Nathan Cupboard"
  - platform: monochromatic
    output: mariska
    id: mariskalight
    name: "Mariska Cupboard"
  - platform: monochromatic
    output: mirror
    id: mirrorlight
    name: "Mirror"  
  - platform: rgb
    name: "Kick Plate"
    id: kickplatelight
    red: red1
    green: green1
    blue: blue1
  - platform: rgb
    name: "Drawer"
    id: drawerlight
    red: red2
    green: green2
    blue: blue2

See error attached.

I just can’t seem to get this to work.

Posts: 1

Participants: 1

Read full topic

Help with custom sensor needed

Is there a way to have addressable LEDs turn on from the “middle out”

$
0
0

@simpat1zq wrote:

So I just got some addressable LEDs working via a Wemos D1 Mini and I am going to put the strip behind my TV. I have it setup so that when the movie starts playing, it turns them off and then turns them on when it is paused.

I just want a simple effect where the lights turn on from the middle out. So the middle 2 LED turn on, then the 2 LED next to those and so on until all LED are on over the course of about 2 seconds. I want them to turn off the same way.

How would I do that with ESPHome?

Posts: 1

Participants: 1

Read full topic

Dallas DS18B20 nextion temperature

$
0
0

@Giuseppe-P wrote:

Can someone help me. I have a temperature sensor dallas DS18B20 and I can’t see the value on nextion with this it.set_component_text_printf (“temperature”, “%. 0f”, id (temp) .state)

Posts: 1

Participants: 1

Read full topic

Correct way to execute multiple homeassistant.services

$
0
0

@Nathan909 wrote:

I’m having an issue at the bottom where I’m trying to turn_off multiple lights at the bottom of this code, it only turns off the first light, not sure the proper way to express this.

binary_sensor:
  - id: spa_button
    name: Spa Button
    platform: gpio
    pin: GPIO4
    on_click:
    - min_length: 70ms
      max_length: 1290ms
      then:
        - switch.turn_off: spa_heater
    - min_length: 1300ms
      max_length: 4200ms
      then:
        - homeassistant.service:
            service: scene.turn_on
            data:
              entity_id: scene.bright_backyard
    - min_length: 4220ms
      max_length: 8500ms
      then:
        - homeassistant.service:
            service: scene.turn_on
            data:
              entity_id: scene.dim_backyard
    - min_length: 8520ms
      max_length: 13000ms
      then:
        - homeassistant.service:
            service: light.turn_off
            data:
              entity_id: light.backyard_lights
        - homeassistant.service:
            service: light.turn_off
            data:
              entity_id: light.backyard_patio_lights
        - homeassistant.service:
            service: light.turn_off
            data:
              entity_id: light.backyard_porch_lights

Posts: 6

Participants: 2

Read full topic

ESPHome with PN532 - Read Tag Text

$
0
0

@anthonyjestin wrote:

Hi folks! Many of you using PN532 integration on ESPHome for NFC? Is there any way to actually pass the text stores on the tag as a single sensor that reports the text, as opposed to having to create a unique binary sensor for each tag?

I have a project I am working on that will have over 100 NFC tags that need to be read, but also needs to be fluid and easy to add and change. If I can simply pass the text off the tag to a single sensor, I have automations written in Node Red that accomplishes everything I need to do

I have been working to do this using Arduino IDE but am having lots of Wi-Fi issues once the 532 is integrated

Many thanks in advance for any insights offered!

Posts: 1

Participants: 1

Read full topic

Write single monochromatic light output to multiple ledc output pins

$
0
0

@MaartenKleijwegt wrote:

Dear folks,

I’ve been using esphome for some while now and really like its large amount of components. I’ve already got a set of simple sensors around the house and some tuya converted lamps and switches running, however for my next project I wanted to step it up a bit.

I’ve created a hallway lamp with 4 dc led bulbs and a pir sensor to activate the lamp when someone is in the hallway. I’ve got an idea about some light effects I want to incorporate where the lights are slowly dimming and brightening at different frequencies while keeping the overall brightness constant. However,first I just want to hang the thing and test the pir sensor settings and general workings and later flash the effects over the air.

So for now, I wanted to create a single monochromatic light exposed to Home assistant, but couple all 4 outputs to the monochromatic light. However, I’m unable to find anything on how to couple multiple outputs.

I’ve also looked around for lambda’s that activate on every loop to copy the value of lamp 1 to 2, 3 and 4 but I’m only able to find time or trigger based solutions. Which currently feel to me like a bit of a hack.

Does anyone else know a good solution? Any insights would be greatly apreciated

Posts: 1

Participants: 1

Read full topic


Help with ESP8266 visual countdown timer

$
0
0

@ufulu wrote:

I came across PaperSignals and was intrigued as I am looking for a child oriented countdown timer that can visually display time left before bedtime, getting ready for Kindergarden etc.

image

I wired up a Longrunner KY66 Servo zu an ESP8266 compiled without errors and uploaded the code but Google Assistant doesn’t communicate with my setup. Acording to some github issues this might be due to the fact that this only works in the US and I am in Germany? ¯_(ツ)_/¯

Anyways I really like the idea and was wondering if sometihing similar could be achieved with https://esphome.io/ and setting the countdown timer via an input in Home Assistant. The thing is I am just dabbing my toes into the Arduino/ESP World and have no clue, how to change the speed of my servo to move from 180 to 0 depending on the defined countdown time.

I would really appreciate if anybody could point me into the right direction of how to achieve this or suggest a different approach as to how to achieve the overall goal of creating an child oriented countdown timer.

Thanks

Posts: 4

Participants: 2

Read full topic

ESPHome and using YAML to program autmation on the ESP-32

$
0
0

@jayg37 wrote:

Hello all,
I’m trying to use an ESP-32 to remotely control my pool pump via a series of relays. I’ve managed to use ESPHome to upload yaml files into the ESP32 so that i can view 4 switches in my home assistant GUI. Now i want to create schedules to control the pump throughout the day but want to off load that work to the ESP32 rather than use HA.
I can muddle my way through VB and C (Arduino IDE) but i just can’t figure out how to do this in YAML.

I would like to set relays in a certain on/off position and then based on a time passed or clock to change the relay positions to their next position sequence.

Can someone point me in the right direction?
I’m looking to cycle through my pump timers via relay inputs based on time of day. Also being able to activate a certain relay sequence as needed via HA automation. (turn on water jets then kick pump to full power and vice versa)
Untitled

My current code:

esphome:
  name: pool
  platform: ESP8266
  board: nodemcuv2

wifi:
  ssid: "xxxxxxx"
  password: "xxxxxx"

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "xxxxxx"
    password: "xxxxx"

captive_portal:

# Enable logging
logger:

# Enable Home Assistant API
api:
  password: "xxxxx"

ota:
  password: "xxxxxx"
  
switch:
  - platform: gpio
    name: "Relay 1"
    pin: GPIO4
  - platform: gpio
    name: "Relay 2"
    pin: GPIO5
  - platform: gpio
    name: "Relay 3"
    pin: GPIO12
  - platform: gpio
    name: "Relay 4"
    pin: GPIO14

Posts: 1

Participants: 1

Read full topic

[WIP] Adding finger gestures for those touch switches for light dimming & others

$
0
0

@iphong wrote:

So I installed a few dimmable light bulbs and this switch becomes useless as I need to keep it on all time to power the bulbs. This switch is beautiful and I want to keep it. So I thought I could hack it and write some code to make them work with each other. And this is the result. I’m loving it…

now it controls my curtains too .!!!

Posts: 1

Participants: 1

Read full topic

Wake ESP8266 from deep sleep on tag read by PN532

$
0
0

@gaggio wrote:

Hi,
I have a nodemcu connected to a PN532, reading tags and notifying Home Assistant only when a recognized tag is read.
Now, it isn’t easy to have AC power in the place where I need to install this device, but I think I can get a decent life on a 9V battery, since I will have to read tags and connect to the wifi to notify Home Assistant just a couple of times a day.
Of course the ESP should be in deep sleep all the time, until a tag is read. How can I achieve this? I believe I have to connect D0 to the RST pin, but can I give the wake up signal from the PN532, such that it is only woke up when a tag is read?
Alternatively I would have to add a switch and manually wake the ESP up before getting the tag on the reader…

Thanks for your suggestions

Posts: 1

Participants: 1

Read full topic

Float value expected

$
0
0

@Hellis81 wrote:

I’m trying to use a input value from Home Assistant as the values in on_value_range.

sensor:
  - platform: homeassistant
    name: "volym_grans"
    entity_id: input_number.volym_grans
    id: volym_grans
    
  - platform: adc
    pin: A0
    name: "Sound"
    update_interval: 0.1s
    internal: true
    on_value_range:
      - above: id(volym_grans).state
        then:
          - switch.turn_on: snd
      - below: id(volym_grans).state- 0.01
        then:
          - switch.turn_off: snd

In Home Assistant input_number.volym_grans is:

input_number:
  volym_grans:
    name: volym_grans
    min: 0.56
    max: 1
    step: 0.01

But in ESPHome I get an error on - above: id(volym_grans).state that it expects float value.
I don’t understand, why would it not be float? The value is float in Home Assistant and sensors in ESPHome are (or can be) float, so why is it converted to something else?
What can I do to fix this?

Posts: 1

Participants: 1

Read full topic

RCWL-0516 as binary sensor - cannot get to invert output

Relay controller from HA and local GPIO

$
0
0

@corvy wrote:

Hello. I have a project where I want to control a relay. Basically the logic is that I get +12V in from a control panel. This +12V I could step down to 3V to sense on GPIO on the ESP, or I could run the 12V through a relay to close a GPIO pin to high or low depending on the preference.

When this is done I want the ESP to close another relay automatically, no interaction from HA. In the HA interface / MQTT the status should update a relay switch to on. Should the 12V shut down to 0V the same relay output should open/disconnect.

The same relay switch should also be possible to control from HA, and preferrably also be able to read the status of the 12V input (does not matter if is represented as an on/off sensor or a voltage).

Sadly I suck at writing code. I guess I need to write a custom sensor. Could anyone help with this?

So far I have tinkered around the ESP32 to control a relay. That works.

esphome:
  name: relaynode
  platform: ESP32
  board: mhetesp32devkit
wifi:
  ssid: 'WIFI NETWORK'
  password: 'WIFI PASSWORD'
# Enable logging
logger:
# Enable Home Assistant API
api:
  password: 'HA API PASSWORD'
ota:
  password: 'OTA PASSWORD'
  
web_server:
  port: 80
switch:
  - platform: gpio
    name: "test_lights_deca Onboard light"
    pin: 2
    inverted: True
    restore_mode: RESTORE_DEFAULT_OFF
    
  - platform: gpio
    name: "Relay_1"
    pin: 25
    inverted: True

Now I need the sensor for the 12V, logic to trigger the Relay_1 without having to talk to HA (preferrably) and report the sensor on/off status to HA.

Posts: 3

Participants: 2

Read full topic


Animated art using ESPHOME?

Tuya Curtain Motor custom component with set position and realtime feedback

Check connection to HA

$
0
0

@LennartIsHigh wrote:

Is it possible to have ESPHome check it’s connection to HA before acting? Let me clarify that.

At the moment I do have a zigbee dimmer installed in my ceiling light, connected to a momentary switch on the wall (wired together) I’m planning to make this switch smart(er). I’m planning to put a Shelly in the momentary switch to take over the role of the switch. By this a can do double click and multiple click action. And by a single click or long press the light switches or dims or brightens. The reason I want to have ESPHome check the connection to HA is that my HA or my NUC or my internet isn’t stable once in a while (source is not important for this topic) and then the WAF goes down like a sinking ship. If you know what I mean.

So I think there must be some sort of if/then scenario for this. Like, If there is no connection to HA than the Shelly will use the relay to sync the button presses to have signals sent to the zigbee dimmer (wired). And IF there is a connection to HA the action can have other outcomes like setting a scene or something like that.

Who can point me into the right direction?

Posts: 2

Participants: 2

Read full topic

GPIO Mapping

Cannot have EspHome Cam work with Motion Eye?

$
0
0

@jpi1968 wrote:

I am struggling with the installation of a ESP32CAM AI Thinker in HA.
Here is my config:
- HA image installed on Rasp 3B+
- System HassOS 3.13
- MotionEye: 0.8.0

I would like to be able
- to monitor the camera from outside (SSL)
- set up motion detection, preferaly through Motion Eye

I am a total newbee, spent days searching the web, it seems 100% stupid, but I simply cannot succeed into setting both.

I have integrated the cam with ESPHome: remote viewing works perfectly.
I finaly managed to spot the stream url (https://xxxxxxx.duckdns.org/api/camera_proxy_stream/camera.cameranew?token=c7ca642xxx).
The url works ok in VLC.
Pb: when I plug the URL as IP camera in Motioneye, it identifies the type of camera, creates it, but does not receive the pics
(cf Motioneye logs: ERROR: mjpg client timed out receiving data for camera 1 on port 8081
[22/Apr/2020:21:26:14 +0200] 200 192.168.0.8, 172.30.32.1(172.30.32.2) GET /picture/1/current/?_=1587583568642&_username=admin&signature=09f7e4fab639ada1c2f8412dacbe5fe6832d2541 HTTP/1.1 (Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.113 Safari/537.36)
[22/Apr/2020:21:26:20 +0200] 200 192.168.0.8, 172.30.32.1(172.30.32.2) GET /picture/1/current/?
=1587583574121&_username=admin&_signature=07b67c9adb47cc8707b8a2c7a65dd408e9ed09a9 HTTP/1.1 (Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.113 Safari/537.36)
ERROR: mjpg client timed out receiving data for camera 1 on port 8081)
On the top of that, if I understood well what I red on the forums, the ESPHome token changes all the time and when I try to put a permanent token from profile, MotionEye won’t even create the cam…

I tryed the other way, by flashing the cam via Arduino, following various tutos, including this one (https://randomnerdtutorials.com/esp32-cam-video-streaming-web-server-camera-home-assistant/)
I easily got the stream (https://192.168.0.4:81/stream) and picture urls, as well as the settings’ webpage.
The cam is well integrated into MotionEye, motion detections, notifications work perfectly,…BUT…:
Streaming the cam on lovelace works poorly.
Whether I use the identity from the generic camera integration or the streaming URL of Motion Eye in lovelace picture card,…it doesn’t work…
It lags a lot, preload stream never ends,…
I have tried to change the 8081 port, nothing seems to work.

I have tryed to do without MotionEye, with scripts, but I only managed to take pictures. I get error message saying the cam does not accept recording, nor motion detection…far from expected result.
I would really like to use MotionEye, the app is great, 100% what I need.

I do not know, where I f… up : motioneye settings, parameters in Arduino flashing, tokens,…
Too many tracks to follow for my newbee’s knwoledge!

Can somebody help me solve this nightmare puzzle or at least tell me where I should start looking?!

Thanks a lot

Posts: 1

Participants: 1

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>