Hi Peter,
This was my first little gadget, it is basically an 8 digit, 7 segment display soldered onto the same board as a DHT22 and a NodeMCU. And it all works. It cycles every 10 seconds between the time and the temp / humidity. It is hard wired onto a little board and to my eyes it looks quite cute. From here reporting back into HA is pretty much plug and play.
esphome:
name: nodemcu1
platform: ESP8266
board: nodemcuv2
wifi:
ssid: "<WiFi>"
password: "<password>"
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Nodemcu1 Fallback Hotspot"
password: "e9Y3KkD2CVY2"
captive_portal:
# Enable logging
logger:
# Enable Home Assistant API
api:
ota:
globals:
- id: disp_time
type: int
restore_value: no
initial_value: '1'
time:
- platform: homeassistant
id: homeassistant_time
timezone: Europe/London
- platform: sntp
id: sntp_time
sensor:
- platform: dht
model: dht22
pin:
number: D2
mode: INPUT_PULLUP
temperature:
name: "Den Temperature"
id: "dentemp"
humidity:
name: "Den Humidity"
id: "denhum"
update_interval: 60s
# matrix Display
spi:
clk_pin: D5
mosi_pin: D7
display:
- platform: max7219
cs_pin: D8
intensity: 5
num_chips: 1
lambda: |-
static int state = 0;
if (state == 0)
it.printf("%.0fc %.0frh", id(dentemp).state, id(denhum).state);
else
it.strftime(" %H.%M", id(sntp_time).now());
state = 1 - state;
update_interval: 10s
I really like how easy it is to set stuff like this up in ESPhome, however it is so far behind the Arduino community on support and online documentation that I have decided to take the plunge and start again with C++ through the Arduino IDE, which supports ESP8266 boards as well the Arduino boards and clones. Much harder to pick up but most / all problems seem to have been solved and documented by someone so actually my rate of learning has been much quicker and less frustrating. And also, in the end, you know C++!