Using ESPHome to send datas to emoncms #33
alexandrecuer
started this conversation in
ESPHOME
Replies: 2 comments
-
|
previous yaml is not very clever as it will send 0 values when initializing the sensor if the time component is ran before the sensor component So should test something like that : esphome:
name: myesp8266
friendly_name: MyESP8266
esp8266:
board: nodemcu
# Enable logging
logger:
sensor:
- platform: dht
pin: D2
model: DHT22
temperature:
id: dht_temperature
humidity:
id: dht_humidity
name: DHThumidity
on_value:
then:
mqtt.publish_json:
topic: emon/DHT
payload: |-
root["DHTtemperature"] = id(dht_temperature).state;
root["DHThumidity"] = id(dht_humidity).state;
update_interval: 60s
mqtt:
broker: 192.168.1.7
port : 1883
username: !secret mqtt_username
password: !secret mqtt_password
ota:
- platform: esphome
password: !secret ota_password
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Myesp8266 Fallback Hotspot"
password: !secret ap_password
captive_portal: |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
same with a D18B20 https://community.home-assistant.io/t/how-to-publish-ds18b20-to-mqtt/701778 esphome:
name: myesp8266
friendly_name: MyESP8266
esp8266:
board: nodemcu
# Enable logging
logger:
mqtt:
broker: 192.168.1.7
port : 1883
username: !secret mqtt_username
password: !secret mqtt_password
ota:
- platform: esphome
password: !secret ota_password
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
one_wire:
- platform: gpio
pin: GPIO4
id: bus_ds18b20_1
sensor:
- platform: dallas_temp
one_wire_id: bus_ds18b20_1
name: "temp1"
resolution: 12
update_interval: 60s
state_topic: "sensors/t1" |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment

Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
https://esphome.io/
https://learn.adafruit.com/adafruit-huzzah-esp8266-breakout/pinouts
https://github.com/dromotherm/sandbox/blob/master/_HARDWARE_stm32/arduino_like_projects/arduino-dht/DHT22.pdf
First test with a DHT22
The DHT22 data pin has to be wired to
#4pin on this esp which is quite old.For pins labelled with
#nb, nb must be the gpio number.. thats whyD2has to be wired on#4...the sensor component automatically reads the DHT22 and if you include a name, it is discovered as a new MQTT entity by home assistant
the time component is only there to route values to emoncms, as things have to be done manually
Of course, you need a network protocol, here the mqtt component
Beta Was this translation helpful? Give feedback.
All reactions