Page 1 of 1

Temperature Setpoint & PHP script

Posted: Friday 13 November 2015 10:48
by Tylou
Hello,

I would launch a script when I modify a temperature setpoint

I have a Netatmo thermostat and I have implemented a PHP script to show temperature and thermostat status.
That's working well

Now, I would to be able to set the temperature with Domoticz.
But the temperature setpoint widget, doesn't allow to launch a script when I change the temperature (as for ON/OFF button).

A solution is to use CRON, to compare the Domoticz setpoint and netatmo setpoint.
If values are differents, send the new temperature to netatmo.
-> the risk is to erase domoticz setpoint when I update data from netatmo before checking setpoints

Is someone know how launch a PHP script when temperature setpoint is modified?

Thanks

Re: Temperature Setpoint & PHP script

Posted: Friday 13 November 2015 10:59
by Egregius
True, an update of a setpoint doesn't trigger scripts.
I run a big PHP script by cron every 10 sec to compare everything and switch where needed.

Re: Temperature Setpoint & PHP script

Posted: Friday 13 November 2015 18:11
by Tylou
Ok
Thanks for your answer.

Before sending my query I though this solution too heavy and not very nice.
But according to your "PHP Floorplan" it works :-)

I will implement it

Re: Temperature Setpoint & PHP script

Posted: Saturday 14 November 2015 5:59
by Egregius
PHP isn't very heavy.
I run Apache with X-Cache enabled. X-Cache serves the files rapidly from memory instead of disk and can store variables. For non persistant variables way faster than querying Domoticz.
I run 1 big PHP script that does truly everything I wish from Domoticz. It's run every 10 sec by cron and upon every switch update. The script takes less than 0,1 sec to complete (if there's nothing to do, else about 0,05 sec for every command sent).
Still, my CPU usage is less than 1% (with 95 used devices).