Select.select_option on Tuya integration not working

Hi!

I’m experiencing a strange behavior that I don’t understand how to solve, I hope someone can help me.

I have a Tuya device, this device has a “select” type entity with these options:

options:
  - "1"
  - "2"
  - "3"
  - "4"
icon: mdi:thermometer-lines
friendly_name: Tristar Temperature level

Firing the select_option command does not change the state value, in fact, it does not produce any effect:

service: select.select_option
data:
  option: "2"
target:
  entity_id: select.tristar_temperature_level

In the “Controls” area of the device information page (Configuration), the entity with a drop-down box is visible, but if we select a value from this box, the status does not change or have any effect on the physical device.

Also, adding a card in the UI with the entity and choose a value from the drop-down box, it has no effect, that is, the state does not change or have any effect on the physical device.

It appears that it is not possible to change the state of this entity using Home Assistant, however…

On the developer tools status page, if we choose the entity and expand the “Define State” expansion box, where we can define the state for any entity, and if we change the state there, then the state changes, both in the entity and on the physical device (and this is exactly what I need).

Conclusion: it is possible to change the state and produce effects on the physical device, through the developer tools, but I need to change the value through the UI and/or through a service.

Any suggestion?
Can anyone understand what is going on and how I can solve/workaround it?
Thanks.

Is there any error-info written in the HOME ASSISTANT LOGBOOK when you execute a change in option?
The info printed in the ERROR-message should tell you more.

Hi @bouwew,
Thanks for taking the time to help

When using the UI or the service, there is no error whatsoever in the HOME ASSISTANT Logs and absolutely no entry in LOGBOOK, nothing happens…

If I use the “services” tab in the developer tools, the big “Call Service” button, turns green with a checkmark icon, meaning the service call endup successfully… but nothing changes or happens

When using the Developer Tools “change state” option, there is an entry in the LOGBOOK each time the status changes.

Any clue?

It sounds like the Tuya integration has no control over this parameter.

I’m surprised it changes on the physical device.

Changing an entity’s state, via Developer Tools > States, only changes what’s in Home Assistant’s state machine and is temporary. The moment the entity’s integration performs an update, or Home Assistant is restarted, the state machine’s value is overwritten by the physical device’s actual value.

I don’t have any select entities so I can’t perform a comparative test. However, if you have any select entities that are not based on the Tuya integration, I suggest you use one of them to test select.select_option. if it works then the fault isn’t due to the service call.

I agree with @123 , this seems like it may be a Tuya issue. However, I don’t have any Tuya devices to check against, so I cannot 100% confirm what you are seeing. I have just tested select entities from ZHA, ESPHome, Template, and VOIP integrations via Dashboard cards and by calling the select.select_option service in the Services tool, and all seem to be working normally on my instance.

if you use UI based widgets to change the entity state, you are right, UI widget changes its state temporarily but it is up to integration to update its inner state. So, calling via service actually should not change the UI widget but directly call underlying integration/library.

I suspect that, change on select entity on server side is not triggering an update on home assistant end. Reloading the integration would definitely get the latest state but should be overkill.

@netsoft-ruidias , I would change the title something else as this is specific to tuya, setting up your own select helper and changing its state is working fine.

When using the Developer Tools “change state” option, there is an entry in the LOGBOOK each time the status changes...

That’s expected; the value in the state machine is changed.

How did you create a select helper to confirm select.select_option is working fine?

With the Template integration? If you have its configuration handy, post it so that netsoft-ruidias can try it and confirm the problem isn’t the service call but the Tuya integration.

Devices → Helpers → Create Helper → Dropdown, you can create a select entity.

input_select is extending a select entity under the hood. but select entity is managed by each integration, so it is up to tuya integration to handle it properly.

https://github.com/home-assistant/core/blob/08b43c44770a7ad87fdc5b49a484452f1294b631/homeassistant/components/input_select/init.py#L248

You’re saying select.select_option works for an input_select entity?

Input_select is inherited from select entity.
Input_select.select_option is working and it is managed by core.
Select entity is managed by the creator integration, so if select.select_option is not working, it is an issue on the specific integration, no need to generalize such as select.select_option is not working.

I have different select entities in my setup generated by different integrations and select.select_option service is working fine for respected entities.

If you recall, your instructions were to create a select entity.

However, it seems you never actually created a select entity per your own instructions; you created an input_select helper which employs a different service call for setting an option.

Saying select and input_select are equivalent, because of an underlying inheritance structure, doesn’t allow the OP to directly test select.select_option for another select entity (to confirm, on their own system, that the same service call works for another integration).

Anyway, despite the instructions, I believe everyone agrees the problem is likely to be in the Tuya integration’s handling of select.select_option for (at least ) that particular entity (select.tristar_temperature_level).

Oh my, i should have remembered not to reply you at all. Totally waste of time, weird deductions out of nothing, not able to grasp what have been written, and as always derailing the discussion with nonsense stuff.

Thanks for reminding me to avoid you again

@netsoft-ruidias , select entities are managed by respective integrations, they need to be correctly setup by integration owners.

Given the bad history between tuya and home assistant, i do nor think this will be fixed, i suggest you to take a look at localtuya or any other solution.

I have some other select entities perfectly running locally, so it is not a home assistant core problem but definitely arising from tuya one.

Hey guys

Thank you everyone for the answers that helped me better understand how HA and select specifically work.

In fact, after some more tests, I found out that I was mistaken and not even on the developer tools status page it was working.

From your comments I realized that the problem was with the Tuya integration and not with the HA or anything I was doing wrong, for this reason, I changed the title of this post and will close the subject.

Once again, thank you all very much, you helped a lot.

Cheers,
Rui Dias

1 Like

Hello Rui. I bought the same Tristar heating device that you are trying to set up. The official Tuya entity is not working well, but I managed to make it work with the LocalTuya HACS integration, it is a bit tricky but it is possible to control the power intensity if the heater with home assistant.

Here is a guide to set up the integration.

LocalTuya GitHub

Then you must add the new entity and the most relevant values are:

1: On-Off
2: Target temperature
3: Current temperature
4: Standby
5: Heat level 1:750W, 2:1250W, 3:2000W, 4:OFF
9: Tubo fan
11: Timer (hours)
12:Timer(total minutes including hours).

Let me know if you need more help.

Hello @victorprietotome

Following your suggestion I was able to successfully add LocalTuya integration.

But I was not able to fully add all the entities, only these entities were successfully integrated:
1: OnOff (as switch)
5: Heat level (as select)

All others, especially the climate type, I was unable to add, no matter how many attempts I made.

However, the “select” type entity is working perfectly, and I can always use this in conjunction with the tuya integration, and now I have all the functionality working.
It’s not perfect, but it’s much better than it was before…

Thanks for your help