Hi guys,
I’m new here and hope you can help me. I’m no programmer, just a specialist in copy/paste
I want to control a servo out of home assistant via an esp home installation on an esp32.
I’ve used the guide from siytek but can’t get it up and running…
The servo doesn’t move. Any ideas why???
thx Karl
code:
esphome:
name: esphome-web-f855a8
friendly_name: ESPHomeAusheizer4
esp32:
board: esp32dev
framework:
type: arduino
# Enable logging
logger:
# Enable Home Assistant API
api:
encryption:
key: "nO0stD3hQooFotpnR8XoCdnRG2ng1xxxxxxxxxxxx"
services:
- service: control_servo
variables:
level: float
then:
- servo.write:
id: my_servo
level: !lambda 'return level / 100.0;'
ota:
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Esphome-Web-F855A8"
password: "xxxxx"
captive_portal:
dallas:
- pin: GPIO19
sensor:
- platform: dallas
address: 0xa30417c1f2xxxxx
name: "TemperaturVL"
- platform: dht
pin: GPIO21
temperature:
name: "Umgebungstemperature"
humidity:
name: "Umgebungsfeuchte"
model: AM2302
update_interval: 60s
servo:
- id: my_servo
output: pwm_output
# Example output platform
# On ESP32, use ledc output
output:
- platform: ledc
id: pwm_output
pin: GPIO18
frequency: 50 Hz'
in der configuration.yaml am HA:
'# Loads default set of integrations. Do not remove.
default_config:
# Load frontend themes from the themes folder
frontend:
themes: !include_dir_merge_named themes
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
input_number:
servo_control:
name: Servo Control
initial: 0
min: -100
max: 100
step: 1
mode: slider'
und in der automations.yaml:
'automation:
- alias: Write Servo Value to ESP
trigger:
platform: state
entity_id: input_number.servo_control
action:
- service: esphome.little_wemos_control_servo
data_template:
level: '{{ trigger.to_state.state | int }}''