How to get the currently set temperature?

The Netatmo API is a set of webservices allowing developers and third parties to access Netatmo device's data.
Post Reply
rs232
Posts: 11
Joined: 27 Jan 2019, 01:34

How to get the currently set temperature?

Post by rs232 »

As per title on the Netatmo thermostat I don't seem to be able to get what it's currently set on the thermostat.

Looking at the examples I can use this:

Code: Select all

	$currentProgram = getCurrentProgram($device["modules"][0]);
	list($initialMode, $initialTemp, $initialEndtime) = getCurrentMode($device["modules"][0]);

    //first print devices information
    foreach($thermData['devices'] as $dev)
    {
        printThermBasicInfo($dev);
    }
	
which outputs something like:

Code: Select all

Modules :
    - Thermostat -
    Last Measure date : 28 January 21:23
    Last Temperature measured: 19.3 °C
    Last Temperature setpoint: 19 °C
    Program List:
        -Only manual-
        id: xxxx
         This is the current program
        -To be deleted-
        id: yyy
So at this point the thermostat is set to 19 then I run this:

Code: Select all

$client->setToManualMode($device["_id"], $module_id, 18);
sleep(20);
but if I re-run the code as per above (to extract data) the "Last Temperature setpoint" still displays 19 °C which confuses me especially because the Netatmo mobile APP tells me 18 °C which is what I set via the script.

Am I looking at the wrong place/variable to get the currently set temperature?
rs232
Posts: 11
Joined: 27 Jan 2019, 01:34

Re: How to get the currently set temperature?

Post by rs232 »

Anybody please? I'm stuck at this point :-(
Céline
Posts: 58
Joined: 20 Nov 2017, 18:17

Re: How to get the currently set temperature?

Post by Céline »

Hi,

Could you detail what example/program you're using ?
It could be because you're using the deprecated endpoint getthermostatdata instead of homestatus

Céline
Céline - Netatmo Team :D
rs232
Posts: 11
Joined: 27 Jan 2019, 01:34

Re: How to get the currently set temperature?

Post by rs232 »

Thanks for the answer. The code you see above is taken one to one form the PHP-API
I'm using php on linux and have just copyied the examples from github.
https://github.com/Netatmo/Netatmo-API- ... xample.php

Aftersetting up the config.php All I did was to modify the line

Code: Select all

    try
    {
        $client->setToManualMode($device["_id"], $module_id, 19, time() + 10 * 60);
        printMessageWithBorder("Manual setpoint set");

    }
into

Code: Select all

    try
    {
        $client->setToManualMode($device["_id"], $module_id, $temperature);
        printMessageWithBorder("Manual setpoint set");

    }
where I added the $temperature variable instead of the fixed number + boost time fond in the example. but htis is not relevant to my question really.

The issue is querying the current temperature set on the thermostat

Regardless whether I use my code or the example in the API with no modification I don't see the Currently set temperature available anywhere.

Thanks
rs232
Posts: 11
Joined: 27 Jan 2019, 01:34

Re: How to get the currently set temperature?

Post by rs232 »

Anybody please?

All I need is to get the currently set temperature. If the PHP API provided don't use the correct class can they be updated?

Thanks
rs232
Posts: 11
Joined: 27 Jan 2019, 01:34

Re: How to get the currently set temperature?

Post by rs232 »

Céline wrote:Hi,

Could you detail what example/program you're using ?
It could be because you're using the deprecated endpoint getthermostatdata instead of homestatus

Céline

This if from the latest PHP-API (https://github.com/Netatmo/Netatmo-API- ... Client.php):

return $this->api('getthermostatsdata', 'GET', $params);

Perhaps a good idea to update them if you want users to refer to homestatus instead.

In general a good practice to keep API updated and remove obsolete reference.

Thanks
rs232
Posts: 11
Joined: 27 Jan 2019, 01:34

Re: How to get the currently set temperature?

Post by rs232 »

So if I now change in the NetTermAPIClient

This:

return $this->api('getthermostatsdata', 'GET', $params);


into this:

return $this->api('homestatus', 'GET', $params);


I get this error:

An error occured while retrieve thermostat data: Missing home_id


Is the home_id the same as the client_id?

Can I please get some help with this? Really nobody able to help?

Thanks :-/
racarter
Posts: 16
Joined: 05 Aug 2017, 22:50

Re: How to get the currently set temperature?

Post by racarter »

No, home_id is not the same as client_id. Also, the setpoint is per room, not per thermostat.

Use the ‘homesdata’ call first. The home_id can then be found in the json response:

[“body”][“homes”][0][“id”]

(the 0 assumes you only have 1 home).

Then use that ID in a ‘homestatus’ call to get the room setpoint:

[“body”][“home”][“rooms”][r][“therm_setpoint_temperature”] where r is the room index, starting at 0.
byronVib
Posts: 6
Joined: 30 Apr 2019, 18:54
Location: Norway
Contact:

How to get the currently set temperature

Post by byronVib »

Hi

Im wondering how I can get Open,Close, High and Low of each Renko candle in Renko charts from strategy API ?

Dal
Post Reply

Return to “Netatmo API”