Dear All,
thrying to generate the code, i get the follwoing error:
INFO ESPHome 2023.12.5
INFO Reading configuration /home/paulo/Arduino/ESP8266_frameworks/ESPHOME/weather-station-esp32.yaml...
ERROR Error while reading config: Invalid YAML syntax:
while parsing a block collection
in "<unicode string>", line 71, column 3
did not find expected '-' indicator
in "<unicode string>", line 118, column 3
The code:
sensor:
# anemometer - wind speed detector - input VCC 10 to 14V, output 0 to 5V
- platform: ina226 << line 71
address: 0x40
shunt_resistance: 0.1 ohm
current:
name: "${friendly_name} wind speed current"
power:
name: "${friendly_name} wind speed power"
bus_voltage:
name: "${friendly_name} wind speed voltage"
id: wind_speed_voltage
filters:
- calibrate_linear:
datapoints:
- 0.0 -> 0.0
- 5.0 -> 30.0
# - lambda: return x * 3.6;
# anemometer (0 - 5V) * 6 = meters / second - meters / second * 3.6 = km/h
# - lambda: return x * (3.6 * 6.0);
shunt_voltage:
name: "${friendly_name} wind speed shunt voltage"
max_current: 3.2A
update_interval: 5s
- platform: copy
name: '${friendly_name} wind speed (km/h)'
id: wind_speed_kmh
source_id: wind_speed_voltage
unit_of_measurement: 'km/h'
icon: 'mdi:weather-windy'
filters:
- multiply: 3.6
# wind direction indicator
- platform: ina226
address: 0x41
shunt_resistance: 0.1 ohm
current:
name: "${friendly_name} wind direction current"
power:
name: "${friendly_name} wind direction power"
bus_voltage:
name: "${friendly_name} wind direction voltage"
id: wind_direction_voltage
shunt_voltage:
name: "${friendly_name} wind direction shunt voltage"
max_current: 3.2A
update_interval: 5s
on_value: << line 118
- if:
condition:
sensor.in_range:
id: wind_direction_voltage
above: 0.0
below: 0.72
then:
- text_sensor.template.publish:
id: wind_dir_card
state: "N"
- sensor.template.publish:
id: wind_heading
state: 0.0
- if:
condition:
sensor.in_range:
id: wind_direction_voltage
above: 0.72
below: 1.44
then:
- text_sensor.template.publish:
id: wind_dir_card
state: "NE"
- sensor.template.publish:
id: wind_heading
state: 45.0
- if:
condition:
sensor.in_range:
id: wind_direction_voltage
above: 1.44
below: 2.16
then:
- text_sensor.template.publish:
id: wind_dir_card
state: "E"
- sensor.template.publish:
id: wind_heading
state: 90.0
- if:
condition:
sensor.in_range:
id: wind_direction_voltage
above: 2.16
below: 2.88
then:
- text_sensor.template.publish:
id: wind_dir_card
state: "SE"
- sensor.template.publish:
id: wind_heading
state: 135.0
- if:
condition:
sensor.in_range:
id: wind_direction_voltage
above: 2.88
below: 3.60
then:
- text_sensor.template.publish:
id: wind_dir_card
state: "S"
- sensor.template.publish:
id: wind_heading
state: 180.0
- if:
condition:
sensor.in_range:
id: wind_direction_voltage
above: 3.60
below: 4.32
then:
- text_sensor.template.publish:
id: wind_dir_card
state: "SW"
- sensor.template.publish:
id: wind_heading
state: 225.0
- if:
condition:
sensor.in_range:
id: wind_direction_voltage
above: 4.32
below: 5.03
then:
- text_sensor.template.publish:
id: wind_dir_card
state: "W"
- sensor.template.publish:
id: wind_heading
state: 270.0
- if:
condition:
sensor.in_range:
id: wind_direction_voltage
above: 5.03
# below:
then:
- text_sensor.template.publish:
id: wind_dir_card
state: "NW"
- sensor.template.publish:
id: wind_heading
state: 315.0
Any advises?