#Yet another ESP-Now within ESPHome
25 messages · Page 1 of 1 (latest)
I recreated the bridge part of this project using ESPNow as well. So that makes it easier to use, the sender YAML just has a now_mqtt. Then on another ESP32 you just add the wifi and mqtt sections like normal, then just a now_mqtt_bridge .
added RSSI
added the icon, version, and board information
Maybe my last small improvement:
Added an on_sent callback. Now you can count the number of measurements that have been sent, when all of them are sent, enter sleep.
now_mqtt: on_sent: then:
Hi, the node does not compile with a binary sensor
esphome:
name: espnowtest
platformio_options:
board_build.f_flash: 40000000L
board_build.flash_mode: dio
board_build.flash_size: 4MB
esp32:
board: lolin_s2_mini
variant: ESP32S2
framework:
type: arduino
logger:
# import the components
external_components:
- source:
type: git
url: https://github.com/u-fire/ESPHomeComponents/
# no need for api or wifi block when using just ESP-Now
now_mqtt:
# i2c:
# sda: 7
# scl: 6
# sensor:
# - platform: bme280
# id: bme
# temperature:
# name: "Temperature"
# humidity:
# name: "Humidity"
# pressure:
# name: "Pressure"
# address: 0x76
binary_sensor:
- platform: gpio
pin: GPIO19
name: test
I only included sensor , but it wouldn't be hard to include others I think.
https://github.com/u-fire/ESPHomeComponents/blob/9f2efc1ebfde019e95ad0b552ff93489aece6236/esphome/components/now_mqtt/now_mqtt.cpp#L46 is where it only picks out sensors. I'm not sure if the MQTT for binary_sensor works the same, so that'd be the part I'm not sure on.
nice ! now espresense + esphome on 1 device pls 😛
I haven't seen that project before. Let me know if it works out. I'm looking at adding the other types (binary_sensor) now.
added this
Great, thanks a lot
Does this also work for sending data/commands via ESP-Now? Something like Home Assistant -> MQTT Broker -> ESP Bridge -> End ESP Device (via ESP-Now)?
No, I kept it one way. Sensor to HA. It seemed to make the most sense for a battery powered device that sleeps most of the time.
added text sensors for this
https://microfire.co/articles/espnow-with-esphome (correct link) 😛
oof thanks
Can it be both way (optional) if nodes are not battery powered?
Well anything is possible, but the code isn't there to do it. With a bit of copy/paste between the bridge code and the sender code, it could be done.
I’m trying to do this
Switch as mqtt broker
Button press sends mqtt command to toggle/dim to light bulbs that are connected as nodes
Is that doable? So far i’ve only done it on tasmota with tasmesh
Yea, and I think it would actually be pretty quick and responsive, but the code for it isn't there at the moment. You'd need to transplant this function https://github.com/u-fire/ESPHomeComponents/blob/368ef3f6022d0087a3a59c0538c87f5c43afa02b/esphome/components/now_mqtt_bridge/now_mqtt_bridge.cpp#L15 from the bridge into the sender https://github.com/u-fire/ESPHomeComponents/blob/master/esphome/components/now_mqtt/now_mqtt.cpp.
Unfortunately that’s beyond me since i’m not much of coder 😅
Here’s hoping for new update
@gritty sky that is awesome!
I was also looking for a way to create a proxy to auto-accept (and generate) entities on the homeassistant side.
I really love your idea of conveying key data and using mqtt and adding this to create an mqtt entity.
I was looking into creating a "proper" bluetooth entity through the custom-components/ble_monitor service, but using mqtt as a "proxy" layer is purely ingenious in here https://github.com/afarago/esphome_component_bthome but I think your direction is better.
I would seek for a solution that can act also in a low-power sensor environment. Having one esp-now message per sensor takes quite a big delay if you want to convey >4 sensors and then go to deep-sleep.
Do you think this two could be combined somehow?
- pre-flight / init phase (full sensor config info)
- regular updates (one message with all data combined)
Thanks for taking the time to check out the component.
So you're thinking about one transmission with all the sensor datapoints in one message, right? That could probably be implemented fairly easily. The component already uses a colon as a delimiter. You could probably just pick another delimiter that wraps the entire message, then parse it into an array you work through.
|message_1:data:points|message_2:data:points|
something like that.
I'm curious what the savings would be in transmission time.
Unfortunately one esp-now message is limited to ?250 characters, so in a verbose format is it not possible to transmit too many data points