Hi,
I am currently developing a python plugin to read out some information from a WeHeat heatpump.
The plugin is based client library provided by WeHeat.
During the onStart procedure the plugin logs into the WeHeat backend using user credentials and starts using access and refresh tokens from this point onwards.
In case the initial login does not work, for example when the user enters invalid credentials (or changes them),
I would like to stop the plugin from this procedure so that it doesn't needlessly consume CPU cycles.
Currently I programmed a boolean member so it does not perform any work (throwing more exceptions since we are not logged in).
But this still requires the program to do "nothing" every 30 seconds.
So is there a way to completely stop the plugin from inside its source?
Help needed: Stopping a python plugin from its own source
Moderator: leecollings
-
freekdk
- Posts: 33
- Joined: Monday 01 February 2021 16:33
- Target OS: Linux
- Domoticz version: V2025.1
- Location: Netherlands
- Contact:
Re: Help needed: Stopping a python plugin from its own source
Try ending the function with:
return False
return False
Re: Help needed: Stopping a python plugin from its own source
The way I'm doing is to use the /json.htm?type=command¶m=updatehardware" API
You can then Stop by seting "enabled" to False or Restart by setting "enabled" to True
note Use the complete set of parms that you find when entering the disable command on the GUI because if not completely entered it will remove data from the parms. Test on a test system first !!
You can then Stop by seting "enabled" to False or Restart by setting "enabled" to True
note Use the complete set of parms that you find when entering the disable command on the GUI because if not completely entered it will remove data from the parms. Test on a test system first !!
-
jorknu
- Posts: 5
- Joined: Friday 12 September 2025 15:33
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2025.2
- Location: NL
- Contact:
Re: Help needed: Stopping a python plugin from its own source
@pipiche thanks for the suggestion I will try that.
Do you know if there is a reliable way to retrieve the address and port domoticz is running on?
I could try using localhost (or 127.0.0.1) as an address. But the port can be anything (in my case its 80, in the default its 8080, with HTTPs its usually 443)
Other question:
How can I list the plugin on the wiki so that other people can find it?
Do you know if there is a reliable way to retrieve the address and port domoticz is running on?
I could try using localhost (or 127.0.0.1) as an address. But the port can be anything (in my case its 80, in the default its 8080, with HTTPs its usually 443)
Other question:
How can I list the plugin on the wiki so that other people can find it?
- gizmocuz
- Posts: 2707
- Joined: Thursday 11 July 2013 18:59
- Target OS: Raspberry Pi / ODroid
- Domoticz version: beta
- Location: Top of the world
- Contact:
Re: Help needed: Stopping a python plugin from its own source
One way of doing this is requesting this information via mDNS (try the bonjour browser as example)
This reveals the IP address and port
This reveals the IP address and port
Quality outlives Quantity!
- waltervl
- Posts: 6677
- Joined: Monday 28 January 2019 18:48
- Target OS: Linux
- Domoticz version: 2025.1
- Location: NL
- Contact:
Re: Help needed: Stopping a python plugin from its own source
Have the people fill in the Domoticz IP and Port in the plugin configuration.jorknu wrote: Sunday 05 October 2025 10:20 @pipiche thanks for the suggestion I will try that.
Do you know if there is a reliable way to retrieve the address and port domoticz is running on?
I could try using localhost (or 127.0.0.1) as an address. But the port can be anything (in my case its 80, in the default its 8080, with HTTPs its usually 443)
Announce it in a new forum topic and then I will add it to the wiki plugin list.jorknu wrote: Sunday 05 October 2025 10:20 Other question:
How can I list the plugin on the wiki so that other people can find it?
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
-
jorknu
- Posts: 5
- Joined: Friday 12 September 2025 15:33
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2025.2
- Location: NL
- Contact:
Re: Help needed: Stopping a python plugin from its own source
Created a forum page, awaiting moderator approval.waltervl wrote: Sunday 05 October 2025 16:22 Announce it in a new forum topic and then I will add it to the wiki plugin list.
Thanks for the suggestion I am trying to not expose this information via static variables.waltervl wrote: Sunday 05 October 2025 16:22 Have the people fill in the Domoticz IP and Port in the plugin configuration.
It will break fairly quickly with for example DHCP for the address.
I am also trying to make it easy in use for the end user.
I think I will try the suggestion from pipiche and the suggestion from gizmocuz to lookup via zeroconf, mDns, bonjour (whatever you like to call it).
Maybe the AsyncZeroconf can help, aiohomekit uses it and I have been fiddling around with that library for the Tado maddness
Who is online
Users browsing this forum: No registered users and 1 guest