Cleaning IDX

Topics (not sure which fora)
when not sure where to post, post here and mods will move it to right forum.

Moderators: leecollings, remb0

ricorico94
Posts: 94
Joined: Monday 26 October 2015 10:41
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Cleaning IDX

Post by ricorico94 »

Hi,

Is it possible to "clean" the various IDX ?

I recently began my Domoticz and I have installed several times some devices, or I installed similar devices after having installed other types of devices in meantime.
For instance, I always had to make several attempts to add zwave devices (I think I had not udnerstood properly the actions to take between the push on dongle and then addition through menu of Domoticz..), so I have plenty of IDX which are unused since I deleted the "failed attempts".
Or I also included some switches for blinds for testing, then included some virtual switches for other purpose (like adding timers for heaters), then added again some other switches for blinds. As a result, I have consecutive IDX for blinds at 22, 23, 24, and then the remaining ones at 34 and 37.
Is there anyway to clean the IDX by reallocating the various IDX to new ones to have kind of logic with ranges per category ? Something like: 1-10 : for blinds; 11-20 for heaters; 21-50 for virtual switches; etc. ? I ould avoid also reaching "high numbers" for IDX while having only a few dozens of IDX really active.
(of course, cleaning would mean also updating all external scripts, calls, etc. A pain, but why not)

br,
ricorico94
User avatar
gizmocuz
Posts: 2552
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Top of the world
Contact:

Re: Cleaning IDX

Post by gizmocuz »

No, you can delete sensors from the devices table, the idx values are just indexes, and do not need to be in order
Quality outlives Quantity!
ricorico94
Posts: 94
Joined: Monday 26 October 2015 10:41
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Cleaning IDX

Post by ricorico94 »

Hi ,
Too bad we can't organise those indexes later on.
It's like IP subnetworks.. it can work with IP addresses here and there, but it looks nicer when it's ordered. I understand these numbers are database indexes (primary key, maybe ?), but it would ease readibility if we could organise them by categories: for instance, when writing scripts, having IDX organised with a "logic" behind could be interesting.

br,
ricorico94
RobertH
Posts: 12
Joined: Sunday 15 November 2015 19:10
Target OS: Windows
Domoticz version:
Location: Norway, Kongsberg
Contact:

Re: Cleaning IDX

Post by RobertH »

Is it in some way possible to see wich IDX belong to for example a Fibaro dimmer?
Because sometimes you add more than one new z wave unit and over a little time they add some extra devices.
Domoticz running on Windows Server 2008 in VMware (ESXi), UZB1 stick, 3x FIBARO FGD212 Dimmer, 1x FIBARO RGBW Controller FGRGBWM-441, 2x FIBARO FGMS001 Motion Sensor and 2x Popp 009006 Plug-in Switch
User avatar
gizmocuz
Posts: 2552
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Top of the world
Contact:

Re: Cleaning IDX

Post by gizmocuz »

These are database indexes and should not be changed
yes, goto the devices overview, and sometimes adding new devices should not happen, after a good include it should be stable
Quality outlives Quantity!
User avatar
nayr
Posts: 354
Joined: Tuesday 11 November 2014 18:42
Target OS: Linux
Domoticz version: github
Location: Denver, CO - USA
Contact:

Re: Cleaning IDX

Post by nayr »

I just broke into the 200's IDX, im sure Gizmocuz here likely has device id's in the 4 digits..

If your that OCD about it wipe everything out and start over, but there really is no problem.. who cares what number that is, the requirement is that it be unique and static.. not in order, or small or big or anything else an unhealthy mind will consider important.

implementing your request breaks one of the requirements.. that it remain static.
Last edited by nayr on Thursday 11 February 2016 18:01, edited 1 time in total.
Debian Jessie: CuBox-i4 (Primary) w/Static Routed IP and x509 / BeagleBone with OpenSprinkler / BeagleBone Planted Aquarium / 3x Raspbery Pi2b GPIO Slaves
Elemental Theme - node-domoticz-mqtt - Home Theatre Controller - AndroidTV Simple OSD Remote - x509 TLS Auth
User avatar
gizmocuz
Posts: 2552
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Top of the world
Contact:

