Giter Club home page Giter Club logo

esphome-core's Introduction

ESPHome-Core Build Status Discord Chat GitHub release

ESPHome Core Logo

🚨 This repository is no longer used 🚨

Starting with v1.13.0 of ESPHome, the core codebase has merged into the python codebase.

Please create all patches against https://github.com/esphome/esphome. See esphome/feature-requests#97 for more info.

This is the source of the C++ library that powers ESPHome

For issues, please go to the issue tracker.

For feature requests, please see feature requests.

Note: Starting with 1.10.0 using ESPHome-Core directly through C++ is no longer officially supported. Please use the YAML syntax with ESPHome.

esphome-core's People

Contributors

alexdanault avatar badbadc0ffee avatar brandond avatar brianrjones69 avatar chris-jennings avatar dirkj avatar emwap avatar exxamalte avatar fabaff avatar gitter-badger avatar grea09 avatar hajdbo avatar ivankravets avatar janpieper avatar jesserockz avatar jonnyair avatar lobradov avatar mnoorenberghe avatar mvturnho avatar n0bel avatar nunofgs avatar ottowinter avatar per1234 avatar placidorevilla avatar puerari avatar puuu avatar quazzie avatar romrider avatar thejulianjes avatar voicevon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

esphome-core's Issues

Fans

The code for fans is available but it seems that app is not aware of that. application.h doesn't have any references to fans.

esphomelib seems to be the first tool that would allow one to control fan with an ESP.

Generic i2c (binary) sensor

Hi,

I would be nice to support a generic binary sensor such as PCF8574A or PCF8574P.

Keep up the excellent work!

Feature request: internal/hidden components

As mentioned in esphome/esphome-docs#10

It would be nice if some components (like switches) could be marked in such a way that they are not exposed in MQTT or the web interface. In the example given I use 2 switches to control relays for a cover motor. I don't want to expose these switches to mqtt/homeassistant as there is logic around them for interlocking. So I only want them to be controlled through the cover component.

I've been thinking about two possible implementations:

Explicit by using a flag (eg: internal, hidden, etc):

  switch:
    - platform: gpio
      pin: 12
      name: open
      id: open
      internal: true

