Disabling automatc addition of RFX devices

Use this forum to discuss possible implementation of a new feature before opening a ticket.
A developer shall edit the topic title with "[xxx]" where xxx is the id of the accompanying tracker id.
Duplicate posts about the same id. +1 posts are not allowed.

Moderators: leecollings, remb0

Post Reply
GJvdP
Posts: 19
Joined: Thursday 30 November 2017 0:33
Target OS: Raspberry Pi / ODroid
Domoticz version: 2022.1
Location: Arnhem, the Netherlands
Contact:

Disabling automatc addition of RFX devices

Post by GJvdP »

Hello dear devellopers,

I live in the center of a town. Everyday when I look in devices there are between 20 and 200 new devices in there that are not mine. Removing them is time consument and a pain to do. And they return at some point in time.
Is it possibble in a next relaese to disable this automatic recognition and only add RFX devices by learning them as is already possible on the switches page?

Also when deleting devices it would be nice if one could select a block of devices instead of having to select them one at a time. Or am I missing a trick?

Best regards,
GJ
b_weijenberg
Posts: 517
Joined: Friday 12 July 2013 18:13
Target OS: -
Domoticz version:
Location: Netherlands
Contact:

Re: Disabling automatc addition of RFX devices

Post by b_weijenberg »

Setup - Settings - Hardware devices: disable Accept New Hardware Devices
RFXtrx433, RFXtrx433E, RFXtrx433XL, RFX433XL, RFX868XL
manutremo
Posts: 67
Joined: Saturday 19 November 2016 17:02
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Disabling automatc addition of RFX devices

Post by manutremo »

I think that what the gjvdp is proposing is an option to disable automatic creation of new rfxcom devices. I would agree with the suggestion since I have the same problem.
b_weijenberg
Posts: 517
Joined: Friday 12 July 2013 18:13
Target OS: -
Domoticz version:
Location: Netherlands
Contact:

Re: Disabling automatc addition of RFX devices

Post by b_weijenberg »

OK in other words:
Creation of new devices is disabled if you disable " Accept New Hardware Devices" in Setup - Settings - Hardware devices
RFXtrx433, RFXtrx433E, RFXtrx433XL, RFX433XL, RFX868XL
manutremo
Posts: 67
Joined: Saturday 19 November 2016 17:02
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Disabling automatc addition of RFX devices

Post by manutremo »

Yes I know what that option does, there is no need to repeat. The point is that that option disables creation of ALL devices, while the request is an option to disable creation of ONLY rfxcom devices. Ideally, I guess an option to disable creation of devices BY type would be also welcome.
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Disabling automatc addition of RFX devices

Post by waaren »

GJvdP wrote: Friday 18 January 2019 23:57 Also when deleting devices it would be nice if one could select a block of devices instead of having to select them one at a time. Or am I missing a trick?
Goto devices tab
Click "Not used" button
Click invert selection
Invert selection
Invert selection
Invert selection.png (3.43 KiB) Viewed 1308 times
Click waste bucket
Waste bucket
Waste bucket
Waste bucket.png (2.7 KiB) Viewed 1308 times
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Disabling automatc addition of RFX devices

Post by waaren »

GJvdP wrote: Friday 18 January 2019 23:57 Hello dear devellopers,

I live in the center of a town. Everyday when I look in devices there are between 20 and 200 new devices in there that are not mine. Removing them is time consument and a pain to do. And they return at some point in time.
Is it possibble in a next relaese to disable this automatic recognition and only add RFX devices by learning them as is already possible on the switches page?

Also when deleting devices it would be nice if one could select a block of devices instead of having to select them one at a time. Or am I missing a trick?

Best regards,
GJ
Until someone implemented this feature in domoticz, you can execute this dzVents script at regular intervals to remove the unused devices.

When not yet familiar with dzVents please start with reading Get started Before implementing. Special attention please for
"In Domoticz go to Setup > Settings > Other and in the section EventSystem make sure the checkbox 'dzVents disabled' is not checked. Also make sure that in the Security section in the settings you allow 127.0.0.1 to not need a password. dzVents uses that port to send certain commands to Domoticz. Finally make sure you have set your current location in Setup > Settings > System > Location, otherwise there is no way to determine nighttime/daytime state."