Re: Cleaning IDX

Post by gizmocuz »

The only reason why the IDX value is visible to end-users is for people that use it with scripts/lua
If you dont use that, ignore it

yep... 4 digits (2924)
Quality outlives Quantity!
stlaha2007
Posts: 370
Joined: Monday 05 October 2015 10:16
Target OS: -
Domoticz version:
Contact:

Re: Cleaning IDX

Post by stlaha2007 »

If youre despirate in reordering, i would suggest replicate your devices by creating new devices with the json api. Then you are able to assign your logical device type related numbering.

But keep it simple. Namingschemas are easier to understand then manualy rebuilding your device numbering ;-)

And dont forget that the last number youve used 'manualy' will be followed by a next number when domoticz finds a new devices.

Grtz,
Stephan
User avatar
gizmocuz
Posts: 2552
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Top of the world
Contact:

Re: Cleaning IDX

Post by gizmocuz »

it is just a number.... :?:
Quality outlives Quantity!
User avatar
nayr
Posts: 354
Joined: Tuesday 11 November 2014 18:42
Target OS: Linux
Domoticz version: github
Location: Denver, CO - USA
Contact:

Re: Cleaning IDX

Post by nayr »

gizmocuz wrote:it is just a number.... :?:
How dare you say that to someone with OCD!? :lol:

they are tormented by stuff like this. ;)
Debian Jessie: CuBox-i4 (Primary) w/Static Routed IP and x509 / BeagleBone with OpenSprinkler / BeagleBone Planted Aquarium / 3x Raspbery Pi2b GPIO Slaves
Elemental Theme - node-domoticz-mqtt - Home Theatre Controller - AndroidTV Simple OSD Remote - x509 TLS Auth
stlaha2007
Posts: 370
Joined: Monday 05 October 2015 10:16
Target OS: -
Domoticz version:
Contact:

Re: Cleaning IDX

Post by stlaha2007 »

Nayr / Gizmocuz... Please :-)) . I like ("my") order to...

Someone asked for renumbering idx.


Grtz,
Stephan
NietGiftig
Posts: 121
Joined: Sunday 11 October 2015 8:50
Target OS: Raspberry Pi / ODroid
Domoticz version: V3.6224
Location: Holland
Contact:

Re: Cleaning IDX

Post by NietGiftig »

stlaha2007 wrote: Someone asked for renumbering idx.
It would be silly to do.
Its an intern database number

Anything else is more important to do then altering database ID's just because it is not in the order you like. ;)

The people here are trying to create an new stable release, much, I say much more important then not relevant optics.
RPI-2 + SSD / ESPEasy Sensors & Switches / Sonoff / RFLink / Action Switches / TP-Link switch / Node-Red / Reacticz
stlaha2007
Posts: 370
Joined: Monday 05 October 2015 10:16
Target OS: -
Domoticz version:
Contact:

Re: RE: Re: Cleaning IDX

Post by stlaha2007 »

NietGiftig wrote:
stlaha2007 wrote: Someone asked for renumbering idx.
It would be silly to do.
Its an intern database number

The people here are trying to create an new stable release, much, I say much more important then not relevant optics.
Totally agree
Waiting for the new stable with selector switches etcetera....

But again. Someone (Topic Starter) asked for it, which is not ME.

Grtz,
Stephan
NietGiftig
Posts: 121
Joined: Sunday 11 October 2015 8:50
Target OS: Raspberry Pi / ODroid
Domoticz version: V3.6224
Location: Holland
Contact:

Re: RE: Re: Cleaning IDX

Post by NietGiftig »

