Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inability to turn off fans exposed through matterbridge-hass #29

Open
smhc opened this issue Jan 13, 2025 · 5 comments
Open

Inability to turn off fans exposed through matterbridge-hass #29

smhc opened this issue Jan 13, 2025 · 5 comments
Assignees
Labels
question Further information is requested

Comments

@smhc
Copy link

smhc commented Jan 13, 2025

Describe the bug
Inability to turn off fan configured through Tasmota integration and exposed through matterbridge. Appears to be due to missing "auto" preset? Or maybe simply a missing translation key?

To Reproduce

  1. Configure a Tasmota instance using Sonoff i-fan03 module.
  2. Turn fan on and off successfully via HA
  3. Install matterbridge addon and restart to re-discover and expose fan to matter.
  4. Turn fan on through HA.
  5. Attempt to turn fan off through either matter or HA

Expected behavior
The fan should turn off.
Instead, the fan is turned off then immediately turned back on.

Plugin (please complete the following information):

Matterbridge (please complete the following information):

  • Mode docker container within HA
  • Version 1.7.4
  • OS: Windows, hyper-v, HA

Additional context

Error message in matterbridge:

error [23:08:11.379] [HomeAssistant] Error result received: [object Object]
fatal [23:08:11.379] [Matterbridge] Unhandled Rejection detected at: [object Promise] reason: Error [ERR_UNHANDLED_ERROR]: Unhandled error. ({ code: 'service_validation_error', message: 'Validation error: Preset mode auto is not valid, valid preset modes are: ', translation_key: 'not_valid_preset_mode', translation_placeholders: { preset_mode: 'auto', preset_modes: '' }, translation_domain: 'fan'}) at HomeAssistant.emit (node:events:513:17) at HomeAssistant.emit (file:///usr/local/lib/node_modules/matterbridge-hass/dist/homeAssistant.js:66:22) at ws.onmessage (file:///usr/local/lib/node_modules/matterbridge-hass/dist/homeAssistant.js:140:26) at callListener (/usr/local/lib/node_modules/matterbridge-hass/node_modules/ws/lib/event-target.js:290:14) at WebSocket.onMessage (/usr/local/lib/node_modules/matterbridge-hass/node_modules/ws/lib/event-target.js:209:9) at WebSocket.emit (node:events:536:35) at Receiver.receiverOnMessage (/usr/local/lib/node_modules/matterbridge-hass/node_modules/ws/lib/websocket.js:1220:20) at Receiver.emit (node:events:524:28) at Receiver.dataMessage (/usr/local/lib/node_modules/matterbridge-hass/node_modules/ws/lib/receiver.js:596:14) at /usr/local/lib/node_modules/matterbridge-hass/node_modules/ws/lib/receiver.js:530:12
fatal [23:08:11.379] [Matterbridge] Unhandled Rejection detected at: [object Promise] reason: [object Object]

@smhc
Copy link
Author

smhc commented Jan 14, 2025

FYI the state attributes of the fan in HA are as follows:

preset_modes: null
percentage: 0
percentage_step: 33.333333333333336
preset_mode: null
friendly_name: Lounge Fan
supported_features: 49

@Luligu Luligu self-assigned this Jan 20, 2025
@Luligu Luligu added the question Further information is requested label Jan 20, 2025
@Luligu
Copy link
Owner

Luligu commented Feb 7, 2025

Hi,
can you tell me if the issue is still present?

Cause the versions now are too old and I couldn't reproduce.

Sorry for the late answer.

@smhc
Copy link
Author

smhc commented Feb 7, 2025

I have a Tasmota device that exposes both a Fan and a Light (Sonoff i-fan03).
I had the device in the whitelist with the fan entity in the blacklist. After removing the fan entity from the blacklist I do not see the fan in matter anymore, despite matterbridge seemingly finding it and exposing it as an endpoint. It just shows the device with a single "light" control. So unfortunately I haven't been able to test as yet.

I am not sure if this is a regression or I whether need to remove and re-add the entire bridge device. I will eventually resort to that if it doesn't settle itself out.

@smhc
Copy link
Author

smhc commented Feb 7, 2025

I didn't get to the point of it appearing in matter/Google home, but matterbridge was causing the same issues regardless. I.e any attempt to change the fan speed would cause matterbridge to revert it back to low speed. So it wasn't possible to turn the fan off at all. I had to add it to the blacklist again to resolve the issue.

So in summary I believe the issue is still there. If I could write a helper in ha to wrap it that would be a good workaround, but I don't believe this is possible.

@genehand
Copy link

genehand commented Feb 9, 2025

I'm experiencing something similar with some but not all fans. In my case I'm pretty sure the issue is with fans that support different speeds but don't set the percentage to 0 when they're off.

info [08:32:21.533] [Vent-Fan] Received update event from Home Assistant device Vent-Fan entity fan.vent_fan from on with { preset_modes: [ ], percentage: 100, percentage_step: 2, preset_mode: '', friendly_name: 'Vent Fan', supported_features: 49 } to off with { preset_modes: [ ], percentage: 100, percentage_step: 2, preset_mode: '', friendly_name: 'Vent Fan', supported_features: 49 }
info [08:32:21.536] [Vent-Fan] Subscribed attribute FanControl:fanMode on endpoint MA-fan:19 changed from 5 to 0
info [08:32:21.536] [Vent-Fan] Set endpoint fanvent_fan:19 attribute FanControl.fanMode from 5 to 0
info [08:32:21.537] [Vent Fan] Set endpoint fanvent_fan:19 attribute FanControl.percentCurrent from 100 to 100
info [08:32:21.538] [Vent Fan] Set endpoint fanvent_fan:19 attribute FanControl.speedCurrent from 100 to 100

I turned the fan off, which then sets the percentCurrent to the same 100 value and turns the fan right back on:

info [08:32:21.650] [Vent-Fan] Received update event from Home Assistant device Vent-Fan entity fan.vent_fan from off with { preset_modes: [ ], percentage: 100, percentage_step: 2, preset_mode: '', friendly_name: 'Vent Fan', supported_features: 49 } to on with { preset_modes: [ ], percentage: 100, percentage_step: 2, preset_mode: '', friendly_name: 'Vent Fan', supported_features: 49 }
info [08:32:21.660] [Vent-Fan] Subscribed attribute FanControl:fanMode on endpoint MA-fan:19 changed from 0 to 5
info [08:32:21.663] [Vent-Fan] Set endpoint fanvent_fan:19 attribute FanControl.fanMode from 0 to 5
info [08:32:21.666] [Vent Fan] Set endpoint fanvent_fan:19 attribute FanControl.percentCurrent from 100 to 100
info [08:32:21.669] [Vent Fan] Set endpoint fanvent_fan:19 attribute FanControl.speedCurrent from 100 to 100

I've seen this happen for this custom ESPhome fan (that I could probably update), but also a Leviton fan switch. It seems ok with a Dyson that sets the percentage to 0. Here are the attributes for a couple, both when they're off.

Leviton:

preset_modes: null
percentage: 50
percentage_step: 25
preset_mode: null
friendly_name: Ceiling Fan
supported_features: 49

Dyson:

preset_modes: Auto, Normal
oscillating: false
percentage: 0
percentage_step: 10
preset_mode: Normal
friendly_name: Office fan
supported_features: 59

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants