Access state of device external to python plugin

Python and python framework

Moderator: leecollings

Post Reply
averter
Posts: 46
Joined: Thursday 24 February 2022 8:32
Target OS: Linux
Domoticz version: 2024.4
Contact:

Access state of device external to python plugin

Post by averter »

Hello all,

Pretty basic question I'm convinced but I can't solve it by myself nor find anyone else stuck with the same issue. I've installed this Domoticz-Solax-Plugin and I want to change it so that during its heartbeat function it:
  • Checks the state of a switch selector device (external to the plugin, with IDX=126)
  • IF the state of this device is "Con" = Connected then I want to update one of the parameters of the plugin `<param field="Mode1" label="Update interval (seconds)" width="20px" default="10" />` so that it is equal to 10 seconds.
  • on the other hand IF the parameter is at 10 seconds and the state of the device is "Dis"=Disconnected then revert back to the original update interval of 30 seconds.
I got stuck right at the start as I cannot find a way to read the state of an external device to the plugin.

What am I trying to achieve? I want the plugin to change the sampling rate of the inverter depending on whether I have my EV connected or not to domoticz. Charging is controlled with a different plugin, which has a selector switch to indicate if the EV is connected or not. Thanks for any help/pointers.
User avatar
waltervl
Posts: 5982
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: Access state of device external to python plugin

Post by waltervl »

You cannot control or read devices external of the ones managed by the plugin.
If you want to do that you have to use the http API calls, read the state and do the actions. You will have to set some extra plugin parameters to get Domoticz IP and port and device IDX into the plugin.

But perhaps it is better to have the plugin create a similar state device to check and have a dzvents script sync the 2 devices.
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