Hello friends,
Ok, this is a silly one. I made a small machine that uses the OpenSky integration to display when an airplane is overhead. When it enters my area it displays the flight number on an OLED display and spins a little 3D-printed plane around. This is hardly a home automation must-have, but by golly does it amuse me.
It uses an ESP8266-01, an OLED screen and a small geared motor. The code is handled by ESPHome.
In order to get the callsign as a sensor in Home Assistant you must use the “Event sensor”-integration from HACS. The setup for this is:
- platform: eventsensor
name: OpenSky Callsigns
event: opensky_entry
state: callsign
ESPHome setup:
esphome:
name: flight_display
platform: ESP8266
board: esp01_1m
wifi:
ssid: "SSID"
password: "PWD HERE"
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Flight Display Fallback Hotspot"
password: "PWD"
captive_portal:
# Enable logging
logger:
# Enable Home Assistant API
api:
ota:
text_sensor:
- platform: homeassistant
name: "Flight Callsign"
entity_id: sensor.opensky_callsigns
id: flight_callsign
internal: true
font:
- file: "dealer.ttf"
id: bigFont
size: 30
- file: "arial.ttf"
id: smallFont
size: 12
- file: 'materialdesignicons-webfont.ttf'
id: icon
size: 30
glyphs:
- "\U000F001D" # mdi-airplane
i2c:
sda: 2
scl: 0
display:
- platform: ssd1306_i2c
model: "SSD1306 128x64"
address: 0x3C
id: my_display
lambda: |-
it.print(64, 15, id(icon), TextAlign::CENTER, "\U000F001D");
it.printf(64, 51, id(bigFont), TextAlign::CENTER, "%s", id(flight_callsign).state.c_str());
switch:
- platform: gpio
pin: RX
name: "Flight Motor"
Automation:
- alias: "Flight entry"
trigger:
platform: event
event_type: opensky_entry
action:
- service: notify.mobile_app_my_mobile
data:
message: "Flight {{ trigger.event.data.callsign }} entered"
- service: switch.turn_on
entity_id: switch.flight_motor
- delay:
seconds: 10
- service: switch.turn_off
entity_id: switch.flight_motor