Skip to content

Calling syslog.log too early in the boot process prevents esp8266 from booting #7

@pmannk

Description

@pmannk

Hi there!
Firstly thanks for this great component, I've been using it to log time-based events and it's been very useful.

This evening I stumbled on a scenario where I believe esphome_syslog prevents an esp device from booting successfully.
In this scenario the esphome api, web_server and remote logger all stop functioning. Fortunately OTA is still available.
I have a script which is called by "on_boot" and under normal circumstances it never calls syslog.log until well after the esp boots, time syncs, api connects, etc.
Tonight the script tried to call syslog.log immediately after a reboot and that's where things went awry.

I use the following syslog configuration:

syslog:
  enable_logger: false
  ip_address: "192.168.x.x"
  port: 514

The following on_boot reproduces the problem:

esphome:
  on_boot:		  
    priority: 700.0
    then:
      - wait_until:
          wifi.connected:
      - syslog.log:
          level: 5
          tag: "ESPHome"
	  payload: "This will break things"

This on_boot also causes issues:

esphome:
  on_boot:		  
    priority: -100.0
    then:
      - syslog.log:
          level: 5
          tag: "ESPHome"
	  payload: "This will break things"

However this on_boot works fine:

esphome:
  on_boot:		  
    priority: 700.0
    then:
      - wait_until:
          time.has_time:
          #also working is api.connected:
      - syslog.log:
          level: 5
          tag: "ESPHome"
          payload: "This will work fine"

I can see you have return setup_priority::LATE; defined, so I'm not sure where else to go looking for the cause of this issue.
For the moment I have a workaround in place (testing for api.connected anywhere that I call syslog.log).

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions