Skip to content
This repository has been archived by the owner on Jan 27, 2023. It is now read-only.

switchcmd=sethkrtsoll&param=NaN #44

Open
tschuchort opened this issue Apr 9, 2021 · 0 comments
Open

switchcmd=sethkrtsoll&param=NaN #44

tschuchort opened this issue Apr 9, 2021 · 0 comments

Comments

@tschuchort
Copy link

tschuchort commented Apr 9, 2021

Hi, i am using
https://flows.nodered.org/node/node-red-contrib-fritzapi

fritz-thermostat:
if i set setTemperatur the uri looks like
{"uri":{"protocol":"http:","slashes":true,"auth":null,"host":"192.168.140.10","port":80,"hostname":"192.168.140.10","hash":null,"search":"?0=0&sid=c3843a9310cb5902&switchcmd=sethkrtsoll&param=NaN&ain=109710417528","query":"0=0&sid=c3843a9310cb5902&switchcmd=sethkrtsoll&param=..."

So the NaN for param in the uri is my problem.
msg.payload is a Number and msg.ain is set (ain works in the uri)
switchcmd=sethkrtsoll&param=NaN&ain=1097104

checked the script at temp2api but unable to find a error:

/*
 * Temperature conversion
 */
const MIN_TEMP = 8;
const MAX_TEMP = 28;

function temp2api(temp)
{
    var res;

    if (temp == 'on' || temp === true)
        res = 254;
    else if (temp == 'off' || temp === false)
        res = 253;
    else {
        // 0.5C accuracy
        res = Math.round((Math.min(Math.max(temp, MIN_TEMP), MAX_TEMP) - 8) * 2) + 16;
    }

    return res;
}

Any ideas? Answer in English or German is ok ;-)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant