Provide Valve_Status from the Tuya SDK for Thermostatic Valves

I have a typical UK type Central Heating System with an Oil fired Boiler and Radiators in each room. I have recently purchased Tuya Thermostatic Radiator Valve Heads which I am currently controlling via the Smart Life App.

At present I am using a dumb Room Thermostat/ Programmer to control switching on and off the boiler but I would like to automate this using the combined status of the 7 valve heads and the use of a smart switch which I have also purchased.

I need to know for each radiator whether the valve is open or closed. This could be either by testing that the Current room temperature is higher than the Set Temperature or by obtaining the Valve Status and checking that it is closed.

The Smart Life app shows, Selected Temperature, Current Temperature and Percentage Valve Opening (Valve Status). Apilio appears to only give me the first two of these, in addition to Child Lock and Mode of which I have no interest at present.

Incidentally when shown on the Dashboard/Devices , these temperatures are inflated by a factor of 10 from their actual values but I understand that this is already being addressed as an issue.

In order to achieve my goal I either need to be able to access the Percentage Valve Opening or to be able to calculate the difference between the Selected Temperature and Current temperature of each valve and when all these equate to zero to operate a smart switch to turn the boiler off and when it does not equate to zero and the boiler is turned off, to turn it on again.

I initially broached this problem in the forum and reponses from @pebneter and @Drivingforce indicated that the Valve _Status was not a value provided in the SDK.

I had a frustrating conversation with Tuya support which was fruitless but in subsequent rearch I found this page which defines the Standard Status Set for Thermostats Standard Status Set and I believe that it does show that the value that I want is indeed in the Standard Status Set for Thermostats

and this is the value that I want.

Iā€™m hoping that you are able to provide this value as it will be a lot easier than comparing the Current and Set Temperatures which as I understand is a feature that Apilio cannot provide at present.

Iā€™m satisfied that this ā€œsimpleā€ provision will enable me to use Apilio for this automation project. Iā€™ve created Tap-to-Run functions (for lack of a better word) in Smart Life to turn the Boiler on and off . I have also written a simple Logic Block here in Apilio using comparisons of Set Temperature to literal values in order to test by logic and the functionality and as I move the Set temperature either side of my literal my boiler (actually an led light connected to the smart switch) turns on and off.

Looking forward to your response

3 Likes

Hi @doncevans ,

thanks for providing your findings in such a detailed manner - very helpful!
I compared the product specifications of one of your products, and it was indeed one of the ā€œThermostatā€ / wk category. But the information you are looking for is not in the specification provided for this particular product by the API.
I did only a quick check and will consult with our Tuya expert to confirm!!

So why is it not there, if it is covered by the standard status set? It is most probably because they are not mandatory:


Source: https://developer.tuya.com/en/docs/iot/standarddescription?id=K9i5ql6waswzq

The app might have more information available than the Cloud API covers because according to our understanding, there is another non-public API (or some sorts of status catalog) that can be used by their own app, but by 3rd party service providers.

1 Like

Hi @pebneter ,

Iā€™d like to send you a copy of the e-mail conversations I had with Tuya.

Iā€™m pretty sure that they are saying to me that if the device provides this status then it is available to you but you appear to be saying that they donā€™t provide this status.

I can see from using the Smart Life App that the valve itself IS providing the status.

It seems fundamental to me to provide this value as the whole process of automation goes out of the window for a system using thermostatic valves if you canā€™t shut off the heat source when none of the radiators are calling for heat.

Please can you advise the best way for me to forward this e-mail conversation to you

Thanks

1 Like

Yes, totally agree this is counter-intuitive behaviour from Tuya.

I hope you received the e-mail I sent you @pebneter .

I believe I have found a workaround for now which will enable me to use Apilio as the core of my automation now and in the future.

In my initial statement I said that the value of the Child Lock status was of no concern to me. I have found that in a Smart Life Automation that I can test the value of Valve Status for being either 0 or greater than zero and setting the Child Lock on the valve or releasing it. A Condition in Apilio Web App then tests the Child Lock status for all valves on a simple AND condition, the positive action for which, is to turn the boiler off and the negative is to turn the boiler on.

I have tested this using a lamp connected to my smart switch and it appears to work smoothly.

I still hope that in the future that you are able to provide the other values available from the thermostatic valve but for now I thank you for your help.

Hey @doncevans ,
yes I got your message and will respond soon. In short: the more detailed analysis confirmed the suspected root cause, so unfortunately not much we can do to improve your experience right now :frowning:

Thanks for sharing your creative workaround! :man_mechanic:

This is an old thread, but with smart TRVs now being available from AliExpress for less than Ā£15 each, I decided to order some and try them out. I then came across this thread again when I started to implement controlling them using Apilio. You really do need access to the valve status in order to control things properly, and although this was initially quite frustrating (as the OP describes), I eventually managed to solve this for the valves I purchased.

I donā€™t know whether all such valves expose the same commands, but the situation for the ones I purchased is described below.

For my valves, looking within Smart Life shows a ā€œState of the valveā€ condition that is either ā€œOpenā€ or ā€œClosedā€. Apilio, although picking up all other settings, does not include this one, but it is very easy to detect this trigger within Smart Life. I use this to change the state of a Tuya smart plug, the status of which I can then use to trigger further routines in Apilio. This can be a physical device, but rather than waste an actual plug I have created a virtual device within Tuya for this. When ALL valves are ā€œOpenā€, switch the smart plug off, when ANY of the valves are ā€œClosedā€ switch the smart plug on. (Yes, I would have expected ā€œOpenā€ and ā€œClosedā€ to work the opposite way, but they seem not to.) The Smart Life implementation of this for just 2 TRVs is shown below. You just need two automation scenes within Smart Life to do this, irrespective of how many TRVs you have.


If this works for you, then that is great, but with my TRVs there was one extra step to take as the implementation described did not work at first. I had to log in the Tuya development site and update the settings for my smart TRVs so that the ā€œState of the valveā€ was functional. To do this you have to log in to their development site (in Europe it is https://eu.iot.tuya.com/cloud/), register yourself and pick up your devices, then look at the settings for your smart TRV. Under ā€˜device debuggingā€™, I needed to select one of the TRVs, where there was a link to go to ā€˜Product Detailsā€™, and there change the device to the ā€œDP instruction modeā€. What this apparently does is to allow access to the device-specific commands, rather than the standard commands, which in this case included access to the ā€œState of the valveā€ setting. Changing this one time seems to enable this for all TRVs of the same make. Really dumb that this doesnā€™t seem to work by default, but once updated then everything is fine.

For an outlay of just Ā£15 per TRV, these ZigBee valves work amazingly well and after buying just two of them to test, I have a large batch on order so that I can put them on all radiators in my house. For reference, the type I have used are shown below.

image

2 Likes

Thanks for writing this up!
Unfortunately, the functionality the products expose to Apilio is a bit hit-or-miss, but glad you found a way to use them.
Itā€™s indeed a cost effective interesting option. My own smart heating from Tado is a lot more expensive (somewhere in the range of 80$).

1 Like

The expense difference is certainly significant, but the Tuya devices (despite being very inexpensive in comparison) also provide far more information and facility for control. Of course, you have to like writing the control logic yourself, but nobody who is likely to read this would be put of by that, and might even see it as an advantage :slight_smile:

Being able to set the temperature targets and timing for each individual TRV, and to read the current temperature and battery status, means that it is possible to create a much more sophisticated and bespoke setup than any of the commercial systems. Of course, you need to be able to read and act on information from the TRVs, with Apilio being the only system I know of that will let you do thatā€¦

2 Likes