Esphomelib - A comprehensive solution for using ESPs with Home Assistant

What is the “ultrasonic”.

ultrasonic distance sensor.

https://components101.com/ultrasonic-sensor-working-pinout-datasheet

That 5V pin in your drawing is an input (Vin). You need to power the ultrasonic from eanother voltage source of +5V.

I think you can use VIN for voltage out if you use power via usb?

When I attach the multimeter to VIN + GND it reads 4.7V

Ahh it seems some nodemcu chips have 5V out on VIN.

One of my chips measures ~.9V on VIN and the other measures ~4.7V on VIN

thats correct, you can use it to grab 5v from the USB supply

Ahh I see, my mistake.

Here’s another example of the ultrasonic hookup:

I’ve removed a GPIO from my yaml of a device I’m working on and re-compiled to the ESP8266 but the binary sensor still shows up in hassio, even after a restart. Is there a method to cleanup sensors?

The usual recommendation I followed in this case was that the ultrasonic sensor’s trigger can be directly connected to an output pin on the ESP (i.e. trigger on 3.3V normally works), but the receiver should be connected through a voltage divider to the ESP’s input pin.

like this?
voltage-divider-circuit%20(1)

Yes, correct. “5V” end goes to the receiver pin on the ultrasonic sensor, “3.3V” goes to the ESP input.

Ok, I’ve found a method to cleanup old, inactive topics. Apologies if this is rudimentary.

From the Developer services in HA, call the mqtt.publish service and send a zero byte payload to the topic you want to clear. You can find a current list of topics from either espyamlhome logging or SSH into HA and type:

mosquitto_sub -v -t '#'

The JSON when clearing the topic from HA:

{
"topic":"homeassistant/binary_sensor/alarm_panel/box__siren_tamper/config",
"retain":"true"
}

Then restart HA. Hope this helps someone.

@OttoWinter, any chance we could have feature implemented into the addon to make this process easier?

2 Likes

I am trying to do the first upload of a yaml file from a Raspberry to a NodeMCU via a USB cable and I am getting the following error:

Segmentation fault
*** [.pioenvs/livingroom/firmware.bin] Error 139

Any advice on resolving this will be appreciated.

@talondnb hi friend can you post an example how to configure Ota? I cant sent the code…the esphomelib return always this error:

Host: teste.internal.local not found.

Follow this post:

1 Like

@OttoWinter: thanks for your answer. You were right the problem was in the initial flashing stage, something wrong with the serial-USB device. Finally it got it at /dev/ttyUSB1 and it appears on the dashboard.

Then the compilation and the first firmware upload by USB apparentely works, great!!! but I can’t see the log. I’m using the dashboard and once the upload process finishes, it seems to call the Log option but something is wrong there because there is no answer. This is the upload log:

INFO [esphomeyaml.__main__] Successfully compiled program.
INFO [esphomeyaml.__main__] Uploading binary...
INFO [esphomeyaml.__main__] Running:  esptool.py --before default_reset --after hard_reset --chip esp8266 --port /dev/ttyUSB0 write_flash 0x0 sonoff_sirena1/sonoff_sirena1/.pioenvs/sonoff_sirena1/firmware.bin
esptool.py v2.3.1
Connecting....
Chip is ESP8266EX
Features: WiFi
Uploading stub...
Running stub...
Stub running...
Configuring flash size...
Auto-detected Flash size: 1MB
Compressed 330448 bytes to 230478...
Writing at 0x0001c000... (53 %)
Writing at 0x00020000... (60 %)
Wrote 330448 bytes (230478 compressed) at 0x00000000 in 21.1 seconds (effective 125.4 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting via RTS pin...
INFO [esphomeyaml.__main__] Successfully uploaded program.
INFO [esphomeyaml.__main__] Starting log output from /dev/ttyUSB0 with baud rate 115200

If I use the Show Logs option of the dashboard I get the same results:

INFO [esphomeyaml.config] Reading configuration...
INFO [esphomeyaml.__main__] Starting log output from /dev/ttyUSB0 with baud rate 115200

Then, if I plug the sonoff switch to 220AC, I can’t see anything. No ping, no new MQTT discovered device, anything.

Am I missing something sure, but i can’t see it!. Thanks in advance for your help.

Hmm weird. I think there could be two reasons why it’s not showing any logs:

  • It’s still in flash mode. When you uploaded the firmware I suppose you had to first put it into flash mode by pressing some button while plugging it into USB. Try disconnecting+reconnecting the USB cable and then pressing the logs button.
  • All the initial log messages are already over when you press the show logs button. I guess the only option to work around this at this time is using a serial monitor on your computer (not hassIO). For example, you could connect the Sonoff device to your computer and use the serial monitor on the Arduino IDE to view the serial logs (set baud rate to 115200).

I’m away from my development machine for a few days so I can’t really help much more at this point (this is also why I’m not active on the GitHub issue tracker atm, sorry everybody!)

how to configure two PCF8574 I/O Espander?

will this work?

pcf8574:

  • id: ‘pcf8574_hub1’
    address: 0x20
    pcf8575: False

  • id: ‘pcf8574_hub2’
    address: 0x21
    pcf8575: False

(sorry for the poor formatting)

Hi, It’s working!!!
First option: it was in flash mode. I tried to disconnecting+reconnecting the USB cable, then go to the log button and the issue was there: some problem with the WiFi network. Then I change the WiFi and everything started working !!!

This is awesome , some minutes later I had two switches working in my Home assistant. Thanks a lot!

1 Like

i have the same problem have you found any solution

ERROR [esphomeyaml.espota] No response from the ESP

That does not appear to be the same problem.