-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Integer overflow for TuyaMCU timers (uint16 vs. int16) #18048
Comments
What are tuya timer used for? I'll try to have a look in Tuya docs to see if they say something |
In this device, it's to indicate how many seconds are left until the device shuts off (sleep mode timer).
Not for this device/one that I'm aware of. |
Also, FWIW, I ended up using a workaround here: the DPs for the timer are unbound, but still detected with a rule on a TuyaReceived event:
While this isn't quite the same as having them both output to the sensor topic, I found this route slightly easier for my intended usecase anyways (seems similar to SetOption4). |
I've not been able to find a confirmation in Tuya doc but that seems reasonnable to have a timer unsigned |
Fixed PR is merged. |
PROBLEM DESCRIPTION
A clear and concise description of what the problem is.
For TuyaMCU devices, Tasmota offers support for tracking of timer sensors (Timer1 through Timer4). These are mentioned as handling type 2 (integer) DP Ids.
However, there appears to be a signedness issue somewhere in the handling of these timers. As an example, this DP is returning a value of 36000 (
0x8ca0
), which corresponds correctly to the sensor value as an uint16 (10 hours, in seconds). However, Tasmota appears to be processing it as an int16, and reports the value as -29536 (same bit order, just incorrectly handling the sign bit).It's unclear if these timers are intended to be always-signed, or always-unsigned.
REQUESTED INFORMATION
Make sure your have performed every step and checked the applicable boxes before submitting your issue. Thank you!
Backlog Template; Module; GPIO 255
:Backlog Rule1; Rule2; Rule3
:Status 0
:TO REPRODUCE
Steps to reproduce the behavior:
EXPECTED BEHAVIOUR
A clear and concise description of what you expected to happen.
Proper processing of the integer in question.
SCREENSHOTS
If applicable, add screenshots to help explain your problem.
Log outputs are above.
ADDITIONAL CONTEXT
Add any other context about the problem here.
I think this is the first time someone's put Tasmota on one of these - they're not popular devices, but they should be similar to most-other Tuya devices. Note that the Tuya electric blanket docs (device type
dr
) do not appear to be accurate for this device.(Please, remember to close the issue when the problem has been addressed)
The text was updated successfully, but these errors were encountered: