Closed aph3rson closed 1 year ago
What are tuya timer used for? Is there any use case where a negative time would make sense?
I'll try to have a look in Tuya docs to see if they say something
What are tuya timer used for?
In this device, it's to indicate how many seconds are left until the device shuts off (sleep mode timer).
Is there any use case where a negative time would make sense?
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:
Rule1
ON TuyaReceived#DpType2Id28 DO Publish2 stat/%topic%/TIMER1 %value% ENDON
ON TuyaReceived#DpType2Id29 DO Publish2 stat/%topic%/TIMER2 %value% ENDON
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 Added as point 3) in PR https://github.com/arendst/Tasmota/pull/18085
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)