Page 7 of 14

Re: NEST Account migration

Posted: Monday 24 February 2020 19:02
by Ptje
Hello,

When I start it manual, I get

pi@raspberrypi:/ $ /home/pi/nest-api/get_nest.sh
/home/pi/nest-api/get_nest.sh: line 28: php: command not found

What does that mean ?

Re: NEST Account migration

Posted: Monday 24 February 2020 19:19
by heggink
rolandbreedveld wrote:
heggink wrote: Sunday 23 February 2020 20:52 My cookie expired a couple of days ago. I now check so I can get the new cookie as soon as it expires. Took a few weeks...

Sent from phone.
I started it on 16-jan and never had to change the cookie, perhaps if the system is not running for a while, the cookie and or token will become invalid.
Weird. My system is in 24/7 but it still logged me out 5 days ago...

Sent from phone.


Re: NEST Account migration

Posted: Monday 24 February 2020 20:18
by rolandbreedveld
Ptje wrote: Monday 24 February 2020 18:41 Hello Roland,

What do you mean with terminate ? Do I have to remove the ' ?

Greetings
Peter
de cookienis between ‘’ and de line ends with a ;

Re: NEST Account migration

Posted: Monday 24 February 2020 21:30
by Ptje
Hello Roland,

Thats the way I did it.

I edit the crontab and nothing updates in Domoticz. I get an error when I start it by hand.

pi@raspberrypi:/ $ /home/pi/nest-api/get_nest.sh
/home/pi/nest-api/get_nest.sh: line 28: php: command not found

Greetings,
Peter

Re: NEST Account migration

Posted: Tuesday 25 February 2020 7:52
by rolandbreedveld
Ptje wrote: Monday 24 February 2020 21:30 Hello Roland,

Thats the way I did it.

I edit the crontab and nothing updates in Domoticz. I get an error when I start it by hand.

pi@raspberrypi:/ $ /home/pi/nest-api/get_nest.sh
/home/pi/nest-api/get_nest.sh: line 28: php: command not found

Greetings,
Peter
oh, i see, you don’t have php installed, also php-curl, perhaps some other library’s, it will tell you if your missing some. (apt-get install php php-curl)

Re: NEST Account migration

Posted: Tuesday 25 February 2020 9:50
by Ptje
Hello Roland,

We are getting there. I installed php and php curl now. I think something was missing. I have no errors anymore. Now I see,

pi@raspberrypi:~ $ /home/pi/nest-api/get_nest.sh
Update TEMP to 19.3
Update HUMIDITY to 48.0
Update TEMPHUM to 19.3;48.0;0
Update SETPOINT to 19.9

I suggest my token and cookie is right now. Only in Domoticz nothing is getting updated. I have edited nest_devices.cfg

Device idx
============
SETPOINT 285
TEMP 286
HUMIDITY 490
AWAYMODE 288
ECOMODE 287
HEAT 289
TEMPHUM 511
DOMOTICZ 127.0.0.1:9090

Only HUMIDITY and TEMPHUM not. I don't use that.

When I execute the script, I see no reaction in Domoticz log. You have any idea ?

Greetings,
Peter

Re: NEST Account migration

Posted: Tuesday 25 February 2020 10:09
by rolandbreedveld
Ptje wrote: Tuesday 25 February 2020 9:50 Hello Roland,

We are getting there. I installed php and php curl now. I think something was missing. I have no errors anymore. Now I see,

pi@raspberrypi:~ $ /home/pi/nest-api/get_nest.sh
Update TEMP to 19.3
Update HUMIDITY to 48.0
Update TEMPHUM to 19.3;48.0;0
Update SETPOINT to 19.9

I suggest my token and cookie is right now. Only in Domoticz nothing is getting updated. I have edited nest_devices.cfg

Device idx
============
SETPOINT 285
TEMP 286
HUMIDITY 490
AWAYMODE 288
ECOMODE 287
HEAT 289
TEMPHUM 511
DOMOTICZ 127.0.0.1:9090

Only HUMIDITY and TEMPHUM not. I don't use that.

When I execute the script, I see no reaction in Domoticz log. You have any idea ?

Greetings,
Peter
congrats, if you get info, your token and cookie are ok
what if you run:
php nest-api.php
note: if domotics is running on a different user than you do this command, you have to remove the cache files
Domoticz is normally on port 8080
and check if Domoticz is listening on local host (settings -> local networks) in my case 127.0.0.1;192.168.3.*

