Page 1 of 1

Access other devices from a python plugin

Posted: Monday 20 March 2017 13:19
by ycahome
Hi,

am trying to find any info regarding access (read/update) existing devices from a python plugin without success.
Has anyone any clue about that?

thanks

Re: Access other devices from a python plugin

Posted: Monday 20 March 2017 16:27
by emme
I think you cannot....

Python plugins has granted access to a restricted sets of devices: theirs! :P
and some settings option :)

The reason is simple: by design, interaction between devices form different hardware MUST be performed by the server, not by hardware (or plugins)

If you want to interact between different hardward devices, use an external script... or LUA
ciao
M

Re: Access other devices from a python plugin

Posted: Monday 20 March 2017 18:23
by ycahome
Hello emme.

Although, what you said seems reasonable, I can now interact with the rest of the hardware via API calls. But, If I do that, what's the difference from a plugin? Both can cause the problems you mentioned.
+ would be better to use internal functions than unmanaged API http calls.

My intention was to build a plugin that will time when a switch device is on (and give day, week , month, year usage), something that is missing from native code.

Re: Access other devices from a python plugin

Posted: Tuesday 21 March 2017 4:17
by Dnpwwo
@ycahome,

I believe that would be done much easier in Lua. You can write a script that is notified of all device events which sounds perfect for what you want to do.

As emme has said, the plugin framework is designed for interfacing external hardware to Domoticz. Plugins only see their own devices as a control to stop bugs impacting other devices and trashing a user's system