ioBroker.esphome
ioBroker.esphome copied to clipboard
Fan component not working
!!! Before you start !!!
- [X] I have verified that there is not already an issue with the same problem
- [ not really sure] This is really a bug of current code, not an enhancement request (f.e. adding support for a new device type). There is a dedicated template for feature-requests.
Describe the bug
When using a fan component in ESPHome, the adapter just creates one readonly state in ioBroker instead of multiple states (e.g. speed, direction, ...). See the log below.
In the adapter code I see the following call:
case 'Fan':
await this.handleRegularState(`${host}`, entity, state, false);
break;
I don't know, if the call should be replaced by a call to async handleStateArrays(host, entity, state)
To Reproduce
Steps to reproduce the behavior:
- Create a new device with given yaml.
- compile and flash the device
- see the states in ioBroker
Minimal! Yaml config to reproduce.
Keep all that is required to copy-paste, compile, flash and reproduce the issue - but try to remove as much as possible that is not relevant to this issue!
Just an example, insert you own yaml!:
esphome:
name: test
friendly_name: Test
esp8266:
board: esp01_1m
# Enable logging
logger:
# Enable Home Assistant API
api:
encryption:
key: "verysecretapipassword"
ota:
password: "verysecretotapassword"
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
web_server:
port: 80
captive_portal:
output:
- platform: esp8266_pwm
id: motor_forward_pin
pin: GPIO12
# name: forward
- platform: esp8266_pwm
id: motor_reverse_pin
pin: GPIO13
# name: backward
fan:
- platform: hbridge
id: my_fan
name: "Living Room Fan"
pin_a: motor_forward_pin
pin_b: motor_reverse_pin
# enable_pin: motor_enable
decay_mode: slow # slow decay mode (coasting) or fast decay (braking).
Expected behavior
At least three states (state, direction, speed), which can control the fan, should be created in ioBroker
Logs (as screenshot and in text-form)
Create_state called for : 18FE34D64BD8.Fan.774144226.state with value : false
[entityStateData] {"key":774144226,"state":false,"oscillating":false,"speed":0,"direction":0,"speedLevel":54}
[entityStateConfig] {"config":{"objectId":"living_room_fan","key":774144226,"name":"Living Room Fan","uniqueId":"testfanliving_room_fan","supportsOscillation":false,"supportsSpeed":true,"supportsDirection":true,"supportedSpeedLevels":100,"disabledByDefault":false,"icon":"","entityCategory":0},"name":"Living Room Fan","type":"Fan","unit":""}
Versions:
- Adapter version: 0.5.0-beta.8
- ESPHome Dashboard version: 2024.3.1 (not sure, if this is really the version number)
- JS-Controller version: 5.0.19
- Node version: 18.19.1
- Operating system: Debian Docker Image running on PhotonOS
- Installation Method: Docker.