Re: NEST Account migration

Posted: Tuesday 25 February 2020 10:19
by Ptje
Hello Roland,

pi@raspberrypi:~/nest-api $ php nest-api.php
Could not open input file: nest-api.php
pi@raspberrypi:~/nest-api $ sudo php nest-api.php
Could not open input file: nest-api.php

Greetings,
Peter

Re: NEST Account migration

Posted: Tuesday 25 February 2020 10:31
by Ptje
Hello Roland,

Hoooooo Stop. !! It's working !!!! I had not secured the switches in Domoticz, so I never thought that the user and pass was the problem. I changed the settings at Local network to 127.0.0.1 and it is working.

Thank you very much for your patience. I am happy that my nest is working again with my domoticz.

Greetings,
Peter

Re: NEST Account migration

Posted: Tuesday 25 February 2020 10:55
by Ptje
Hello Roland,

I see 2 things that are strange.

When I set in Domoticz the Switch "Away" on, the thermostaat itself goes to "Eco" And when I Switch "Eco" on, it also switches the thermostaat aan "Eco"

And when I update the setting point in Domoticz and I execute the script, it changes the settings back in Domoticz to the old setting point. When I change de set point on the Nest self and I execute the script, it updates Domoticz well.

Is this a wrong setting ?

Greetings,
Peter

Re: NEST Account migration

Posted: Tuesday 25 February 2020 12:02
by rolandbreedveld
Ptje wrote: Tuesday 25 February 2020 10:55 Hello Roland,

I see 2 things that are strange.

