With custom components going deprecated I decided to try my hand at converting my fine offset custom component to External Component, its mostly a copy and paste from different existing components but its working.
And might be a good starting point if you want to make a receiver for some different sensor.
just set the pin to whatever you have the 433 receiver connected to and you are set, then just change “if(data.id==99)” to the sensor you have and just copy and paste for more sensors.
https://github.com/flax2000/my-esphome-components/tree/main
esphome:
name: wh2_tst
esp8266:
board: esp01_1m
framework:
version: recommended
wifi:
output_power: 12 #10-20
power_save_mode: HIGH #HIGH NONE LIGHT
fast_connect: true
ssid: "xxxxxxxxxxx"
password: "xxxxxxxxx"
#use_address: minimal-tst.local
# Enable logging
logger:
baud_rate: 0
# Enable Home Assistant API
api:
ota:
- platform: esphome
external_components:
source: github://flax2000/my-esphome-components@main
components: [ rf_sensors ]
# - source:
# type: local
# path: my_components
rf_sensors:
pin: 3
on_sensor_received:
- lambda: |-
ESP_LOGD("wh2", "wh2 id:%i tmp %.1f hum %.0f ", data.id, data.temperature, data.humidity);
if(data.id==99)
{
id(wh2_temperature_).publish_state(data.temperature);
id(wh2_humidity_).publish_state(data.humidity);
}
sensor:
- platform: template
name: "wh2 temperature"
unit_of_measurement: °C
accuracy_decimals: 1
device_class: "temperature"
state_class: "measurement"
id: wh2_temperature_
filters:
- median:
window_size: 3
send_every: 1
- platform: template
name: "wh2 humidity"
unit_of_measurement: '%'
accuracy_decimals: 0
device_class: "humidity"
state_class: "measurement"
id: wh2_humidity_
filters:
- median:
window_size: 3
send_every: 1