WebCore - Run external command

Hopefully a quick one. And if the answers no then so be it. If not, can someone point me in the direction?

Thanks in advance.

Here's the question:

I have a Tuya device, an air source heat pump (ASHP). It works fine in HE using the great work and the Tuya Cloud driver that @jonathanb has undertaken and shared with us all (nice work, thanks).

I can turn the ASHP on/off and change the Heating SetPoint. Great! So what's the issue. The ASHP has two modes. Heating and Cooling. Whilst I can change the mode from the Smart Life app, I cannot change the mode from the device nor can I change it from the Tuya cloud.

I have now managed to change the mode using Home Assistant and the Local Tuya integration. That has in turn led me to understand that I can change the mode using this:

So, here's the question.

Is there any way I can call this npm this from WebCore?

Like I said, thanks in advance!

There are a couple of ways that you can use webCoRE to interface with a device. The easiest method is using the commands and attributes defined in the device driver. The second is to use webCoRE to generate a HTTP POST or GET command to the device or its cloud API.

From your post above, I'd say that the device driver doesn't expose the command you'd like to use (Change Mode) - the best route IMHO would be to work with the driver developer to see if they can add the command. Outside of that, if you really worked at it you could possibly use webCoRE to generate the proper auth request/response, and then construct the API call change the mode using the code you mention above - I've done things like that in the past, and at best if it works it's a kludge.

2 Likes