esp360-remote/ESPHome Configuration/my_configuration.yaml
2023-11-11 20:17:19 -08:00

248 lines
5.6 KiB
YAML

esphome:
name: soggiorno_remote
esp32:
board: esp32doit-devkit-v1
framework:
type: arduino
# Enable logging
logger:
ota:
password: ""
wifi:
ssid: "name"
password: "pwd"
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Esp-Remote-Def Fallback Hotspot"
password: "BackupPwd"
captive_portal:
i2c:
sda: 21
scl: 22
scan: true
id: bus_a
sensor:
- platform: shtcx
temperature:
name: "Temperature"
id: "Temperature"
filters:
- median:
window_size: 5
send_every: 1
- offset: -3.7
humidity:
name: "Humidity"
id: "Humidity"
filters:
- offset: +19.1
- median:
window_size: 5
send_every: 1
address: 0x70
update_interval: 300s
- platform: bh1750
name: "BH1750 Illuminance"
filters:
- multiply: 5
address: 0x23
update_interval: 5s
- platform: internal_temperature
name: "Internal Temperature"
filters:
- median:
window_size: 5
send_every: 1
remote_receiver:
- id: RF_RX
pin:
number: GPIO5
inverted: True
dump:
#- raw
- rc_switch
tolerance: 35%
filter: 200us
idle: 4ms
buffer_size: 10kb
on_rc_switch:
- homeassistant.event:
event: esphome.rf_code_received
data:
protocol: !lambda 'return x.protocol;'
code: !lambda 'return x.code;'
- id: IR_RX
pin:
number: GPIO19
inverted: True
dump: all
on_raw:
- homeassistant.event:
event: esphome.ir_raw_code_received
data:
code: !lambda '
reverse(x.begin(), x.end());
std::string str = "";
for (auto it = x.begin(); it != x.end(); ++it)
{
str += to_string(*it);
if (it != x.end() - 1) {
str += ",";
str += " ";
}
}
return esphome::to_string("[" + str + "]");'
on_pronto:
- homeassistant.event:
event: esphome.ir_pronto_code_received
data:
code: !lambda 'return x.data;'
on_lg:
- homeassistant.event:
event: esphome.ir_lg_code_received
data:
data: !lambda 'return x.data;'
nbits: !lambda 'return x.nbits;'
on_panasonic:
- homeassistant.event:
event: esphome.ir_panasonic_code_received
data:
address: !lambda 'return x.address;'
command: !lambda 'return x.command;'
remote_transmitter:
- id: RF_TX
pin: GPIO18
carrier_duty_percent: 100%
- id: IR_TX
pin: GPIO13
carrier_duty_percent: 50%
web_server:
port: 80
switch:
- platform: template
name: "Luce"
optimistic: true
on_turn_on:
- remote_transmitter.transmit_rc_switch_raw:
transmitter_id: RF_TX
protocol:
pulse_length: 650
inverted: True
sync: [1, 10]
zero: [1 ,2]
one: [2, 1]
code: "10110000000000010001"
repeat:
times: 10
wait_time: 30ms
on_turn_off:
- remote_transmitter.transmit_rc_switch_raw:
transmitter_id: RF_TX
protocol:
pulse_length: 650
inverted: True
sync: [1, 10]
zero: [1 ,2]
one: [2, 1]
code: "10110000000000000000"
repeat:
times: 10
wait_time: 30ms
- platform: template
name: "Presa Luce"
optimistic: true
on_turn_on:
- remote_transmitter.transmit_rc_switch_raw:
transmitter_id: RF_TX
protocol:
pulse_length: 650
inverted: True
sync: [1, 10]
zero: [1 ,2]
one: [2, 1]
code: "10110000000011110000"
repeat:
times: 10
wait_time: 30ms
on_turn_off:
- remote_transmitter.transmit_rc_switch_raw:
transmitter_id: RF_TX
protocol:
pulse_length: 650
inverted: True
sync: [1, 10]
zero: [1 ,2]
one: [2, 1]
code: "10110000000011100001"
repeat:
times: 10
wait_time: 30ms
- platform: template
name: "LG TV"
turn_on_action:
remote_transmitter.transmit_lg:
transmitter_id: IR_TX
data: 0x20DF10EF
nbits: 32
- platform: template
name: "Umidificatore"
turn_on_action:
remote_transmitter.transmit_lg:
transmitter_id: IR_TX
data: 0x00FF00FF
nbits: 32
turn_off_action:
remote_transmitter.transmit_lg:
transmitter_id: IR_TX
data: 0x00FF00FF
nbits: 32
- platform: gpio
pin: 12
name: "Status Led"
restore_mode: ALWAYS_OFF
- platform: restart
name: "Riavvia"
climate:
- platform: coolix
name: "AC"
transmitter_id: IR_TX
sensor: Temperature
receiver_id: IR_RX
api:
services:
- service: send_ir_raw
variables:
command: int[]
then:
- remote_transmitter.transmit_raw:
transmitter_id: IR_TX
code: !lambda 'return command;'
- service: send_rf_raw
variables:
protocol_number: int
raw_data: string
then:
- remote_transmitter.transmit_rc_switch_raw:
transmitter_id: RF_TX
protocol: !lambda 'return esphome::remote_base::RC_SWITCH_PROTOCOLS[protocol_number];'
code: !lambda 'return raw_data;'