I am trying to automate my humidifier and I am really new at this and really not sure how to go about doing this. I have three thermostats added into home assistant that have a humidity reading I can use as my base. I am looking to average the three thermostat humidities and if the value is 35% or lower, I need it to trigger the raw captures I have in my other post (AirCare EP9R 800 humidifier pedestal). The caveat to all of this is the humidifier thinks it “has lost the remote” if it does not dial back every 60s with the same RAW RF. The other issue is it is needed to send multiple times on each of the 60 seconds. The current remote provided from the manufacturer repeats 5 times ever 20 seconds, but I have found I can send them as long as 2 min.
In essence I am looking for:
If (average(humidity on thermostats))<35% run on loop
send raw on 5 times
repeat every 60 seconds
if (average(humidity on thermostats))>35% run off loop
send raw on 5 times
repeat every 60 seconds
I have read a lot of the documentation, but I really don’t get where I am supposed to be adding these different things like:
My YAML from esphome
esphome:
name: lr-esp360
friendly_name: lr-esp360
esp32:
board: esp32dev
framework:
type: arduino
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_pswd
api:
encryption:
key: XXXXX
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;'
#i2c bus definition
i2c:
sda: 21
scl: 22
scan: true
id: bus_a
#Offsets have been added to the measurements taken.
#These are necessary due to the heat generated by the PCB, the second layer of the board, and the case.
#This way, sufficiently accurate values are obtained for automations
sensor:
- platform: shtcx
temperature:
name: "ESP360 Temperature Living Room"
filters:
- median:
window_size: 5
send_every: 1
- offset: -3.7
humidity:
name: "ESP360 Humidity Living Room"
filters:
- median:
window_size: 5
send_every: 1
- offset: +19.1
address: 0x70
update_interval: 300s
- platform: bh1750
name: "ESP360 BH1750 Illuminance Living Room"
filters:
- multiply: 5
address: 0x23
update_interval: 10s
- platform: wifi_signal
name: "ESP360 Living Room WiFi signal"
update_interval: 60s
#Setting up IR and RF receivers
remote_receiver:
- id: RF_RX
pin:
number: GPIO5
inverted: True
dump: raw
tolerance: 35%
filter: 255us
idle: 10ms
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);
str += ",";
if (it != x.end() - 1) str += " ";
}
if (str.size() > 0) str.erase( str.end() - 2);
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;'
#Setting up IR and RF transmitters
remote_transmitter:
- id: RF_TX
pin: GPIO18
carrier_duty_percent: 100%
- id: IR_TX
pin: GPIO13
carrier_duty_percent: 50%
#Status LED
switch:
- platform: gpio
pin: 12
name: "Status Led"
restore_mode: ALWAYS_ON
- platform: template
name: "Humidifier"
turn_on_action:
- remote_transmitter.transmit_raw:
code: [244,-814,244,-815,244,-814,245,-814,244,-814,244,-815,244,-3214,520,-1542,520,-521,520,-1542,1550,-533,520,-521,520,-521,520,-521,520,-534,520,-1543,520,-529,520,-1543,1542,-516,247]
transmitter_id: RF_TX
repeat:
times: 4
wait_time: 5ms
turn_off_action:
- remote_transmitter.transmit_raw:
code: [244,-814,244,-814,244,-814,245,-814,244,-814,244,-814,244,-3205,520,-1542,521,-521,520,-521,1541,-1563,521,-521,520,-521,1541,-522,1541,-533,520,-1551,520,-521,1541,-1543,520,-1537,248]
transmitter_id: RF_TX
repeat:
times: 4
wait_time: 5ms
#Enable internal web server
#web_server:
# port: 80
ota:
password: !secret ota_pswd
# Enable logging
logger:
# level: info