Run script when client connect

Topics (not sure which fora)
when not sure where to post, post here and mods will move it to right forum.

Moderators: leecollings, remb0

Post Reply
timmpo
Posts: 20
Joined: Sunday 24 February 2019 10:26
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Run script when client connect

Post 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).
User avatar
waltervl
Posts: 6001
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2025.1
Location: NL
Contact:

Re: Run script when client connect

Post 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?
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
timmpo
Posts: 20
Joined: Sunday 24 February 2019 10:26
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Run script when client connect

Post 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.
User avatar
waltervl
Posts: 6001
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2025.1
Location: NL
Contact:

Re: Run script when client connect

Post 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.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest