hardillb / node-red-contrib-alexa-home-skill

A Node-RED node to control things via Amazon Alexa
https://alexa-node-red.bm.hardill.me.uk/
Apache License 2.0
89 stars 42 forks source link

Alexa responds with "Seems the <thermostatname> is not responding" when giving it a numeric value #133

Closed cibernox closed 1 year ago

cibernox commented 1 year ago

I've modelled a smart oven using this package as if it was a thermostat with on/off capabilities.

It works remarkably well provided you accept the limitation of not being able to set modes or alarms.

When I command alexa with "Alexa, turn on/off the oven" the node emits either true or false and all seems fine. When I say "Alexa, set the oven to 220°C" the node emits a number (so far so good) but alexa complains that "Seems that oven is not responding". This is true even if the node is not connected to anything.

I have checked the auto acknowledge box. Why does it work fir on/off but not for numbers?

hardillb commented 1 year ago

You can NOT use the auto acknowledge option for the Temperature traits, this is stated in the docs, see the super script notes in the "Building Flows" section and in the "Alexa Home Response"

https://alexa-node-red.bm.hardill.me.uk/docs

You will need to craft valid responses for all incoming commands.

cibernox commented 1 year ago

Thanks! I read that as commands to get the temperature not to set it. Do you happen to have an example of how that response would look like (perhaps of a local installation) or a link to some docs if not.

cibernox commented 1 year ago

@hardillb I've read the docs carefully and I'm not sure what I may be missing. I constructed the msg.extra object with the data stated in the documentation but I still get the same error from alexa. Screenshot 2022-10-20 at 23 09 57 I've also simplified my flow to the extreme to limit the number of variables Screenshot 2022-10-20 at 23 10 08

Do you see what's wrong with the msg object I send to the response node? (Note: I've also tried temperatureMode to AUTO)

hardillb commented 1 year ago

From the docs:

temperatureMode values can be AUTO, HEAT, COOL or CUSTOM. When Custom is used then you also need to include a friendlyName.

hardillb commented 1 year ago

And msg.payload should be changed to true

Again in the docs:

For TurnOnRequest/TurnOffRequest and SetPercentageRequest, IncrementPercentageRequest, DecrementPercentageRequest requests setting the msg.payload of the input message to true/false to signify success or failure.

For SetTargetTemperatureRequest, IncrementTargetTemperatureRequest, DecrementTargetTemperatureRequest, GetTemperatureReadingRequest, GetTargetTemperatureRequest, GetLockStateRequest request you must also include a msg.extra object.

cibernox commented 1 year ago

I had tried that too, with identical result: Screenshot 2022-10-20 at 23 30 36

hardillb commented 1 year ago

The following works (for temps between 10 and 30 degrees C


if (msg.payload < 10 || msg.payload > 30) {
    var range = {
        min: 10,
        max: 30
    }
    msg.payload = false;
    msg.extra = range;

} else {

    global.set("test-temp", msg.payload);

    msg.extra = {
        targetTemperature: {
            value: msg.payload
        },
        applianceResponseTimestamp: new Date().toISOString(),
        temperatureMode: {
            value: "AUTO"
        }
    }
    msg.payload = true;
}

return msg;
cibernox commented 1 year ago

FWIW, i solved the mystery. I had two nodes for the same appliance, one with autoacknowledge and one without it. And although one of them was not connected to any other node, that was one one triggering the bad response. My response payload was correct from the the beginning.