Page 1 of 1
Run script when client connect
Posted: Tuesday 29 July 2025 9:30
by timmpo
Is there a way to detect if client connected to domoticz web server ?
I need to run a script only when browser/user are connect to domoticz for saving api calls (my car, and lawn mower).
Re: Run script when client connect
Posted: Tuesday 29 July 2025 11:10
by waltervl
What do you mean?
A user in your household is logging into Domoticz and only then a script should run querying the status of your car or lawn mower?
So far I am not aware of being able to see who is logged in.
There are some plugins or integrations to see if a device (eg smartphone) is connected to wifi to indicate the user is at home.
But perhaps find a better way to limit API calls to an external device? Are they so limited? Do you need the status to be so up to date that you need a high frequency device update?
Re: Run script when client connect
Posted: Tuesday 29 July 2025 19:40
by timmpo
Yes exactly, a script running once logging in. The lawn mover api provider shut me down when my calls are to often and the dont provide any max number of calls in any documentation. When I connect to the car's API, all electronics wake up from sleep mode and drain the 12V battery if I do it too often. Let's say I don't use the car for a week and Domoticz keeps polling the APIāthen I have a problem.
I think it can be done with Nginx (by running a script on the side when forwarding the client), but I wonder if Domoticz has some workaround for that.
Re: Run script when client connect
Posted: Tuesday 29 July 2025 22:24
by waltervl
Are you talking about 1 default admin account (could be different persons in your family that use this) or do you use different user accounts to log on?
Perhaps better make a dummy push on device for status update for car and/or mower. So when you push on the button for status update it will trigger the script to update the status of mower or car.
What brand of car and mower do you have as this is the first time in hear of these kind of issues.