make-all / tuya-local

Local support for Tuya devices in Home Assistant
MIT License
1.19k stars 485 forks source link

Identical devices get detected as different types #1959

Closed novanarwhal closed 2 months ago

novanarwhal commented 3 months ago

Describe the bug I am adding 8 fans (detected as Skyfan DC fans). Two of the devices are being detected as a light. To Reproduce Adding the fan using the cloud assisted configuration

Expected behavior All fans to be added as Skyfan DC fans.

Additional context Attached diagnostics from correct and incorrectly detected fans.

Is there any way to manually edit devices using the configuration from a correct fan into the incorrect fan?

Screenshot 2024-05-28 113822 tuya_local-2bc2c9e9f69fb1fd99fcdee686405e8b-Guest fan-6c5aad47d776fb3b90314cb93661ebd9.json tuya_local-5e2146fc35846b11c844e35c96a514f9-RGBCW light rumpus-8c9d7023e1eb944b874a5314c7f8890e.json Screenshot 2024-05-28 115131

make-all commented 3 months ago

Changing the device type after installation changes the entities which are present, messing up the entity registry. So the only supported way to do it is to remove and re-add the device.

make-all commented 3 months ago

You should have been offered the fan config when you installed the devices. It seems you just clicked through with the default option selected without checking it first.

novanarwhal commented 3 months ago

You should have been offered the fan config when you installed the devices. It seems you just clicked through with the default option selected without checking it first. Screenshot 2024-05-28 115131

This is the option list provided when trying to setup the problem fans. No fan option available.

make-all commented 3 months ago

Sorry, I read these configs the wrong way around, thinking that the misdetected one had an extra dp, when it was actually a missing dp for the preset.

novanarwhal commented 3 months ago

You should have been offered the fan config when you installed the devices. It seems you just clicked through with the default option selected without checking it first. Screenshot 2024-05-28 115131

This is the option list provided when trying to setup the problem fans. No fan option available.

For reference this is one that detects properly. Screenshot 2024-05-28 115519

novanarwhal commented 3 months ago

Thanks for looking in at this. Anyway to temporarily address this or edit it before a fix flows through?

make-all commented 3 months ago

Add optional: true to the preset_mode dp config.

novanarwhal commented 3 months ago

Add optional: true to the preset_mode dp config.

I do apologise - you have blown right past my level of knowledge here. Can you tell me where I go to add this or point to a guide?

make-all commented 3 months ago

Find the file skyfan_dc_fan.yaml. In that file, search for preset_mode. On the line after that, add a new line with same indentation that says optional: true

novanarwhal commented 3 months ago

Screenshot 2024-05-28 171343

Unfortunately this change does not enable me to chose the fan option at the setup stage.

novanarwhal commented 3 months ago

I have managed to get it work. I added the optional line to a different dps section and it started getting detected. Screenshot 2024-05-28 173026

Thank you for your help.

make-all commented 3 months ago

Strange. The device must randomly fail to report either speed or preset (maybe depending on which was last used).

novanarwhal commented 3 months ago

If there is anything I can do to assist with identifying a cause of outcome, let me know.

On Tue, May 28, 2024, 9:24 PM Jason Rumney @.***> wrote:

Strange. The device must randomly fail to report either speed or preset (maybe depending on which was last used).

— Reply to this email directly, view it on GitHub https://github.com/make-all/tuya-local/issues/1959#issuecomment-2134975955, or unsubscribe https://github.com/notifications/unsubscribe-auth/BIXBT7RHZN3P6KFHQWPTJ3DZERSOFAVCNFSM6AAAAABIL7AB32VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMZUHE3TKOJVGU . You are receiving this because you authored the thread.Message ID: @.***>

novanarwhal commented 3 months ago

Strange. The device must randomly fail to report either speed or preset (maybe depending on which was last used).

I played a bit more. It would seem that it entirely depends on when it was last used. I removed the optional: true line from the yaml and then turned a fan on (via remote, not isolator), set a speed and a timer that previously didnt work with tuya-local and all of a sudden it started getting detected correctly.

So the best solution to this problem is ensure that the device has been activated and certain functions used.