Code: Select all

-- deleteInactive

local httpResponses = "deleteInactive"

return {
    on      =   {
                    timer           =   { "at 16:24"    },                       -- Your preferred time or times
                    httpResponses   =   { httpResponses }
                },

    logging =   {
                    level           =   domoticz.LOG_DEBUG,
                    marker          =   httpResponses
                },

    execute = function(dz, item)
       local hardwareTypes2Delete =   
                                    { 
                                        "RFXCOM - RFXtrx433 USB 433.92MHz Transceiver",   -- All hardware types can be found in source file
                                        "RFLink Gateway USB",                             -- main/RFXNames.h
                                        "OpenZWave USB",
                                    } 
        local deleteAllUnused = false                                                     -- set true if you want to delete all unused devices
        local simulationOnly  = true                                                       -- set to false if you are ready to really delete unused devices
	
	
	local simulationString = ""
        if simulationOnly then 
           simulationString = "-- Simulation mode -- "
        end
        
        
        local function logWrite(str,level)
            dz.log(tostring(str),level or dz.LOG_DEBUG)
        end

        local function getUnusedDevices()
            local  url = dz.settings['Domoticz url'] .. "/json.htm?type=devices&used=false" 
            dz.openURL({    url = url,
                            method = "GET",
                            callback = httpResponses })
        end
        
        local function deleteDevice(idx)
            if not simulationOnly then 
                dz.openURL( dz.settings['Domoticz url'] .. "/json.htm?type=deletedevice&idx=" .. idx)
            end
            logWrite(simulationString .. "deleting device id: "  .. idx)
        end
        
        local function processUnused(result)
            if result == nil then
                logWrite ("No unused devices found")
                return
            end
            for index in pairs(result) do
                if deleteAllUnused then 
                    logWrite(simulationString .. "Unused device " .. result[index].idx .. ", hardware Type: " .. result[index].HardwareType .. "; will be deleted.")
                    deleteDevice(result[index].idx)
                else
                    for i in ipairs(hardwareTypes2Delete) do
                        if result[index].HardwareType == hardwareTypes2Delete[i] then
                            logWrite(simulationString .. "Unused device " .. result[index].idx .. ", hardware Type: " .. result[index].HardwareType .. "; will be deleted.")
                            deleteDevice(result[index].idx)
                        end
                    end
                end
            end
        end
        
        -- Main
        if not item.isHTTPResponse then
            getUnusedDevices()
        elseif item.ok then                                      -- statusCode == 2xx
            processUnused(item.json.result)
        end
    end
}
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
GJvdP
Posts: 19
Joined: Thursday 30 November 2017 0:33
Target OS: Raspberry Pi / ODroid
Domoticz version: 2022.1
Location: Arnhem, the Netherlands
Contact:

Re: Disabling automatc addition of RFX devices

Post by GJvdP »

Thanks all for the suggestions sofar.
On the subject of unwanted rfx devices, it is nice I can switch off automatic addition of such.
However, if I want to add devices I will run in to the same problem. If I am not fast enough new entries will be created that are not my devices. Deleting them is not a problem but my numbering goes out of wack at that moment.
And deleting unused devices also deletes entries of my own devices that are not used at the moment but might be needed at a later date.
So the original request still stands.
b_weijenberg
Posts: 517
Joined: Friday 12 July 2013 18:13
Target OS: -
Domoticz version:
Location: Netherlands
Contact:

Re: Disabling automatc addition of RFX devices

Post by b_weijenberg »

How many times do you add new devices?
Do you want to add new RFXtrx devices?
Which devices are created?

Maybe an option to disable the RFXtrx or the protocol in the RFXtrx for the specific unwanted devices during the time you like to add new devices.
RFXtrx433, RFXtrx433E, RFXtrx433XL, RFX433XL, RFX868XL
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest