Hi,
Is it correct that, to update the value of a device that is not created by your own plugin, you have to go through the json route rather than using something like "Devices[Unit].Update(nValue=0, sValue="1")? I came from Lua scripting, where you can access a lot of functionality using imported variables like "commandArray" and "otherdevices" etc. But I believe this is not the case for Python, correct? Just to make sure I didn't overlook anything.
Updating other devices from a plugin
Moderator: leecollings
-
- Posts: 443
- Joined: Thursday 12 November 2015 10:55
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Location: The Netherlands
- Contact:
Updating other devices from a plugin
Raspberry Pi 4 - RFXtrx433 - CC2531 Zigbee - Opentherm Gateway - P1 smart meter - Netatmo - Philips Hue - ELV Max! - ESP8266 DIY water meter - 6 x Sonos - 4 x IP cameras - Wall mounted tablet + Dashticz - Google Home integration - MANY switches/sensors
-
- Posts: 228
- Joined: Sunday 28 August 2016 7:48
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: France
- Contact:
Re: Updating other devices from a plugin
This is correct (see Smart Virtual Thermostat for how I implemented a workaround)
-
- Posts: 443
- Joined: Thursday 12 November 2015 10:55
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Location: The Netherlands
- Contact:
Re: Updating other devices from a plugin
Thanks.
It's actually pretty stupid that this is the only way, it means you have to ask the user for his Domoticz IP:port, username and password. I don't have enough parameters left for that, plus it doesn't appear very smart from the user's point of view: Why would the plugin need to know all of these things just to set a switch?
Raspberry Pi 4 - RFXtrx433 - CC2531 Zigbee - Opentherm Gateway - P1 smart meter - Netatmo - Philips Hue - ELV Max! - ESP8266 DIY water meter - 6 x Sonos - 4 x IP cameras - Wall mounted tablet + Dashticz - Google Home integration - MANY switches/sensors
-
- Posts: 228
- Joined: Sunday 28 August 2016 7:48
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: France
- Contact:
Re: Updating other devices from a plugin
I think your tone is a bit out of place. Not my choice... but see viewtopic.php?f=65&t=19780&p=153372#p153372 where the author of the plugin framework explains its rationale. Bear in mind that your plugin can always create a switch that domoticz can monitor through the event system (scripts) for subsequent actions.
-
- Posts: 443
- Joined: Thursday 12 November 2015 10:55
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Location: The Netherlands
- Contact:
Re: Updating other devices from a plugin
Ok, sorry if I was misunderstood, with "stupid" I didn't mean to insult anyone. It just feels a bit silly (is that a better word?) that, in order to read or update a device, you have to go the "external" route, whereas the plugins run internally so all variables could be passed directly.
Some background:
I would like my plugin to be able to set a switch depending on the value of some other devices (managed by the plugin). But I now come to realize that giving users the freedom to select one of their existing switches means asking for four additional user parameters (next to the switch name or IDX). I believe this is a bit too complicated for such a small additional (and optional) feature. I think I will just offer the option to let let the plugin create its own switch. People can then add their own slave devices or scripts to this switch.
Anyway, thanks for the clarification, and sorry for my (unintended) tone...
Some background:
I would like my plugin to be able to set a switch depending on the value of some other devices (managed by the plugin). But I now come to realize that giving users the freedom to select one of their existing switches means asking for four additional user parameters (next to the switch name or IDX). I believe this is a bit too complicated for such a small additional (and optional) feature. I think I will just offer the option to let let the plugin create its own switch. People can then add their own slave devices or scripts to this switch.
Anyway, thanks for the clarification, and sorry for my (unintended) tone...
Raspberry Pi 4 - RFXtrx433 - CC2531 Zigbee - Opentherm Gateway - P1 smart meter - Netatmo - Philips Hue - ELV Max! - ESP8266 DIY water meter - 6 x Sonos - 4 x IP cameras - Wall mounted tablet + Dashticz - Google Home integration - MANY switches/sensors
Who is online
Users browsing this forum: FireWizard and 1 guest