Comments (5)
i rewrote my plugin to use the information from run method only.
anyway, i still think its not perfect that the information is only available outside the init method.
from smarthome.
i changed the plugin creation mechanism to set the instance name before call the __init__
method. please test it.
smartpugin uses now multiple inheritance to get the methods from Utils.py
now you can call self.is_float(...)
from smarthome.
an other issue: I can create for every plugin config attribute implicit a member inside the plugin object.
[plugin1]
class_name = foo
class_path = plugins.bla
test = test1
foo = bar
bar = foo
and inside the plugin you can get the values with self.foo
or self.test
so we can change in future the __init__
signature to __init__()
without params.
could it be useful?
from smarthome.
my issue can be closed, keeping this open due to last question of cstrassburg.
from my point of view, this could be useful yes. but init with params should be kept alive due to backward compatibility
from smarthome.
from my point of view, this could be useful yes. but init with params should be kept alive due to
backward compatibility
Just a few notes no plugin parameters: I was thinking about to change the signature completely for the init
method: having just one args
argument containing a dict
with all configured parameters (see also #27).
Putting all parameters directly into member fields may be a bad idea since it could overwrite fields without notice (one could accidentally overwrite a field which is not a configuration parameter but an internal variable which should not be change from outside). And the plugin should take care explicitly which parameter it is using and which not.
@cstrassburg, since the first problem about the instance name is solved already we could close this issue and talk about the plugin parameter handling in #27.
What do you think?
from smarthome.
Related Issues (20)
- lib.network: KNX plugin: Thread can only be started once HOT 14
- Multiple Log entries created due to multiple event listener HOT 3
- Error on restarting if shng is not running HOT 2
- Feature request: Delete 0 byte cache files in Admin Interface HOT 7
- extend websocket protocol for series HOT 2
- Admin interface HOT 1
- Feature Request: Enable "Watch Attribute" in AdminIF in Logics Editor for Logic Parameters
- Feature Request: Add small graph in AdminIF / Items / Item Informationen for items having database enabled
- Bug: Eval Checker in admin interface can not handle result of sh.item.series HOT 7
- admin interface: Warning after changing plugin loglevel HOT 8
- shpypi exception on version check of "pymodbus" HOT 4
- implement suspend/resume for plugins HOT 8
- Startup problems on v1.9.4 HOT 23
- Admin interface: support new log levels HOT 1
- HTTP Module: improve handling of page length and responsive design HOT 2
- CherryPy ValueError on restart HOT 2
- cache value not converted to current item type
- Issues with (re)loading logics from the editor page of the admin gui HOT 7
- structs not checked for wrong configurations? HOT 1
- Issue with smartdeviceplugin with UTF-8 response HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from smarthome.