Hello, I try to set Used flag to 0 or 1 in Update() function but not working.
Device is always in state of Create() device.
I try this in my script:
Devices[Unit].Update(Name=name, TypeName=TypeName, Description=description, nValue=value, sValue=sValue, Used=0) but device is always visible in switch tab.
Thank you for answer
Luca
Set Used device in Update function
Moderator: leecollings
-
- Posts: 15
- Joined: Monday 28 March 2016 12:09
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Set Used device in Update function
I checked better the problem:
When create new devices with Used=1 or Used=0 they work well with right Used state.
Example:
Domoticz.Device(Name=name, Unit=Unit, TypeName=dtype, Description=description, DeviceID=DeviceID, Used=1).Create()
all devices created are visible on the TABS
if:
Domoticz.Device(Name=name, Unit=Unit, TypeName=dtype, Description=description, DeviceID=DeviceID, Used=0).Create()
all devices created are not visible on TABS
So, when CREATE() devices, Used work well
When devices created are not visible (Used=0), I can put visible from UPDATE() with Used=1:
Example:
Devices[Unit].Update(Name=name, TypeName=dtype, Description=description, nValue=value, sValue=sValue, Used=1)
But when devices visible, with Used=0, the devices stay visible
Example:
Devices[Unit].Update(Name=name, TypeName=dtype, Description=description, nValue=value, sValue=sValue, Used=0)
So I think thare is BUG on UPDATE device function.
Another question: on plugin is neccesary to import Domoticz class (import Domoticz). Where I can find this package?
Thank you
Luca
When create new devices with Used=1 or Used=0 they work well with right Used state.
Example:
Domoticz.Device(Name=name, Unit=Unit, TypeName=dtype, Description=description, DeviceID=DeviceID, Used=1).Create()
all devices created are visible on the TABS
if:
Domoticz.Device(Name=name, Unit=Unit, TypeName=dtype, Description=description, DeviceID=DeviceID, Used=0).Create()
all devices created are not visible on TABS
So, when CREATE() devices, Used work well
When devices created are not visible (Used=0), I can put visible from UPDATE() with Used=1:
Example:
Devices[Unit].Update(Name=name, TypeName=dtype, Description=description, nValue=value, sValue=sValue, Used=1)
But when devices visible, with Used=0, the devices stay visible
Example:
Devices[Unit].Update(Name=name, TypeName=dtype, Description=description, nValue=value, sValue=sValue, Used=0)
So I think thare is BUG on UPDATE device function.
Another question: on plugin is neccesary to import Domoticz class (import Domoticz). Where I can find this package?
Thank you
Luca
-
- Posts: 15
- Joined: Monday 28 March 2016 12:09
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Set Used device in Update function
Nobody have solution?
Bye
Bye
- Dnpwwo
- Posts: 820
- Joined: Sunday 23 March 2014 9:00
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Location: Melbourne, Australia
- Contact:
Re: Set Used device in Update function
There appears to be a bug but not in the Device.Update function it is in the Device.Refresh function that is responsible for load data from the database.
The Used field is not loaded so defaults to '0' which means that when you try and update it to '0' the Device.Update treats the field as unchanged (and so correctly ignores it).
I will see if I can find time to push a fix.
The Domoticz library is exposed to the plugin by Domoticz itself at run time so you will not be able to 'find' it. Some people have created 'fake' ones for testing (although I'm not sure how functional they are) that Google knows about
The Used field is not loaded so defaults to '0' which means that when you try and update it to '0' the Device.Update treats the field as unchanged (and so correctly ignores it).
I will see if I can find time to push a fix.
The Domoticz library is exposed to the plugin by Domoticz itself at run time so you will not be able to 'find' it. Some people have created 'fake' ones for testing (although I'm not sure how functional they are) that Google knows about
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
-
- Posts: 15
- Joined: Monday 28 March 2016 12:09
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Set Used device in Update function
Thank you very much for answer.
Bye
Luca
Bye
Luca
- Dnpwwo
- Posts: 820
- Joined: Sunday 23 March 2014 9:00
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Location: Melbourne, Australia
- Contact:
Re: Set Used device in Update function
Pushed a fix last night. Should be in the next beta.
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
Who is online
Users browsing this forum: Bing [Bot] and 1 guest