Or implicit by not specifying a name for the component (it can still be used in automations as that uses the id instead of a name:

  switch:
    - platform: gpio
      pin: 12
      id: open

Currently my workaround is to 'hide' them from homeassistant by disabling their discovery:

  switch:
    - platform: gpio
      pin: 12
      name: open
      id: open
      # 'hide' this from homeassistant as we don't want it to be controller directly
      discovery: false

Lights show up as "Unavailable" in Homeassistant

I've managed to get the ESP devices going for the most part i think. But the devices i create show up as "Unavailable" in home assitant. I just want to start with a couple of On Off leds.

my ESP code:

#include "esphomelib/application.h"

using namespace esphomelib;

void setup() {
  App.set_name("Displate Leds");
  App.init_log();

  App.init_wifi("xxxx", "xxxx");
  App.init_mqtt("xxx", "homeassistant", "xxxx");
  auto *ota = App.init_ota();
  // Set a plaintext password, alternatively use an MD5 hash for maximum security (set_auth_password_hash)
  ota->set_auth_plaintext_password("xxxxx");
  ota->start_safe_mode();

  App.make_binary_light("Displate 1", App.make_gpio_output(13));
  App.make_binary_light("Displate 2", App.make_gpio_output(5));
  App.make_binary_light("Displate 3", App.make_gpio_output(4));
  App.make_binary_light("Displate 4", App.make_gpio_output(15));
  App.make_binary_light("Displate 5", App.make_gpio_output(12));

  App.setup();
}

void loop() {
  App.loop();
}

Now the device and home assistant subscribe to the MQTT broker:

starting version 3.2.2
1522445452: mosquitto version 1.4.12 (build date 2017-06-01 13:03:46+0000) starting
1522445452: Config loaded from /etc/mosquitto.conf.
1522445452: Opening ipv4 listen socket on port 1883.
1522445452: Opening ipv6 listen socket on port 1883.
1522445452: Warning: Mosquitto should not be run as root/administrator.
1522445453: New connection from 172.30.32.1 on port 1883.
1522445453: New client connected from 172.30.32.1 as b0919dcd-0a78-4ad9-9aab-0c4c9de3f5ae (c1, k60, u'homeassistant').
1522445453: New connection from 192.168.1.67 on port 1883.
1522445453: New client connected from 192.168.1.67 as displates-5ccf7f024ecf (c1, k15, u'homeassistant').
1522445692: Socket error on client displates-5ccf7f024ecf, disconnecting.
1522445713: New connection from 192.168.1.67 on port 1883.
1522445713: New client connected from 192.168.1.67 as displate_leds-5ccf7f024ecf (c1, k15, u'homeassistant').

Home assistant finds the lights, but they appear as "Unavailable":
screen shot 2018-03-30 at 23 42 45

What could be the issue ? Can't find anything useful in the logs.

Also, how do i remove auto discovered items from Home assistant ?

BMP285 different from BMP085

Just tried attaching a BMP285, and I get

�[0;35m[C][sensor.bmp085:038]: Setting up BMP085...�[0m
�[0;35m[C][sensor.bmp085:039]:     Address: 0x76�[0m
�[0;35m[C][component:178]:     Update interval: 30000ms�[0m
[...]
�[0;36m[D][sensor.bmp085:084]: Got Temperature=82.6°C�[0m
�[0;36m[D][sensor.mqtt:038]: 'Temperatur': Pushing out value 82.599998 with accuracy 1�[0m
�[0;36m[D][sensor.bmp085:124]: Got Pressure=801023.7hPa�[0m
�[0;36m[D][sensor.mqtt:038]: 'Druck': Pushing out value 801023.687500 with accuracy 1�[0m
�[0;36m[D][sensor.bmp085:084]: Got Temperature=82.6°C�[0m
�[0;36m[D][sensor.bmp085:124]: Got Pressure=801021.9hPa�[0m
�[0;36m[D][sensor.bmp085:084]: Got Temperature=82.6°C�[0m
�[0;36m[D][sensor.bmp085:124]: Got Pressure=801021.9hPa�[0m
�[0;36m[D][sensor.bmp085:084]: Got Temperature=82.6°C�[0m
�[0;36m[D][sensor.bmp085:124]: Got Pressure=801021.9hPa�[0m
�[0;36m[D][sensor.bmp085:084]: Got Temperature=82.6°C�[0m
�[0;36m[D][sensor.bmp085:124]: Got Pressure=801021.9hPa�[0m

Comparing the data-sheets for BMP185 and BMP285, it looks like the latter requires completely different formulas for the calculation of the results.

Is it worth looking into this, or am I wrong?

ESP8266: Only pins 0-16 support PWM

I'm attempting to assign a PWM output to GPIO16 of my ESP8266-12E. When attempting to compile, I'm receiving the error: _ERROR [esphomeyaml.config] Error while reading config: ESP8266: Only pins 0-16 support PWM.

My yaml includes the following:

esphomeyaml:
  platform: ESP8266
  board: esp12e

output:
  - platform: esp8266_pwm
    pin: 16
    id: redPin

Suggestion

Hi there,

your project seems to be a great building block for adding devices to HA.

Have you thought about adding WifiManager capabilities - if no known network is found...

Compiler error wire.h not found

Compiling .pioenvs\nodemcuv2\libc8a\I2Cdevlib-esphomelib_ID3838\AD7746.cpp.o
In file included from .piolibdeps\PCA9685 16-Channel PWM Driver Module Library\PCA9685.cpp:25:0:
.piolibdeps\PCA9685 16-Channel PWM Driver Module Library\PCA9685.h:61:18: fatal error: Wire.h: No such file or directory



#include <Wire.h>
^
compilation terminated.
*** [.pioenvs\nodemcuv2\lib000\PCA9685 16-Channel PWM Driver Module Library\PCA9685.cpp.o] Error 1
In file included from .piolibdeps\I2Cdevlib-esphomelib_ID3838\src\AD7746.h:38:0,
from .piolibdeps\I2Cdevlib-esphomelib_ID3838\src\AD7746.cpp:35:
.piolibdeps\I2Cdevlib-esphomelib_ID3838\src\I2Cdev.h:53:18: fatal error: Wire.h: No such file or directory



#include <Wire.h>
^
compilation terminated.
*** [.pioenvs\nodemcuv2\libc8a\I2Cdevlib-esphomelib_ID3838\AD7746.cpp.o] Error 1

[Solved] Uninstall silently esptool !!!

Discovered checking what it did when I installed esphomelib and I discovered it removed from my system without asking esptools from it !! What are these gangsters way to do ??
It should ask me if I want to remove it ?? and why does it need to be removed ? conflict in some libs ?

Publish processed values instead of raw sensor data

I'd like to take raw sensor data, process it, and then send along derived values over MQTT. I don't want to publish raw distance sensor data on a periodic basis, but would rather take the data and only publish when the values cross some pre-defined threshold(s). For example, using a ceiling-mounted distance sensor to detect both if a garage door is opened/closed and if a vehicle is present.

WLAN RSSI sensor

I might take this one on myself as a learning opportunity - but it would be nice to be able to report the wifi signal strength. I know this is available in STA mode on ESP32; not sure about ESP8266.

[Feature-request] Redundant WiFi infrastructure

Do you plan to implement support for redundant WiFi connections?

It would improve fault tolerance if ESP is able to connect to different AP if some issue with current is detected.

Issues that come to mind are:

  • AP is unavailable,
  • AP does not provide IP address (DHCP is malfunctioning),
  • the default gateway is not assigned,
  • DNS server is not assigned,
  • DNS server is not connectable,
  • MQTT server (if used) is not connectable.

Output pin `inverted` configuration broken

Discovered while trying example from docs: (esphome/esphome-docs#7)

This config is valid, but does not work:

output:
  - platform: esp8266_pwm
    id: basic_green_led
    pin: GPIO13
    inverted: true

There is no difference in the generated main.cpp files if inverted is changed from true/false or even is ommited.

Current working configuration:

output:
  - platform: esp8266_pwm
    id: basic_green_led
    pin:
      number: GPIO13
      inverted: true

Hassio addon cannot compile

Using hassio addon 1.6.2 after run the wizard for nodemmcu esp8266 12e i get the following error
esphomeyaml:
name: termoacumulador
platform: ESP8266
board: esp12e

[API] ConnectionError: HTTPConnectionPool(host='api.platformio.org', port=80): Max retries exceeded with url: /v2/lib/search?query=name%3A%22ArduinoOTA%22 (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f6a96761150>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution',)) (incremented retry: max=5, total=5)

ATXComponent output level

My hardware has power regulator that needs to be control as part of the light. The ATXComponent is exactly what I need.

Unfortunately, my regulator control is active high and the ATXComponent is active low.

Could the ATXComponent be based on gpio_binary_output_component so it can leverage the inverted feature ?

I can make the changes and do a pull request once design is approved.

Compile error

On fresh installation I tried to use esphomelib with the example but ended up with a compile error.

src/main.cpp:1:36: fatal error: esphomelib/application.h: No such file or directory
compilation terminated.

Sorry, I can't help to debug this any further because I'm not really PlatformIO user.

Build instructions

I would like to make a few changes to my fork of esphomelib, but while I'm a fairly experienced embedded developer I have had trouble finding out how to build esphomelib and get platformio to use it -- some quick build instructions in the README would be nice.

PlatformIO instructions

This probably isn't an issue for people familiar with PlatformIO but it's never mentioned in the readme that you need to install esphomelib in PlatformIO. It's spelled out clearly for the Arduino IDE. It would be helpful information for newcomers to the tool like me. Thanks!

Compiliation fails with error in `deep_sleep`

When trying to compile a very basic example I get the following error:

.piolibdeps/esphomelib/src/esphomelib/deep_sleep_component.cpp: In member function 'void esphomelib::DeepSleepComponent::begin_sleep()':
.piolibdeps/esphomelib/src/esphomelib/deep_sleep_component.cpp:74:38: error: no matching function for call to 'EspClass::deepSleep(esphome
lib::optional<long long unsigned int>&)'

ESP.deepSleep(this->sleep_duration_);
^
.piolibdeps/esphomelib/src/esphomelib/deep_sleep_component.cpp:74:38: note: candidate is:
In file included from .piolibdeps/esphomelib/src/esphomelib/deep_sleep_component.cpp:9:0:
/home/jan/.platformio/packages/framework-arduinoespressif8266/cores/esp8266/Esp.h:95:14: note: void EspClass::deepSleep(uint64_t, RFMode)
void deepSleep(uint64_t time_us, RFMode mode = RF_DEFAULT);
^
/home/jan/.platformio/packages/framework-arduinoespressif8266/cores/esp8266/Esp.h:95:14: note:   no known conversion for argument 1 from '
esphomelib::optional<long long unsigned int>' to 'uint64_t {aka long long unsigned int}'
*** [.pioenvs/nodemcuv2/libaa2/esphomelib/esphomelib/deep_sleep_component.cpp.o] Error 1
.piolibdeps/esphomelib/src/esphomelib/esppreferences.cpp:14:20: warning: 'esphomelib::TAG' defined but not used [-Wunused-variable]
static const char *TAG = "preferences";

It started to happen once I upgraded from esphomelib 1.1 to 1.5.3

Support for ESP32's hall sensor

The ESP32 has a built-in hall sensor. It's possible to use hallRead() in the Arduino IDE.

void loop() {
  int hall = 0;
  hall = hallRead();
  Serial.println(hall); 
	delay(3000);
}

I guess that it would only be useful for people who don't have any real sensors around to play with an actual sensor value beside using ADC pin and touch them 😉 .

Complie fail for Ultrasonic Sensor

Tried compiling a binary for a HC-SR04 with yaml entries exactly as per the instructions, but I get the following error:

Compiling .pioenvs/couchsensorz/lib698/FastLED/FastLED.cpp.o Compiling .pioenvs/couchsensorz/lib698/FastLED/bitswap.cpp.o Compiling .pioenvs/couchsensorz/lib698/FastLED/colorpalettes.cpp.o Compiling .pioenvs/couchsensorz/lib698/FastLED/colorutils.cpp.o Compiling .pioenvs/couchsensorz/lib698/FastLED/hsv2rgb.cpp.o Compiling .pioenvs/couchsensorz/lib698/FastLED/lib8tion.cpp.o Compiling .pioenvs/couchsensorz/lib698/FastLED/noise.cpp.o Compiling .pioenvs/couchsensorz/lib698/FastLED/power_mgt.cpp.o Compiling .pioenvs/couchsensorz/lib698/FastLED/wiring.cpp.o Compiling .pioenvs/couchsensorz/src/main.cpp.o Compiling .pioenvs/couchsensorz/lib4d9/ESP8266WiFi/ESP8266WiFi.cpp.o Compiling .pioenvs/couchsensorz/lib4d9/ESP8266WiFi/ESP8266WiFiAP.cpp.o Compiling .pioenvs/couchsensorz/lib4d9/ESP8266WiFi/ESP8266WiFiGeneric.cpp.o Compiling .pioenvs/couchsensorz/lib4d9/ESP8266WiFi/ESP8266WiFiMulti.cpp.o Compiling .pioenvs/couchsensorz/lib4d9/ESP8266WiFi/ESP8266WiFiSTA.cpp.o src/main.cpp: In function 'void setup()': src/main.cpp:15:93: error: no matching function for call to 'esphomelib::Application::make_ultrasonic_sensor(const char [18], int)' auto application_makeultrasonicsensor = App.make_ultrasonic_sensor("Ultrasonic Sensor", 12); ^ src/main.cpp:15:93: note: candidate is: In file included from src/main.cpp:2:0: .piolibdeps/esphomelib/src/esphomelib/application.h:464:24: note: esphomelib::Application::MakeUltrasonicSensor esphomelib::Application::make_ultrasonic_sensor(const string&, const esphomelib::GPIOOutputPin&, const esphomelib::GPIOInputPin&, uint32_t) MakeUltrasonicSensor make_ultrasonic_sensor(const std::string &friendly_name, ^ .piolibdeps/esphomelib/src/esphomelib/application.h:464:24: note: candidate expects 4 arguments, 2 provided *** [.pioenvs/couchsensorz/src/main.cpp.o] Error 1 ========================== [ERROR] Took 27.45 seconds ==========================

Any idea what could be wrong?

Compile error ESP8266

Hi,

I'm trying to build something for an NodeMCU v2 device.

#include "esphomelib/application.h"

using namespace esphomelib;

void setup() {
  App.set_name("displates");
  App.init_log();

  App.init_wifi("xxxxxx", "xxxxxxxx");
  App.init_mqtt("192.168.1.xxx", "homeassistant", "xxxxxxxxxxx");
  auto *ota = App.init_ota();
  // Set a plaintext password, alternatively use an MD5 hash for maximum security (set_auth_password_hash)
  ota->set_auth_plaintext_password("knippen5");
  ota->start_safe_mode();

  App.make_monochromatic_light("Displate 1", App.make_ledc_output(13)); // supports brightness
  
  App.setup();
}

void loop() {
  App.loop();
}

Compiling the code gives:

[Sun Mar 25 19:39:21 2018] Processing displates (platform: espressif8266; board: nodemcuv2; framework: arduin
o)
--------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
PLATFORM: Espressif 8266 > NodeMCU 1.0 (ESP-12E Module)
SYSTEM: ESP8266 80MHz 80KB RAM (4MB Flash)
Library Dependency Finder -> http://bit.ly/configure-pio-ldf

LDF MODES: FINDER(chain) COMPATIBILITY(light)
Collected 32 compatible libraries
Scanning dependencies...
Dependency Graph
|-- <PubSubClient> v2.6
|-- <ArduinoJson> v5.13.1
|-- <DHT> v1.0.0
|-- <DallasTemperature> v3.8.0
|   |-- <OneWire> v2.3.4
|-- <PCA9685 16-Channel PWM Driver Module Library> v1.2.9 #22b7212
|   |-- <Wire> v1.0
|-- <ESP8266WiFi> v1.0
|-- <ArduinoOTA> v1.0
|   |-- <ESP8266WiFi> v1.0
|   |-- <ESP8266mDNS>
|   |   |-- <ESP8266WiFi> v1.0
Compiling .pioenvs/displates/src/examples/displates.cpp.o
Compiling .pioenvs/displates/src/src/esphomelib/application.cpp.o
Compiling .pioenvs/displates/src/src/esphomelib/binary_sensor/binary_sensor.cpp.o
Compiling .pioenvs/displates/src/src/esphomelib/binary_sensor/mqtt_binary_sensor_component.cpp.o
examples/displates.cpp: In function 'void setup()':
examples/displates.cpp:26:50: error: 'class esphomelib::Application' has no member named 'make_ledc_output'
App.make_monochromatic_light("Displate 1", App.make_ledc_output(13)); // supports brightness
^
Compiling .pioenvs/displates/src/src/esphomelib/component.cpp.o
*** [.pioenvs/displates/src/examples/displates.cpp.o] Error 1
========================== [ERROR] Took 4.61 seconds ==========================
Environment displates           [ERROR]
========================== [ERROR] Took 4.61 seconds ==========================
 
================================== [SUMMARY] ==================================
Environment livingroom          [SKIP]
Environment dht-dallas-sensors  [SKIP]
Environment switch-binarysensor [SKIP]
Environment fan-example         [SKIP]
Environment lights              [SKIP]
Environment livingroom8266      [SKIP]
Environment custombmp180        [SKIP]

If i replace the dimmable light with a binairy light, the code compiles without issues.

#include "esphomelib/application.h"

using namespace esphomelib;

void setup() {
  App.set_name("displates");
  App.init_log();

  App.init_wifi("xxxxxx", "xxxxxxxx");
  App.init_mqtt("192.168.1.xxx", "homeassistant", "xxxxxxxxxxx");
  auto *ota = App.init_ota();
  // Set a plaintext password, alternatively use an MD5 hash for maximum security (set_auth_password_hash)
  ota->set_auth_plaintext_password("knippen5");
  ota->start_safe_mode();

 App.make_binary_light("Displate 1"", App.make_gpio_output(13));
  
  App.setup();
}

void loop() {
  App.loop();
}

Platform config is:

[env:displates]
platform = espressif8266
board = nodemcuv2
framework = arduino
lib_deps = ${common.lib_deps}
build_flags = ${common.build_flags}
build_unflags = ${common.build_unflags}
src_filter = ${common.src_filter} +<examples/displates.cpp>

What could it be ?

Topics

The topic is derived from app.set_name("xyz"). Wouldn't it make sense to allow to set a prefix for the device topics?

I guess that I'm not the only one that groups sensors/actuators per location, e.g. home/living_room, to be able to subscribe to a room with wildcards.

Web server component causes WDT timeout when toggling switch

Toggling either switch via web server causes device to run into watchdog timer. Otherwise webserver runs fine. Debug logging is shown in web interface. Toggling switches via MQTT does not cause WDT issues, web interface does show switch state change.

I haven't debugged this yet. ~~~Might be caused by the automations?~~~ Currently I'm not depending on web server functionality so there is no need for me to get this resolved. If I find some time I might debug this. If you want me to test some things let me know, I be glad to help out.

Device: Sonoff Dual R2 esp8266

Configuration:

esphomeyaml:
  name: serre
  platform: espressif8266
  board: esp01_1m
  board_flash_mode: dout

wifi:
  ssid: 'robonet'
  password: '****'

mqtt:
  broker: 'mqtt'
  username: ''
  password: ''

logger:
  level: debug
debug:

ota:

web_server:
  port: 80

switch:
  - platform: gpio
    pin: 12
    name: op
    id: op
  - platform: gpio
    pin: 5
    name: neer
    id: neer

cover:
  - platform: template
    name: "Serre"
    open_action:
      - switch.turn_off:
          id: neer
      - switch.turn_on:
          id: op
    close_action:
      - switch.turn_off:
          id: op
      - switch.turn_on:
          id: neer
    stop_action:
      - switch.turn_off:
          id: op
      - switch.turn_off:
          id: neer
    optimistic: true

Debug log after reboot:

[10:12:42][I][mqtt.client:172]:     MQTT Connected!
[10:12:42][C][ota:024]: Setting up OTA...
[10:12:42][C][ota:025]:     port: 8266
[10:12:42][C][ota:030]:     hostname: 'serre'
[10:12:42][W][ota:106]: Last Boot was an unhandled reset, will proceed to safe mode in 5 restarts
[10:12:42][C][cover.mqtt:022]: Setting up MQTT cover 'S'...
[10:12:42][C][cover.mqtt:024]:     Optimistic: YES
[10:12:42][D][mqtt.client:094]: Subscribing to topic='serre/cover/s/command' qos=0...
[10:12:42][C][switch.mqtt:027]: Setting up MQTT switch 'op'
[10:12:42][C][switch.mqtt:028]:     Icon: ''
[10:12:42][D][mqtt.client:094]: Subscribing to topic='serre/switch/op/command' qos=0...
[10:12:42][D][binary_sensor.mqtt:066]: 'op': Sending state OFF
[10:12:42][C][switch.mqtt:027]: Setting up MQTT switch 'neer'
[10:12:42][C][switch.mqtt:028]:     Icon: ''
[10:12:42][D][mqtt.client:094]: Subscribing to topic='serre/switch/neer/command' qos=0...
[10:12:42][D][binary_sensor.mqtt:066]: 'neer': Sending state OFF
[10:12:42][D][debug:033]: esphomelib version 1.6.2
[10:12:42][D][debug:035]: Free Heap Size: 24112 bytes
[10:12:42][D][debug:052]: Flash Chip: Size=1024kB Speed=40MHz Mode=DOUT
[10:12:42][D][debug:130]: Chip ID: 0x00803D6D
[10:12:42][D][debug:131]: SDK Version: 2.2.1(cfd48f3)
[10:12:42][D][debug:132]: Core Version: 2_4_1
[10:12:42][D][debug:133]: Boot Version=6 Mode=1
[10:12:42][D][debug:134]: CPU Frequency: 80
[10:12:42][D][debug:135]: Flash Chip ID=0x00144051
[10:12:42][D][debug:136]: Reset Reason: Software Watchdog
[10:12:42][D][debug:137]: Reset Info: Fatal exception:4 flag:3 (SOFT_WDT) epc1:0x40201424 epc2:0x00000000 epc3:0x00000000 excvaddr:0x00000000 depc:0x00000000
[10:12:42][I][application:068]: Running through first loop()
[10:12:42][I][application:079]: First loop finished successfully!

lroundf is not a member of std

When trying to compile a nearly empty project that is using your library I get compile errors like:

.piolibdeps\esphomelib_ID2096\src\esphomelib\sensor\mqtt_sensor_component.cpp: In member function 'void esphomelib::sensor::MQTTSensorComponent::push_out_value(float, int8_t)':
.piolibdeps\esphomelib_ID2096\src\esphomelib\sensor\mqtt_sensor_component.cpp:63:25: error: 'lroundf' is not a member of 'std'
float value_rounded = std::lroundf(value * multiplier) / multiplier;

Any hints on how to solve this?

Beginners question

I just installed Platformio and use your RGB example. When building there is a warning about ESPmDNS - do I have to fix that?
I can also load the code to my board but Mosquitto Broker doen't show anything. Do I have to specify the host including port like this >app.init_mqtt("hassio.local:1883"<?
In the configuration I added >discovery: True< and >discovery_prefix: discovery<, is anything else needed?

SSD1306 display support

Hi,

Maybe it's a bit redundant and already on the roadmap, but I would really like to see an integration with SSD1306 based OLED displays. I would be interested to help to build this feature, but not sure if I'm experienced enough to write all the code for such a component.

What for me would be valuable is to have the ability to subscribe to a certain topic for let's say 'notification', or 'current scene' and whenever there is a new valuable published on the topic that is will be displayed on the OLED display.

What do you think about the first criteria the for the OLED display component? Or what do you guys think about a display component at all?

Kind regards,
Robbert

inverted led component

Hi,

not sure if I understand the 'inverted' property for the led output component correctly, but I think this:

https://github.com/OttoWinter/esphomelib/blob/95ff3365bbedf28cbe9be60201f16c3d383b700e/src/esphomelib/output/ledc_output_component.cpp#L21

should probably be
duty = max_duty - duty;

Also the in pin 34 in the example:
https://github.com/OttoWinter/esphomelib/blob/95ff3365bbedf28cbe9be60201f16c3d383b700e/examples/livingroom.cpp#L21

might be confusing as GPIO pins 34-39 are input only on esp32.

Can't connect to WiFi network

Hi. Been looking at this project for a while, and today I started to test it. Experiencing some issues.
I'm using the current library build from github, not the one published in PIO. Decided to start easy with the DHT module. But it keeps crashing. Anything I'm doing wrong, or is there something wrong in the code?

Thanks.

Using PIO with VS Code. Tested on both Wemos D1 and NodeMCU.

During build I get this warnings:

In file included from C:\Users\WaRFaiR\.platformio\packages\framework-arduinoespressif8266\cores\esp8266/Arduino.h:34:0,
from C:\Users\WaRFaiR\.platformio\lib\i2cdevlib\src\I2Cdev.h:52,
from C:\Users\WaRFaiR\.platformio\lib\i2cdevlib\src\BMP085.h:36,
from C:\Users\WaRFaiR\.platformio\lib\i2cdevlib\src\BMP085.cpp:33:
C:\Users\WaRFaiR\.platformio\lib\i2cdevlib\src\BMP085.cpp: In member function 'int32_t BMP085::getPressure()':
C:\Users\WaRFaiR\.platformio\packages\framework-arduinoespressif8266\tools\sdk\libc\xtensa-lx106-elf\include/math.h:57:34: warning: overflow in implicit constant conversion [-Woverflow]
#  define NAN (__builtin_nanf(""))
^
C:\Users\WaRFaiR\.platformio\lib\i2cdevlib\src\BMP085.cpp:253:23: note: in expansion of macro 'NAN'
if (up == 0) return NAN;


C:\Users\WaRFaiR\.platformio\lib\esphomelib\src\esphomelib\wifi_component.cpp: In member function 'virtual void esphomelib::WiFiComponent::setup()':
C:\Users\WaRFaiR\.platformio\lib\esphomelib\src\esphomelib\wifi_component.cpp:30:29: warning: 'void ESP8266WiFiGenericClass::onEvent(WiFiEventCb, WiFiEvent_t)' is deprecated (declared at C:\Users\WaRFaiR\.platformio\packages\framework-arduinoespressif8266\libraries\ESP8266WiFi\src/ESP8266WiFiGeneric.h:54) [-Wdeprecated-declarations]
WiFi.onEvent(on_wifi_event);

My program is here (main.cpp)

`#include "esphomelib/application.h"

using namespace esphomelib;

void setup() {
    App.set_name("testbuild");
    App.init_log();

    App.init_wifi("my.ssid", "mykey");
    App.init_mqtt("10.x.x.x", "xxx", "xxx");
    App.init_ota()->start_safe_mode();

    // This is required to set up the i2c bus. 14 is SDA pin and 27 is SCL pin.
    // You only need to call this once.
    // App.init_i2c(4, 5);

    // 0x48 is the default address when address pin is pulled low.
    // App.make_htu21d_sensor("HTU21D Temperature", "HTU21D Humidity");

    App.make_dht_sensor(12, "Livingroom Temperature", "Livingroom Humidity");

    App.setup();
}

void loop() {
    App.loop();
    delay(10); // this keeps the ESP32/ESP8266 from wasting power.
}

When looking at the serial output, it keeps crashing:

␛[0;32m[I][log_component:pre_setup:60]: Log initialized␛[0m
␛[0;35m[C][ota:start_safe_mode:142]: Safe mode enabled. There have been 0 suspected unsuccessful boot attempts.␛[0m
␛[0;32m[I][application:setup:25]: Application::setup()␛[0m
␛[0;35m[C][wifi:setup:29]: Setting up WiFi...␛[0m
␛[0;35m[C][wifi:setup:32]:     SSID: 'warfair.guest'␛[0m
␛[0;35m[C][wifi:setup:40]:     Hostname: 'testhbuild'␛[0m
␛[1;31m[E][wifi:wait_for_connection:138]:     Can't connect to WiFi network, restarting...␛[0m

 ets Jan  8 2013,rst cause:2, boot mode:(3,7)

load 0x4010f000, len 1384, room 16
tail 8
chksum 0x2d
csum 0x2d
v4ceabea9
~ld

API Reference unavailable

Hi Everyone,

I've just discovered this awesome project today but the API Reference on https://esphomelib.com/api/ doesn't seem to be working.

Here's an example of what I see on the Light Color Values section:

Warning doxygenclass: Cannot find class “esphomelib::light::LightColorValues” in doxygen xml output for project “esphomelib” from directory: ./_doxyxml/

MQTT Packet Size TCP Corruption

This library is pretty cool. I will look into support for WS2812 RGB for ESP32 later.

I tested the living room example and face corruption issues after setting the MQTT packet size to 1024.

2018-03-10 16:06:58 WARNING (MainThread) [homeassistant.components.mqtt] Can't decode payload b'{"name":"Livi\xfc\xec\xfc?[\x07 Light","platform":"mqtt_json","state_topic":"kyk385/light/livi_light/state","command_topic":"kyk385/light/livi_light/command","availability_topic":"kyk385/status","brightness":true,"rgb":true,"xy":true,"flash":true,"effect":true,"effect_list":["None","Random"]}' on discovery/light/kyk385/livi_light/config with encoding utf-8

I tried changing the example a bit but still faced issues : I had a nullptr reported for on of the mqtt_json_light components.

Any idea how I could get this to work correctly.

Custom sensor push new value error

First great work with the script and the documentation :)

I'm getting the following error when I try to compile:

src/main.cpp:37:24: error: no matching function for call to 'HDC1080_Sensor::push_new_value(int&)'_
src/main.cpp:41:10: error: 'int8_t HDC1080_Sensor::accuracy_decimals()' marked 'override', but does not override

#include <Arduino.h>
#include <Wire.h>
#include "ClosedCube_HDC1080.h"
#include "esphomelib/application.h"

using namespace esphomelib;

class HDC1080_Sensor : public sensor::PollingSensorComponent {
 public:
  ClosedCube_HDC1080 hdc1080;

  HDC1080_Sensor(uint32_t update_interval) : sensor::PollingSensorComponent(update_interval) {}

  void setup() override {
    hdc1080.begin(0x40);
  }

  void update() override {
    int temp = (hdc1080.readTemperature());
    push_new_value(temp);
  }

  std::string unit_of_measurement() override { return "°C"; }
  int8_t accuracy_decimals() override { return 2; } // 2 decimal places of accuracy.
};

void setup()
{
  App.set_name("livingroom");
  App.init_log();

  App.init_wifi("YOUR_SSID", "YOUR_PASSWORD");
  App.init_ota()->start_safe_mode();
  App.init_mqtt("MQTT_HOST", "USERNAME", "PASSWORD")

  auto *custom_sensor = App.register_component(new HDC1080_Sensor(5000));
  App.make_mqtt_sensor_for(custom_sensor, "HDC1080_Sensor");

  App.setup();

}

void loop()
{
  App.loop();
}

plataformio.ini

[env:m5stack-core-esp32]
platform = espressif32
board = m5stack-core-esp32
framework = arduino
lib_deps =
  esphomelib
  ClosedCube_HDC1080

Same happens for the example:
error: no matching function for call to 'BMP180Sensor::push_new_value(double)'�

Thanks

Read secrets from secrets.yaml

esphomelib requires some sensitive values to be written into config (e.g. wifi password, MQTT password), this means that the config files can't be committed to Git, and there's duplication between the homeassistant config

Is it possible for esphomelib to read secrets form the homeassistant secrets.yaml file, or to pull in secrets from env vars?

Controls internal to device

Sorry, I’m not sure how better to word that title, and I’m actually not sure if this is already supported.

I have a Sonoff Touch light switch flashed with esphomelib which is generally working great, however the current setup where pressing a button has to trigger an automation in Home Assistant to toggle the relay has me slightly concerned - if the Home Assistant infrastructure goes down then I’ll have no way to turn the lights on and off.

Ideally I’d like to be able to configure the device itself so that when I press the switch it internally toggles the relay, and then reports that to Home Assistant. More generally this is about devices having a failsafe in situations where network connectivity isn’t available, or if I move house and don’t want to rip out the light switches first.

Calling deprecated function in ESP8266WiFi

Have not had a chance to dig into see the problem and wanted to flag it to see if you already knew.

Compiling .pioenvs\nodemcuv2\lib641\esphomelib_ID2096\esphomelib\wifi_component.cpp.o
.piolibdeps\esphomelib_ID2096\src\esphomelib\wifi_component.cpp: In member function 'virtual void esphomelib::WiFiComponent::setup()':
.piolibdeps\esphomelib_ID2096\src\esphomelib\wifi_component.cpp:29:29: warning: 'void ESP8266WiFiGenericClass::onEvent(WiFiEventCb, WiFiEvent_t)' is deprecated (declared at XXXXXX\.platformio\packages\framework-arduinoespressif8266\libraries\ESP8266WiFi\src/ESP8266WiFiGeneric.h:54) [-Wdeprecated-declarations]
WiFi.onEvent(on_wifi_event);
^

[Feature Request] SNTP Support

Now that I start looking at using Lambda code for more things, I'm realizing it might be nice to have the local RTC set properly.

It appears that both ESP32 and ESP8266 have support for SNTP via the configTime() function:

As far as exposing this through esphomeyaml, it seems like there are only three things that can be configured:

  • GMT Offset (time zone)
  • DST offset (if DST is to be observed)
  • Server list (1-3 servers)

It would probably be reasonable to have GMT and DST offset default to zero, which effectively puts the RTC at UTC. Similarly, it could default to three pool servers (n.pool.ntp.org)

Second load fails

I got the first lr.yaml to load but now when I try to upload I get the following error:
A fatal error occurred: Failed to connect to ESP32: Invalid head of packet ('\x1b')

I am using a ESP32 WEMOSBAT board.

This looks very interesting!

Nice work!

ads1115: Bit-manipulations look wrong

There are a few no-ops, e.g.
https://github.com/OttoWinter/esphomelib/blob/1c9d6ba115a2699ed93f7ada37977d22e654a092/src/esphomelib/sensor/ads1115_component.cpp#L35-L36
https://github.com/OttoWinter/esphomelib/blob/1c9d6ba115a2699ed93f7ada37977d22e654a092/src/esphomelib/sensor/ads1115_component.cpp#L53-L55

(I assume that was supposed to be sth. like

  // Set comparator mode - hysteresis
  //        0bxxxxxxxxxxx0xxxx
  config &= 0b1111111111101111;

)

Also, https://github.com/OttoWinter/esphomelib/blob/1c9d6ba115a2699ed93f7ada37977d22e654a092/src/esphomelib/sensor/ads1115_component.cpp#L87-L88
does not mask bits 12..14, i.e. setting the multiplexer will lead to wrong results (e.g. if it was set to 100 before, and you try to set 001, it will actually be 101); I'd suggest

//          111111
//          5432109876543210
config &= 0b0000000111111111;

p.s. by fixing the latter problem, and #78, I was able to get ADS1115 working!

chip-0010525c/debug [D][sensor.ads1115:126]: 'supply-volt': Got Voltage=4.531500V
chip-0010525c/debug [D][sensor.mqtt:038]: 'supply-volt': Pushing out value 4.531500 with accuracy 3
chip-0010525c/sensor/supply-volt/state 4.532
chip-0010525c/debug [D][sensor.ads1115:126]: 'airqual5-volt': Got Voltage=0.165312V
chip-0010525c/debug [D][sensor.mqtt:038]: 'airqual5-volt': Pushing out value 0.165312 with accuracy 3
chip-0010525c/sensor/airqual5-volt/state 0.165

Compiling DHT for ESP8266 fails, because of OTA stuff

Relevant YAML-configuration, (besides the wizard-autogen-stuff):

ota:
  password: 'changeme'

sensor:
  - platform: dht
    pin: D4
    temperature:
      name: "Serverschrank Temperatur"
    humidity:
      name: "Serverschrank Luftfeuchtigkeit"
    update_interval: 15s

Relevant output of the run command:

Compiling .pioenvs/serverschrankklima/lib959/esphomelib/esphomelib/sensor/ads1115_component.cpp.o
Compiling .pioenvs/serverschrankklima/lib959/esphomelib/esphomelib/sensor/bmp085_component.cpp.o
Compiling .pioenvs/serverschrankklima/lib959/esphomelib/esphomelib/sensor/dallas_component.cpp.o
.piolibdeps/esphomelib/src/esphomelib/ota_component.cpp: In member function 'virtual void esphomelib::OTAComponent::setup()':
.piolibdeps/esphomelib/src/esphomelib/ota_component.cpp:40:18: error: 'class ArduinoOTAClass' has no member named 'setPasswordHash'
ArduinoOTA.setPasswordHash(this->password_.c_str());
^
*** [.pioenvs/serverschrankklima/lib959/esphomelib/esphomelib/ota_component.cpp.o] Error 1

Removing the OTA part of the config does not fix this issue.

Otherwise, great piece of work, i appreciate very much. Sometimes i'm just too lazy to code my own firmware ;)

'System Uptime' sensor filter

I am using a PIR Motion Sensor. According to the documentation, any inputs during the first minute of operation should be ignored:

Induction module needs a minute or so to initialize. During initializing time, it will output 0-3 times. One minute later it comes into standby.

I am not sure exactly what "a minute or so" means, but it would be nice to be able to put an uptime filter on sensors that suppressed readings until the system has been online for a specified period of time.

Crash when trying to discover Dallas componenets addresses

Running tag v1.6.2 on a D1 mini ESP8266MOD (nodemcuv2 board).

With the following code (generated by esphomelibyaml):

// Auto generated code by esphomeyaml
#include "esphomelib/application.h"

using namespace esphomelib;

void setup() {
  // ===== DO NOT EDIT ANYTHING BELOW THIS LINE =====
  // ========== AUTO GENERATED CODE BEGIN ===========
  App.set_name("animaux");
  auto *logcomponent = App.init_log();
  logcomponent->set_global_log_level(ESPHOMELIB_LOG_LEVEL_DEBUG);
  App.init_wifi("Wifi", "Password");
  auto *otacomponent = App.init_ota();
  otacomponent->set_auth_password_hash("Password");
  otacomponent->start_safe_mode();
  App.init_mqtt("192.168.1.1", 1883, "XXX", "XXX");
  App.make_dallas_component(0);
  // =========== AUTO GENERATED CODE END ============
  // ========= YOU CAN EDIT AFTER THIS LINE =========
  App.setup();
}

void loop() {
  App.loop();
  delay(16);
}

I get the following crash:


[18:19:34][C][sensor.dallas:042]: Setting up DallasComponent...
[18:19:34][C][sensor.dallas:043]:     Want device count: 0
[18:19:34]
[18:19:34]Exception (29):
[18:19:34]epc1=0x40203f8c epc2=0x00000000 epc3=0x00000000 excvaddr=0x00000004 depc=0x00000000
[18:19:34]
[18:19:34]ctx: cont 
[18:19:34]sp: 3fff1900 end: 3fff1bb0 offset: 01a0
[18:19:34]
[18:19:34]>>>stack>>>
[18:19:34]3fff1aa0:  3ffea598 3fff366c 40208144 3fff0b90  
[18:19:34]3fff1ab0:  0000002b 00000000 3ffe98cd 402081bc  
[18:19:34]3fff1ac0:  3fff1ae0 3fff36ac 3ffe98cd 402061ff  
[18:19:34]3fff1ad0:  00000000 3fff240c 3fff0a74 00000000  
[18:19:34]3fff1ae0:  00000000 00000000 3fff31b4 40204767  
[18:19:34]3fff1af0:  00000000 3fff240c 3fff31b4 3fff36b0  
[18:19:34]3fff1b00:  3ffea598 3fff36ac 3fff366c 40203bf4  
[18:19:34]3fff1b10:  28000045 00000300 00000000 3fff36b0  
[18:19:34]3fff1b20:  3ffea598 3fff36a4 3fff31b4 40203790  
[18:19:34]3fff1b30:  3fff36b0 3fff36ac 3fff0a48 40203569  
[18:19:34]3fff1b40:  3fff320c 00000005 3fff366c 402028ea  
[18:19:34]3fff1b50:  3fff366c 3fff1b80 3ffe8954 4021601a  
[18:19:34]3fff1b60:  00000000 00003a98 feefeffe 3fff0b7c  
[18:19:34]3fff1b70:  3fffdad0 3ffe8954 3fff0a48 40202166  
[18:19:34]3fff1b80:  3fff32a0 3fff3288 3fff3268 feefeffe  
[18:19:34]3fff1b90:  feefeffe 00000000 3fff0b74 40208188  
[18:19:34]3fff1ba0:  feefeffe feefeffe 3fff0b90 40100700  
[18:19:34]<<<stack<<<
[18:19:34]
[18:19:34] ets Jan  8 2013,rst cause:2, boot mode:(3,6)
[18:19:34]
[18:19:34]load 0x4010f000, len 1384, room 16 
[18:19:34]tail 8
[18:19:34]chksum 0x2d
[18:19:34]csum 0x2d
[18:19:34]v614f7c32
[18:19:34]~ld
[18:19:34][I][log_component:056]: Log initialized

When setting index:

[18:33:52][C][sensor.dallas:042]: Setting up DallasComponent...
[18:33:52][C][sensor.dallas:043]:     Want device count: 1
[18:33:52]
[18:33:52]Exception (29):
[18:33:52]epc1=0x40204250 epc2=0x00000000 epc3=0x00000000 excvaddr=0x00000004 depc=0x00000000
[18:33:52]
[18:33:52]ctx: cont 
[18:33:52]sp: 3fff1cc0 end: 3fff1f70 offset: 01a0
[18:33:52]
[18:33:52]>>>stack>>>
[18:33:52]3fff1e60:  3ffea94c 3fff3a2c 4020a44c 3fff0f50  
[18:33:52]3fff1e70:  0000002b 00000001 3ffe9991 4020a4c4  
[18:33:52]3fff1e80:  3fff1ea0 3fff3a6c 3ffe9991 40206eff  
[18:33:52]3fff1e90:  00000000 3fff27cc 3fff0e2c 00000000  
[18:33:52]3fff1ea0:  00000000 00000000 3fff3574 402051cb  
[18:33:52]3fff1eb0:  00000000 3fff27cc 3fff3574 3fff3a74  
[18:33:52]3fff1ec0:  3ffea94c 3fff3a6c 3fff3a2c 40203eb8  
[18:33:52]3fff1ed0:  00000003 01000608 00000000 3fff3a74  
[18:33:52]3fff1ee0:  3ffea94c 3fff3a64 3fff3574 40203a38  
[18:33:52]3fff1ef0:  3fff3a74 3fff3a6c 3fff0df8 40203815  
[18:33:52]3fff1f00:  3fff3dec 00000006 3fff3da4 40202b00  
[18:33:52]3fff1f10:  3fff3a2c 00000000 00000000 402199aa  
[18:33:52]3fff1f20:  3fffdad0 3fff3a2c 00000000 3fff0f40  
[18:33:52]3fff1f30:  3fffdad0 3fff3aac 3fff0df8 402023ba  
[18:33:52]3fff1f40:  3fff3a90 3fff3648 3fff3628 feefeffe  
[18:33:52]3fff1f50:  feefeffe 00000000 3fff0f38 4020a490  
[18:33:52]3fff1f60:  feefeffe feefeffe 3fff0f50 40100700  
[18:33:52]<<<stack<<<
[18:33:52]
[18:33:52] ets Jan  8 2013,rst cause:2, boot mode:(1,6)
[18:33:52]
[18:34:00]
[18:34:00] ets Jan  8 2013,rst cause:4, boot mode:(1,6)
[18:34:00]
[18:34:00]wdt reset

Light sensor support

Did I miss something or are no light sensors supported yet?
This would be a nice feature when using automatic lights.

[Feature request] Serial input/output

What an awesome project! Particularly keen on the IR side, but coupled with serial. Optoma projectors have all their serial codes published, so controlling a projector via HomeAssistant etc from an ESP would be awesome. TTL to RS232 support would be epic (even just sending commands via ESP's secondary TX would be good).

Question Deep Sleep integration ?

Does this lib integrate or plan to implement deep sleep features to optimize energy consumption ?
Or perhaps we can manage it aside by adding the deep sleep code in the block below ?

void loop() {
    app.loop();
}

Panic when Cover is changed

I have a switch that is toggled by a Cover. The ESP32 panics when the Cover is used:

[10:24:54][D][cover.mqtt:048]: 'Garage Door Opener': Stopping cover...
[10:24:54][D][binary_sensor.mqtt:066]: 'Garage Door Switch': Sending state ON
[10:24:55][D][binary_sensor.mqtt:066]: 'Garage Door Switch': Sending state OFF
[10:24:55]Guru Meditation Error: Core  1 panic'ed (LoadProhibited)
[10:24:55]. Exception was unhandled.
[10:24:55]Core 1 register dump:
[10:24:55]PC      : 0x4014c0d6  PS      : 0x00060130  A0      : 0x800d2e7e  A1      : 0x3ffd2450
[10:24:55]A2      : 0x3ffcdf64  A3      : 0x00000000  A4      : 0x00000050  A5      : 0x3ffd2430
[10:24:55]A6      : 0x08fffffd  A7      : 0x00000000  A8      : 0x8014c772  A9      : 0x3ffd2430
[10:24:55]A10     : 0xa5a5a5a5  A11     : 0x00000000  A12     : 0x00000005  A13     : 0x00000020
[10:24:55]A14     : 0x00000020  A15     : 0x3ffcdf04  SAR     : 0x0000001b  EXCCAUSE: 0x0000001c
[10:24:55]EXCVADDR: 0xa5a5a5a5  LBEG    : 0x4000c2e0  LEND    : 0x4000c2f6  LCOUNT  : 0xffffffff
[10:24:55]
[10:24:55]Backtrace: 0x4014c0d6:0x3ffd2450 0x400d2e7b:0x3ffd2470 0x4014c0da:0x3ffd2490 0x400d2e8b:0x3ffd24b0 0x400d5041:0x3ffd24d0 0x400d5131:0x3ffd24f0 0x400d2fb5:0x3ffd2510 0x400d2482:0x3ffd2530 0x400fc3a6:0x3ffd2550
[10:24:55]
[10:24:55]Rebooting...
[10:24:55]ets Jun  8 2016 00:22:57
[10:24:55]
[10:24:55]rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
[10:24:55]configsip: 0, SPIWP:0xee
[10:24:55]clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
[10:24:55]mode:DIO, clock div:2
[10:24:55]load:0x3fff0018,len:4
[10:24:55]load:0x3fff001c,len:812
[10:24:55]load:0x40078000,len:0
[10:24:55]load:0x40078000,len:11584
[10:24:55]entry 0x40078a60
[10:24:55][I][log_component:056]: Log initialized
[10:24:55][C][ota:163]: There have been 0 suspected unsuccessful boot attempts.
[10:24:55][I][application:044]: Application::setup()
[10:24:55][C][output.gpio:023]: Setting up GPIO Binary Output...
[10:24:55][C][esphal:053]:     GPIO Pin 17 with mode OUTPUT
[10:24:55][C][output.ledc:026]: Setting up ledc output...
[10:24:55][C][output.ledc:027]:     Pin: 2
[10:24:55][C][output.ledc:028]:     LEDC Channel: 1
[10:24:55][C][output.ledc:029]:     Frequency: 1000.0
[10:24:55][C][output.ledc:030]:     Bit Depth: 12
[10:24:55][C][light.state:179]: Setting up light 'Garage Status LED'...
[10:24:55][C][wifi:031]: Setting up WiFi...
[10:24:55][C][wifi:178]: Setting up STA...

I can directly toggle the switch until I'm blue in the face and it works fine, but using the cover will cause a crash every time. I've tried both with Optimistic, and with a Lambda that checks a reed sensor to determine position.

I can provide additional stack traces and the corresponding firmware.elf if that helps. If you can point me at a tool to parse the panic message I'd be glad to run that myself.

Panic MQTTSensorComponent

Hi, another problem with htu21d and i2c. I'm wanting to use this project for a lot of htu21d sensors, and I tried getting this to work. But it keeps looping with a panic/crash.

Thanks.

Using PIO with VS Code. Tested on both Wemos D1 and NodeMCU.

During build I get this warnings:

Compiling .pioenvs\nodemcuv2\liba12\i2cdevlib\LM73.cpp.o
In file included from C:\Users\WaRFaiR\.platformio\packages\framework-arduinoespressif8266\cores\esp8266/Arduino.h:34:0,
from C:\Users\WaRFaiR\.platformio\lib\i2cdevlib\src\I2Cdev.h:52,
ffrom C:\Users\WaRFaiR\.platformio\lib\i2cdevlib\src\BMP085.h:36,
from C:\Users\WaRFaiR\.platformio\lib\i2cdevlib\src\BMP085.cpp:33:
C:\Users\WaRFaiR\.platformio\lib\i2cdevlib\src\BMP085.cpp: In member function 'int32_t BMP085::getPressure()':
C:\Users\WaRFaiR\.platformio\packages\framework-arduinoespressif8266\tools\sdk\libc\xtensa-lx106-elf\include/math.h:57:34: warning: overflow in implicit constant conversion [-Woverflow]
#  define NAN (__builtin_nanf(""))
^
C:\Users\WaRFaiR\.platformio\lib\i2cdevlib\src\BMP085.cpp:253:23: note: in expansion of macro 'NAN'
if (up == 0) return NAN;

C:\Users\WaRFaiR\.platformio\lib\esphomelib\src\esphomelib\wifi_component.cpp: In member function 'virtual void esphomelib::WiFiComponent::setup()':
C:\Users\WaRFaiR\.platformio\lib\esphomelib\src\esphomelib\wifi_component.cpp:30:29: warning: 'void ESP8266WiFiGenericClass::onEvent(WiFiEventCb, WiFiEvent_t)' is deprecated (declared at C:\Users\WaRFaiR\.platformio\packages\framework-arduinoespressif8266\libraries\ESP8266WiFi\src/ESP8266WiFiGeneric.h:54) [-Wdeprecated-declarations]
WiFi.onEvent(on_wifi_event);

My program is here (main.cpp)

`#include "esphomelib/application.h"

using namespace esphomelib;

void setup() {
    App.set_name("testbuild");
    App.init_log();

    App.init_wifi("my.ssid", "mykey");
    App.init_mqtt("10.x.x.x", "xxx", "xxx");
    App.init_ota()->start_safe_mode();

    // This is required to set up the i2c bus. 14 is SDA pin and 27 is SCL pin.
    // You only need to call this once.
    App.init_i2c(4, 5);

    // 0x48 is the default address when address pin is pulled low.
    App.make_htu21d_sensor("HTU21D Temperature", "HTU21D Humidity");

    // App.make_dht_sensor(12, "Livingroom Temperature", "Livingroom Humidity");

    App.setup();
}

void loop() {
    App.loop();
    delay(10); // this keeps the ESP32/ESP8266 from wasting power.
}

When looking at the serial output, it keeps crashing with a panic:

␛[0;32m[I][log_component:pre_setup:60]: Log initialized␛[0m
␛[0;35m[C][ota:start_safe_mode:142]: Safe mode enabled. There have been 0 suspected unsuccessful boot attempts.␛[0m

Panic C:\Users\WaRFaiR\.platformio\lib\esphomelib\src\esphomelib\sensor\mqtt_sensor_component.cpp:19 esphomelib::sensor::MQTTSensorComponent::MQTTSensorComponent(std::string, esphomelib::sensor::Sensor*)

ctx: cont
sp: 3fff4010 end: 3fff42c0 offset: 01a0

>>>stack>>>
3fff41b0:  3fff44d4 00000c51 00000c51 3fff4290
3fff41c0:  3fffaca4 3ffe89dc 4020adf0 4020afdc
3fff41d0:  3fffb54c 00000008 3fffb574 4020eca4
3fff41e0:  00000000 00000000 3fffb574 4020b54b
3fff41f0:  00000000 00000000 00000000 401004d8
3fff4200:  3fff428c 3fff25c4 3fffb574 4020340b
3fff4210:  3fff428c 3fffb508 3fffb524 40203242
3fff4220:  3fff428c 3fff25c4 3fffb524 402034cf
3fff4230:  3fffb524 3fff25c4 3fffb1ac 402017c8
3fff4240:  3fff4b00 3ffeb4ec 3fff4c0c 3fff3298
3fff4250:  00000000 3fff428c 3ffe89dc 4021c5c2
3fff4260:  3fff4294 3ffeb4ec 3fff25c4 3fff3298
3fff4270:  3fffdad0 3ffeb4ec 3fff25c4 40202827
3fff4280:  3fffb188 3fff4b00 feefeffe 3fffb0c0
3fff4290:  3fffb508 feefeffe feefeffe feefeffe
3fff42a0:  feefeffe 00000000 3fff3290 4020ee38
3fff42b0:  feefeffe feefeffe 3fff32a0 40100700
<<<stack<<<

 ets Jan  8 2013,rst cause:2, boot mode:(3,6)

load 0x4010f000, len 1384, room 16
tail 8
chksum 0x2d
csum 0x2d
v4ceabea9
~ld

Subscribe gpio switch faild

Hi, I have a problem with the gpio switch. When I triggered switch OFF -> ON esp fail . Before it failled switch has change pin from LOW -> HIGH. Monochromatic light work correctly.

I don't know what it's wrong, can you help me?

lib version 1.3.0
board esp8266 (wemos D1 and nodemcu v2)

file.ccp

void setup() {
    App.set_name("xxx");
    App.init_log()->set_global_log_level(ESPHOMELIB_LOG_LEVEL_INFO);
    App.init_log(115200, 1024);
    App.init_wifi("xxx", "xxx");
    App.init_mqtt("xxx", "xx", "xxx");

    App.make_gpio_switch("K pump", D2);
    App.make_monochromatic_light("Led", new led_output(new GPIOOutputAnalogPin(D3)));
    App.setup();
}

void loop() {
    App.loop();
} 

platformio.ini


[env:d1_mini]
platform = espressif8266
board = d1_mini
framework = arduino
lib_deps = esphomelib
build_flags = -DESPHOMELIB_LOG_LEVEL=ESPHOMELIB_LOG_LEVEL_INFO

led_output.cpp


static const char *TAG = "led_output";

led_output::led_output(GPIOOutputAnalogPin *pin) {
    this->pin = pin;
    this->pin->setup();
}


unsigned long last = 0;

void led_output::write_state(float state) {
    unsigned long i = millis();
    auto stateLong = map(static_cast<long>(state * 255.0f), 0, 255, 0, 1024);
    if (last + 1000 < i) {
        last = i;
        ESP_LOGD(TAG, "write power long %d float %f", stateLong, state);
    }
    if (lastValue != stateLong) {
        lastValue = stateLong;
        pin->writeAnalog(stateLong);
    }
}

GPIOOutputAnalogPin::GPIOOutputAnalogPin(uint8_t pin, uint8_t mode, bool inverted) : GPIOPin(pin, mode, inverted) {

}

void GPIOOutputAnalogPin::writeAnalog(long value) {
    analogWrite(pin_, value);
}

exception

[0;32m[I][application:loop:73]: First loop finished successfully!�[0m

Panic /Users/petr/.platformio/packages/framework-arduinoespressif8266/cores/esp8266/core_esp8266_main.cpp:99 __yield

ctx: sys 
sp: 3ffffac0 end: 3fffffb0 offset: 01b0

>>>stack>>>
3ffffc70:  3fff5210 00000000 00000022 3ffe9e8c  
3ffffc80:  3ffea360 000000c4 3fff2df8 4020272d  
3ffffc90:  00000001 3fff452c 3ffffcf0 40207ad3  
3ffffca0:  00000000 00000000 00000001 40216582  
3ffffcb0:  00000000 3ffffd54 3fff4994 40207201  
3ffffcc0:  3fff4994 3fff4994 3ffffcf0 3fff5dec  
3ffffcd0:  3fff4994 00000001 3fff4864 402084b2  
3ffffce0:  7fffffff 00000001 3fff4864 4020903b  
3ffffcf0:  3fff5210 3fff44c8 00000000 40208dc7  
3ffffd00:  3fff4c34 00000001 3fff4c24 40203f6c  
3ffffd10:  3fff4bd8 3ffffd54 3fff495c 4020941c  
3ffffd20:  3ffeebf4 3ffffd50 3fff4994 40209172  
3ffffd30:  3ffffd58 3fff4c54 3fff4c7c 402091dc  
3ffffd40:  3fff5e14 3fff5de4 3fff5de4 4020781c  
3ffffd50:  3fff5158 3fff4bd8 0000000f 40202554  
3ffffd60:  3f000000 00000006 00000006 40207693  
3ffffd70:  3ffffed0 3fff3344 00000000 00000000  
3ffffd80:  3ffeebf4 3fff3354 00000000 4020cad4  
3ffffd90:  00000002 3ffec010 3ffef1c4 4020257c  
3ffffda0:  3fff4c54 0000000a 40207670 402077a8  
3ffffdb0:  3f000000 3fff5048 3fff373c 40233478  
3ffffdc0:  3fff3354 3fff477c 00000000 3ffed7e0  
3ffffdd0:  3fff27d0 00000328 00000328 00000000  
3ffffde0:  3ffffe50 00000002 3fff50fc 4020efc1  
3ffffdf0:  00000002 00000000 00000002 00000000  
3ffffe00:  3ffeebd2 00000024 3fff4598 4020dc0e  
3ffffe10:  00000002 00000000 00000002 00000000  
3ffffe20:  3ffeebd2 00000024 3fff4598 4020c8c9  
3ffffe30:  3fff4bdc 3ffffed0 4020bc94 4020ef30  
3ffffe40:  3fff4bcc 3ffffed0 4020bc4c 4020ef88  
3ffffe50:  00000022 01006b65 4010572e 00080100  
3ffffe60:  3fff4705 3fff50fc 7fffffff 00000001  
3ffffe70:  4021ab49 000008d0 3ffef1c4 3fff45ec  
3ffffe80:  00000001 3fff4c3c 3fff4598 4020c8fc  
3ffffe90:  3ffebaf0 3fff3394 3fff4598 4020e639  
3ffffea0:  3fff5044 00816277 4021f58e 3fff3394  
3ffffeb0:  3fff3194 3fff31a0 00000006 3fff2dbc  
3ffffec0:  3fff5044 3fff2dc4 3fff2dc0 4020e684  
3ffffed0:  3fff5044 3fff2dc4 3fff2dc0 40236eac  
3ffffee0:  00000024 6902a8c0 00000018 00000024  
3ffffef0:  00000000 00000018 3ffee568 40106b18  
3fffff00:  00000000 00000000 3ffee5b8 3fff3198  
3fffff10:  3ffeebaa 3fff31a0 3fff4c3c 4023413d  
3fffff20:  3fff2cc4 3fff373c 3fff373c 3ffec798  
3fffff30:  00000000 3fff4c3c 0000001c 3fff373c  
3fffff40:  3ffeeb9c 00000000 3fff4c3c 40233541  
3fffff50:  6402a8c0 00000082 00000000 0000000c  
3fffff60:  00000002 0000001a 40243077 3ffed0f0  
3fffff70:  3ffeeb74 3fffdcc0 3ffedd08 3ffedd08  
3fffff80:  40242fea 3fffdab0 00000000 3fff378c  
3fffff90:  3fffdc80 00000000 3fff4c3c 4022c56b  
3fffffa0:  40000f49 3fffdab0 3fffdab0 40000f49  
<<<stack<<<

 ets Jan  8 2013,rst cause:2, boot mode:(3,7)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.