stlaha2007 wrote: But again. Someone (Topic Starter) asked for it, which is not ME.
Yes that's correct and an answer was given
http://www.domoticz.com/forum/viewtopic ... 859#p74589
RPI-2 + SSD / ESPEasy Sensors & Switches / Sonoff / RFLink / Action Switches / TP-Link switch / Node-Red / Reacticz
raym
Posts: 81
Joined: Tuesday 03 November 2015 5:07
Target OS: Linux
Domoticz version: beta
Contact:

Re: RE: Re: Cleaning IDX

Post by raym »

nayr wrote:I just broke into the 200's IDX, im sure Gizmocuz here likely has device id's in the 4 digits..

If your that OCD about it wipe everything out and start over, but there really is no problem.. who cares what number that is, the requirement is that it be unique and static.. not in order, or small or big or anything else an unhealthy mind will consider important.

implementing your request breaks one of the requirements.. that it remain static.
I presume the limit on DZ device indexes is high but what happens with Z-Wave node IDs? Once the 232 node limit is reached, does DZ/OZW start cycling through the IDs that may not have been used? I suspect I'll never reach such limits... Just curious.
User avatar
Egregius
Posts: 2592
Joined: Thursday 09 April 2015 12:19
Target OS: Linux
Domoticz version: v2024.7
Location: Beitem, BE
Contact:

Re: Cleaning IDX

Post by Egregius »

The device IDX aren't anything to worry about. You are not getting to 9223372036854775807 very quickly.
And then, if it's the autonumbering of SQLite3 that is used there's no problem:
Longer answer: If you declare a column of a table to be INTEGER PRIMARY KEY, then whenever you insert a NULL into that column of the table, the NULL is automatically converted into an integer which is one greater than the largest value of that column over all other rows in the table, or 1 if the table is empty. Or, if the largest existing integer key 9223372036854775807 is in use then an unused key value is chosen at random.
The Zwave IDX on the other hand, I'm now at 89 and also curious what happens when the limit is there...
stlaha2007
Posts: 370
Joined: Monday 05 October 2015 10:16
Target OS: -
Domoticz version:
Contact:

Re: RE: Re: Cleaning IDX

Post by stlaha2007 »

Egregius wrote:The device IDX aren't anything to worry about. You are not getting to 9223372036854775807 very quickly.
And then, if it's the autonumbering of SQLite3 that is used there's no problem:
Longer answer: If you declare a column of a table to be INTEGER PRIMARY KEY, then whenever you insert a NULL into that column of the table, the NULL is automatically converted into an integer which is one greater than the largest value of that column over all other rows in the table, or 1 if the table is empty. Or, if the largest existing integer key 9223372036854775807 is in use then an unused key value is chosen at random.
The Zwave IDX on the other hand, I'm now at 89 and also curious what happens when the limit is there...
A quick google let to some maintenance questions about the effects of reindex and vacuum.

Depends on what maintenance procedures are implemented in such case.

I think the one developing Domoticz and its database, Gizmocus??, can give some info about this. Im curious too, however i dont expect there would be a problem as there are protocols that are limited earlier then the database limits.


Grtz,
Stephan
User avatar
gizmocuz
Posts: 2552
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Top of the world
Contact:

Re: Cleaning IDX

Post by gizmocuz »

ZWave, the limit will be 254 nodes
SQLite, when you backup your database in domoticz from the settings page, there is an automatic vacuum done
If you renumber the indexes, then all is lost, like the temperature tables references id's from the device table and so on
Quality outlives Quantity!
stlaha2007
Posts: 370
Joined: Monday 05 October 2015 10:16
Target OS: -
Domoticz version:
Contact:

Re: Cleaning IDX

Post by stlaha2007 »

Big thanks.

But is the vacuum done before on 'live' db or only into backup?

Grtz,
Stephan
User avatar
gizmocuz
Posts: 2552
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Top of the world
Contact:

Re: Cleaning IDX

Post by gizmocuz »

Only when a backup is made, before the backup is made, the backup is vacuumed
Quality outlives Quantity!
Locked

Who is online

Users browsing this forum: No registered users and 1 guest