Tuya sensor not display RAW values
The problem
I attempt to fetch a RAW type data from Tuya https://developer.tuya.com/en/docs/iot/f?id=K9gf468bl11rj
After local debug I can see that the data is found but the value from native_value returns None and therefor no data is set in the UI.
# Get subkey value from Json string.
if self._type is DPType.JSON:
if self.entity_description.subkey is None:
return None
values = ElectricityTypeData.from_json(value)
return getattr(values, self.entity_description.subkey)
if self._type is DPType.RAW:
if self.entity_description.subkey is None:
return None <---- enter here
If I set the subkey it will use the ElectricityTypeData which does not match my object (Example: "fwQAAgF/BgABAX8JAAEBfw8AAQF/FQACAX8XAAEBKBIAAQA=").
If I return value of no subkey is set does work and present the data I want. However it would be even better if a custom object similar to ElectricityTypeData could be added for decoding the data.
if self.entity_description.subkey is None:
return None
Is there any approach to allow other types than ElectricityTypeData and not be dependent on a subkey to return a value and instead take the raw value directly?
What version of Home Assistant Core has the issue?
core-2025.5.1
What was the last working version of Home Assistant Core?
No response
What type of installation are you running?
Home Assistant OS
Integration causing the issue
Tuya
Link to integration documentation on our website
https://www.home-assistant.io/integrations/tuya/
Diagnostics information
tuya-01JV20MK8Z7RV0X33XX0FKBS0C-Cleverio PF100-3a8c716df6bc945784168c65b779be16 (3).json
Example YAML snippet
Anything in the logs that might be useful for us?
Logs return:
{'meal_plan': 'fwQAAgF/BgABAH8JAAIBfwwAAQB/DwACAX8VAAIBfxcAAQAIEgABAQ==', 'manual_feed': 1, 'factory_reset': False, 'battery_percentage': 90, 'charge_state': False, 'feed_report': 2, 'light': True} (updated properties: ['meal_plan'])
Additional information
No response
Hey there @tuya, @zlinoliver, mind taking a look at this issue as it has been labeled with an integration (tuya) you are listed as a code owner for? Thanks!
Code owner commands
Code owners of tuya can trigger bot actions by commenting:
@home-assistant closeCloses the issue.@home-assistant rename Awesome new titleRenames the issue.@home-assistant reopenReopen the issue.@home-assistant unassign tuyaRemoves the current integration label and assignees on the issue, add the integration domain after the command.@home-assistant add-label needs-more-informationAdd a label (needs-more-information, problem in dependency, problem in custom component) to the issue.@home-assistant remove-label needs-more-informationRemove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.
(message by CodeOwnersMention)
tuya documentation tuya source (message by IssueLinks)
Any suggestion for appropriate method to solve it is appreciated then I can add a pull request with a solution.
There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.