ponczur
(TomaszL)
11 Styczeń 2024 18:12
1
Cześć. Próbuję jak Ty podłączyć Expander i2C ale coś mi nie wychodzi z kodem do ESPHome. Czy mógłbyś skopiować i wkleić kod z twojego ESP8266.
Nawiązuję do tego komentarza “Poddałem się i uruchomiłem ESP8266 z PCF8574, który obsługuje 8 przekaźników przez I2C”
szopen
11 Styczeń 2024 22:31
2
Pokaż YAML, najlepiej kompletny (wklejasz jako tekst ze znacznikami kodu - jeśli wiesz jak; lub tak jak jest, jeśli nie wiesz jak to zrobić jak należy) + schemat (choćby odręczny lub chociaż szczegółowy opis) + inne informacje techniczne np. typ płytki prototypowej.
Graffy
12 Styczeń 2024 13:46
3
Proszę.
substitutions:
device: "esp-salon"
device_name: "ESP salon"
esphome:
name: ${device}
platform: ESP8266
board: nodemcuv2
logger:
esp8266_store_log_strings_in_flash: false
api:
encryption:
key: !secret esp_api_encryption_key
ota:
password: !secret esp_ota_password
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
ap:
ssid: ${device}
password: !secret wifi_ap_password
fast_connect: on
manual_ip:
static_ip: 10.1.1.121
gateway: 10.1.1.1
subnet: 255.255.255.0
dns1: 10.1.1.1
power_save_mode: none
captive_portal:
i2c:
sda: D2
scl: D1
frequency: 100kHz
scan: true
pcf8574:
- id: "pcf8574_hub"
address: 0x20
pcf8575: false
sensor:
- platform: wifi_signal
name: "${device_name} signal"
update_interval: 60s
- platform: uptime
name: "${device_name} uptime sensor"
id: uptime_sensor
update_interval: 60s
on_raw_value:
then:
- text_sensor.template.publish:
id: uptime_human
state: !lambda |-
int seconds = round(id(uptime_sensor).raw_state);
int days = seconds / (24 * 3600);
seconds = seconds % (24 * 3600);
int hours = seconds / 3600;
seconds = seconds % 3600;
int minutes = seconds / 60;
seconds = seconds % 60;
return (
(days ? to_string(days) + "d " : "") +
(hours ? to_string(hours) + "h " : "") +
(minutes ? to_string(minutes) + "m " : "") +
(to_string(seconds) + "s")
).c_str();
- platform: bmp085
address: 0x77
temperature:
name: "BMP180 Temperature"
filters:
- lambda: return x - 3.5;
pressure:
name: "BMP180 Pressure"
update_interval: 300s
- platform: bme280
temperature:
name: "BME280 Temperature"
oversampling: 16x
pressure:
name: "BMP280 Pressure"
oversampling: 16x
humidity:
name: "BME280 Humidity"
oversampling: 16x
address: 0x76
iir_filter: 4x
update_interval: 60s
text_sensor:
- platform: wifi_info
ip_address:
name: "${device_name} IP"
icon: mdi:ip-network
mac_address:
name: "${device_name} MAC"
icon: mdi:lan
- platform: template
name: "${device_name} uptime"
id: uptime_human
icon: mdi:clock-start
power_supply:
- id: "led"
pin:
pcf8574: pcf8574_hub
number: 7
mode:
output: true
inverted: true
keep_on_time: 30sec
output:
- platform: esp8266_pwm
pin: D6
frequency: 1220 Hz
id: pwm_led1
power_supply: "led"
- platform: esp8266_pwm
pin: D7
frequency: 1220 Hz
id: pwm_led2
power_supply: "led"
light:
- platform: cwww
name: "LED TV"
cold_white: pwm_led1
warm_white: pwm_led2
cold_white_color_temperature: 6000 K
warm_white_color_temperature: 3000 K
gamma_correct: 0
constant_brightness: false
switch:
- platform: restart
name: "${device_name} restart"
- platform: gpio
name: "K1 PS4"
pin:
pcf8574: pcf8574_hub
number: 0
mode:
output: true
inverted: true
- platform: gpio
name: "K2 WZM+DAC"
pin:
pcf8574: pcf8574_hub
number: 1
mode:
output: true
inverted: true
id: wzmacniacz
interlock: [amplituner]
- platform: gpio
name: "K3 Rezerwa"
pin:
pcf8574: pcf8574_hub
number: 2
mode:
output: true
inverted: true
- platform: gpio
name: "K4 RPi4"
pin:
pcf8574: pcf8574_hub
number: 3
mode:
output: true
inverted: true
- platform: gpio
name: "K5 Vu+"
restore_mode: ALWAYS_ON
pin:
pcf8574: pcf8574_hub
number: 4
mode:
output: true
inverted: false
- platform: gpio
name: "K6 TV"
restore_mode: ALWAYS_ON
pin:
pcf8574: pcf8574_hub
number: 5
mode:
output: true
inverted: false
- platform: gpio
name: "K7 Ampli"
restore_mode: ALWAYS_ON
pin:
pcf8574: pcf8574_hub
number: 6
mode:
output: true
inverted: false
id: amplituner
interlock: [wzmacniacz]
1 polubienie