When I set in Domoticz the Switch "Away" on, the thermostaat itself goes to "Eco" And when I Switch "Eco" on, it also switches the thermostaat aan "Eco"
Yes I see this, it was in the original code from Guillaume Boudreau, seeline 745 of net.class.php:
public function setAway($away_mode, $serial_number = NULL, $eco_when_away = TRUE) {
It was build in to set ECO if you are away, while we want to do this by Domoticz events , I'll change it to FALSE in the new version
And when I update the setting point in Domoticz and I execute the script, it changes the settings back in Domoticz to the old setting point. When I change de set point on the Nest self and I execute the script, it updates Domoticz well.
Is this a wrong setting ?
I think this won't happen if you wait a few seconds, take the iphone (or Android) Nest app next to you, I the trigger for setpoint runs the dzVents event, it takes a short time when it's evaluated by Google/Nest, in my case 1-3 seconds.
If you don't see your nest changing to the new setpoint, you'r dzVents-event is not there or not correct configured.

Re: NEST Account migration

Posted: Wednesday 26 February 2020 20:23
by meel4chris
Hi,

thanks for the script! I'm affraid I have some last issues I have to resolve ;)
After following the steps I now get the following errors in the domoticz logs, any ideas / suggestions?
I'm running on a fresh installation of Buster.

2020-02-26 20:21:00.505 Error: EventSystem: in /home/pi/domoticz/dzVents/runtime/dzVents.lua: /home/pi/domoticz/dzVents/runtime/Utils.lua:1: module 'JSON' not found:
2020-02-26 20:21:00.505 no field package.preload['JSON']
2020-02-26 20:21:00.505 no file '/home/pi/domoticz/scripts/dzVents/JSON.lua'
2020-02-26 20:21:00.505 no file '/home/pi/domoticz/dzVents/runtime/JSON.lua'
2020-02-26 20:21:00.505 no file '/home/pi/domoticz/dzVents/runtime/device-adapters/JSON.lua'
2020-02-26 20:21:00.505 no file '/home/pi/domoticz/scripts/dzVents/dzVents/JSON.lua'
2020-02-26 20:21:00.505 no file '/home/pi/domoticz/scripts/dzVents/scripts/JSON.lua'
2020-02-26 20:21:00.505 no file '/home/pi/domoticz/scripts/dzVents/../lua/JSON.lua'
2020-02-26 20:21:00.505 no file '/home/pi/domoticz/scripts/dzVents/scripts/modules/JSON.lua'
2020-02-26 20:21:00.505 no file '/home/pi/domoticz/scripts/dzVents/JSON.lua'
2020-02-26 20:21:00.505 no file '/home/pi/domoticz/scripts/dzVents/generated_scripts/JSON.lua'
2020-02-26 20:21:00.505 no file '/home/pi/domoticz/scripts/dzVents/data/JSON.lua'
2020-02-26 20:21:00.505 no file '/home/pi/domoticz/scripts/dzVents/modules/JSON.lua'
2020-02-26 20:21:00.505 no file '/usr/local/share/lua/5.3/JSON.lua'
2020-02-26 20:21:00.505 no file '/usr/local/share/lua/5.3/JSON/init.lua'
2020-02-26 20:21:00.505 no file '/usr/local/lib/lua/5.3/JSON.lua'
2020-02-26 20:21:00.505 no file '/usr/local/lib/lua/5.3/JSON/init.lua'
2020-02-26 20:21:00.505 no file './JSON.lua'
2020-02-26 20:21:00.505 no file './JSON/init.lua'
2020-02-26 20:21:00.505 no file '/usr/local/lib/lua/5.3/JSON.so'
2020-02-26 20:21:00.505 no file '/usr/local/lib/lua/5.3/loadall.so'
2020-02-26 20:21:00.505 no file './JSON.so'

Re: NEST Account migration

Posted: Thursday 27 February 2020 14:23
by rolandbreedveld
meel4chris wrote: Wednesday 26 February 2020 20:23 Hi,

thanks for the script! I'm affraid I have some last issues I have to resolve ;)
After following the steps I now get the following errors in the domoticz logs, any ideas / suggestions?
I'm running on a fresh installation of Buster.

2020-02-26 20:21:00.505 Error: EventSystem: in /home/pi/domoticz/dzVents/runtime/dzVents.lua: /home/pi/domoticz/dzVents/runtime/Utils.lua:1: module 'JSON' not found:
2020-02-26 20:21:00.505 no field package.preload['JSON']
2020-02-26 20:21:00.505 no file '/home/pi/domoticz/scripts/dzVents/JSON.lua'
2020-02-26 20:21:00.505 no file '/home/pi/domoticz/dzVents/runtime/JSON.lua'
2020-02-26 20:21:00.505 no file '/home/pi/domoticz/dzVents/runtime/device-adapters/JSON.lua'
2020-02-26 20:21:00.505 no file '/home/pi/domoticz/scripts/dzVents/dzVents/JSON.lua'
2020-02-26 20:21:00.505 no file '/home/pi/domoticz/scripts/dzVents/scripts/JSON.lua'
2020-02-26 20:21:00.505 no file '/home/pi/domoticz/scripts/dzVents/../lua/JSON.lua'
2020-02-26 20:21:00.505 no file '/home/pi/domoticz/scripts/dzVents/scripts/modules/JSON.lua'
2020-02-26 20:21:00.505 no file '/home/pi/domoticz/scripts/dzVents/JSON.lua'
2020-02-26 20:21:00.505 no file '/home/pi/domoticz/scripts/dzVents/generated_scripts/JSON.lua'
2020-02-26 20:21:00.505 no file '/home/pi/domoticz/scripts/dzVents/data/JSON.lua'
2020-02-26 20:21:00.505 no file '/home/pi/domoticz/scripts/dzVents/modules/JSON.lua'
2020-02-26 20:21:00.505 no file '/usr/local/share/lua/5.3/JSON.lua'
2020-02-26 20:21:00.505 no file '/usr/local/share/lua/5.3/JSON/init.lua'
2020-02-26 20:21:00.505 no file '/usr/local/lib/lua/5.3/JSON.lua'
2020-02-26 20:21:00.505 no file '/usr/local/lib/lua/5.3/JSON/init.lua'
2020-02-26 20:21:00.505 no file './JSON.lua'
2020-02-26 20:21:00.505 no file './JSON/init.lua'
2020-02-26 20:21:00.505 no file '/usr/local/lib/lua/5.3/JSON.so'
2020-02-26 20:21:00.505 no file '/usr/local/lib/lua/5.3/loadall.so'
2020-02-26 20:21:00.505 no file './JSON.so'
These files are not in these locations on my pi, so the errors are correct, but what's causing them, is this after you created the enclosed dzvents script? If so, did you create it with the "graphical" event editor from domoticz?

Re: NEST Account migration

Posted: Friday 28 February 2020 11:19
by meel4chris
Thanks for your help!
I'm getting these errors after I copied the file "dzVents_script_Nest_Setpoint.lua" to the folder "domoticz/scripts/dzVents/scripts/".
I added the .lua extension to the template file.
The content I did not change, the Thermostat device (subtype setpoint) is called "Nest" in domoticz.

Re: NEST Account migration

Posted: Friday 28 February 2020 13:28
by flemm
I have a question about the dzvents script, as well. After some struggle I got your script to work, and it's awesome! Finally able to control my Nest properly through domoticz. Thanks a lot.

One question though, since I added the dzevents setpoint script, my CPU usage increased quite a bit. From <1% to about 5%, with bumps to 7%. I know it's still not much, but it surprises me that such a simple script could increase it so much. And i'm quite a freak when it comes to running things as smooth as possible.. When I disable the script, it immediately drops back to the previous values. I'll post a graph as well.

Is there something i can do to make it less heavy on the CPU? Maybe limit the numbers of checks or something? Or is this a dzevents-related side effect? I have absolutely no experience in scripting or knowledge about how this plugin works, so maybe i'm just asking stupid questions..

Thanks!

Re: NEST Account migration

Posted: Friday 28 February 2020 13:50
by flemm
meel4chris wrote: Friday 28 February 2020 11:19 Thanks for your help!
I'm getting these errors after I copied the file "dzVents_script_Nest_Setpoint.lua" to the folder "domoticz/scripts/dzVents/scripts/".
I added the .lua extension to the template file.
The content I did not change, the Thermostat device (subtype setpoint) is called "Nest" in domoticz.
As far as i know, and how i got it to work, was by adding that script via the Domoticz GUI (Setup - More Options - Events). You can add a Dzvents script there, and that worked for me. But as you can see above, i'm not quite sure about it. I might have done it wrong myself :D

Re: NEST Account migration

Posted: Friday 28 February 2020 14:01
by meel4chris
flemm wrote: Friday 28 February 2020 13:50
meel4chris wrote: Friday 28 February 2020 11:19 Thanks for your help!
I'm getting these errors after I copied the file "dzVents_script_Nest_Setpoint.lua" to the folder "domoticz/scripts/dzVents/scripts/".
I added the .lua extension to the template file.
The content I did not change, the Thermostat device (subtype setpoint) is called "Nest" in domoticz.
As far as i know, and how i got it to work, was by adding that script via the Domoticz GUI (Setup - More Options - Events). You can add a Dzvents script there, and that worked for me. But as you can see above, i'm not quite sure about it. I might have done it wrong myself :D
Thanks for the suggestion, I just tried it but it gives me the same errors

Re: NEST Account migration

Posted: Friday 28 February 2020 17:37
by rolandbreedveld
meel4chris wrote: Friday 28 February 2020 11:19 Thanks for your help!
I'm getting these errors after I copied the file "dzVents_script_Nest_Setpoint.lua" to the folder "domoticz/scripts/dzVents/scripts/".
I added the .lua extension to the template file.
The content I did not change, the Thermostat device (subtype setpoint) is called "Nest" in domoticz.
Better create the event in Domoticz events, create a new one remove the default content en cut-and paste the template in it

Re: NEST Account migration

Posted: Friday 28 February 2020 17:42
by rolandbreedveld
flemm wrote: Friday 28 February 2020 13:28 I have a question about the dzvents script, as well. After some struggle I got your script to work, and it's awesome! Finally able to control my Nest properly through domoticz. Thanks a lot.

One question though, since I added the dzevents setpoint script, my CPU usage increased quite a bit. From <1% to about 5%, with bumps to 7%. I know it's still not much, but it surprises me that such a simple script could increase it so much. And i'm quite a freak when it comes to running things as smooth as possible.. When I disable the script, it immediately drops back to the previous values. I'll post a graph as well.

Is there something i can do to make it less heavy on the CPU? Maybe limit the numbers of checks or something? Or is this a dzevents-related side effect? I have absolutely no experience in scripting or knowledge about how this plugin works, so maybe i'm just asking stupid questions..

Thanks!
strange, I don't have that behaviour, I also shouldn't be, because it's only fired on a device change, did you created it from the domoticz event gui, create a new event->dzvents->device ?

Re: NEST Account migration

Posted: Friday 28 February 2020 18:52
by meel4chris
rolandbreedveld wrote: Friday 28 February 2020 17:37
meel4chris wrote: Friday 28 February 2020 11:19 Thanks for your help!
I'm getting these errors after I copied the file "dzVents_script_Nest_Setpoint.lua" to the folder "domoticz/scripts/dzVents/scripts/".
I added the .lua extension to the template file.
The content I did not change, the Thermostat device (subtype setpoint) is called "Nest" in domoticz.
Better create the event in Domoticz events, create a new one remove the default content en cut-and paste the template in it
That's what I tried this afternoon but that resulted in the same errors...