Closed J4nsen closed 5 years ago
now my sensor names lead to an exception instead of just beeing ignored. removing the names, fixes the exception.
Traceback (most recent call last):
File "/Users/slebreton/Library/Python/2.7/bin/esphomeyaml", line 11, in <module>
sys.exit(main())
File "/Users/slebreton/Library/Python/2.7/lib/python/site-packages/esphomeyaml/__main__.py", line 508, in main
return run_esphomeyaml(sys.argv)
File "/Users/slebreton/Library/Python/2.7/lib/python/site-packages/esphomeyaml/__main__.py", line 498, in run_esphomeyaml
return POST_CONFIG_ACTIONS[args.command](args, config)
File "/Users/slebreton/Library/Python/2.7/lib/python/site-packages/esphomeyaml/__main__.py", line 304, in command_run
exit_code = write_cpp(config)
File "/Users/slebreton/Library/Python/2.7/lib/python/site-packages/esphomeyaml/__main__.py", line 141, in write_cpp
CORE.flush_tasks()
File "/Users/slebreton/Library/Python/2.7/lib/python/site-packages/esphomeyaml/core.py", line 395, in flush_tasks
next(task)
File "/Users/slebreton/Library/Python/2.7/lib/python/site-packages/esphomeyaml/core.py", line 375, in func_
for _ in func(*args):
File "/Users/slebreton/Library/Python/2.7/lib/python/site-packages/esphomeyaml/components/sensor/custom.py", line 29, in to_code
add(var.set_name(config[CONF_NAME]))
my custom sensor config:
sensor:
- platform: custom
lambda: |-
auto my_sensor = new MPU9250Sensor();
App.register_component(my_sensor);
return {
my_sensor->accelX_sensor, my_sensor->accelY_sensor, my_sensor->accelZ_sensor,
my_sensor->magX_sensor, my_sensor->magY_sensor, my_sensor->magZ_sensor
};
sensors:
- name: "accel X"
- name: "accel Y"
- name: "accel Z"
- name: "mag X"
- name: "mag Y"
- name: "mag Z"
Operating environment/Installation (Hass.io/Docker/pip/etc.):
pip installation on arch linux (v1.10.1)
ESP (ESP32/ESP8266/Board/Sonoff):
Wemos Lolin32
Affected component:
https://esphomelib.com/esphomeyaml/components/sensor/custom.html
Description of problem: Hi, I want to write a custom I2C Component to read out a MAG3110 sensor, which should count the rotations of a magnet inside my gas meter. I started with the custom sensor example, which somewhat works. I'm not able to give the sensor a name. The test value "42" gets published to 'iot_esp32_gaszaehler/sensor//state', but it should be published to 'iot_esp32_gaszaehler/sensor/my_custom_sensor/state' if I understand the documentation correctly. What am I doing wrong?
Problem-relevant YAML-configuration entries:
Traceback (if applicable):
Additional information: