How to access settings Topic is solved

Python and python framework

Moderator: leecollings

Post Reply
gerardvs
Posts: 81
Joined: Sunday 04 January 2015 0:01
Target OS: Raspberry Pi / ODroid
Domoticz version: latest-1
Location: /dev/null
Contact:

How to access settings

Post by gerardvs »

Hi all,

At the moment I'm a bit lost in what api's are available from Python. I know there is a (limited) description of json calls but want to know what I can call directly from Python.
For now I want to access the settings without having to call /json.htm?type=settings.

Please let me know if/where to find this information.
Thanks,
--Gerard
gerardvs
Posts: 81
Joined: Sunday 04 January 2015 0:01
Target OS: Raspberry Pi / ODroid
Domoticz version: latest-1
Location: /dev/null
Contact:

Re: How to access settings and more

Post by gerardvs »

Sorry to bump this question. Additionally to my previous post I also want to create and access user variables from the python plugin. Is that possible and if so, how?

Thanks,
--Gerard
User avatar
Dnpwwo
Posts: 819
Joined: Sunday 23 March 2014 9:00
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Melbourne, Australia
Contact:

Re: How to access settings

Post by Dnpwwo »

@gerardvs,

When "Add Settings collection #1289" pull request gets merged you will be able to Domoticz settings via a Setting dictionary from within a plugin.

What are you trying to achieve by accessing User Variables? These are designed for users to access during events from Lua and I can't think why you would access them from a plugin that interfaces to an external device.
The reasonable man adapts himself to the world; the unreasonable one persists to adapt the world to himself. Therefore all progress depends on the unreasonable man. George Bernard Shaw
gerardvs
Posts: 81
Joined: Sunday 04 January 2015 0:01
Target OS: Raspberry Pi / ODroid
Domoticz version: latest-1
Location: /dev/null
Contact:

Re: How to access settings

Post by gerardvs »

Thanks for the great news about the settings collection! I will pull it out of the Python-Plugins branch and test it asap.

About the uservariables, well, its more a dirty mind (from a programming point of view ;) ) in the sense of an easy way of communicating with the plugin from the outside world via the json api. Of course pulling data is no problem but pushing data to the plugin, if needed, is fairly easy that way.
May be I should think about is a bit more and if I can find some real world benefits I will start a new topic on this.

Thanks again,
--Gerard
gerardvs
Posts: 81
Joined: Sunday 04 January 2015 0:01
Target OS: Raspberry Pi / ODroid
Domoticz version: latest-1
Location: /dev/null
Contact:

Re: How to access settings

Post by gerardvs »

Update: Just did a quick test and I can access all settings/preferences now from my plugin!
Thanks again,
--Gerard
ffes
Posts: 51
Joined: Thursday 26 January 2017 23:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: NL
Contact:

Re: How to access settings

Post by ffes »

Dnpwwo wrote:When "Add Settings collection #1289" pull request gets merged you will be able to Domoticz settings via a Setting dictionary from within a plugin.
\o/

I see it is already merged!!! Looking forward to this very much. I don't have to ask the users for their location and retrieve it from the settings. Hope to have some time soon to update my plugin to use this!
gerardvs
Posts: 81
Joined: Sunday 04 January 2015 0:01
Target OS: Raspberry Pi / ODroid
Domoticz version: latest-1
Location: /dev/null
Contact:

Re: How to access settings

Post by gerardvs »

Indeed, I already removed the lat/lon settings and retrieve them now from the system settings. :D
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests