Page 1 of 1

Specific sensor timeout

Posted: Saturday 25 March 2017 10:45
by krizzz
Because i have some scripts running a virtual sensor once every 12 hours (bluetooth & Battery related) and the general (settings/others) setting for sensor timeout is 60 minutes. I have quite some sensors standard (after 60 minutes of course) displaying a red color. Is there any way, I can manipulate the timeout per individual sensor?

Re: Specific sensor timeout

Posted: Tuesday 28 March 2017 22:05
by krizzz
No one has the same need for this? Interesting!

Re: Specific sensor timeout

Posted: Tuesday 28 March 2017 22:15
by Nautilus
krizzz wrote:No one has the same need for this? Interesting!
The need is surely there, but I guess the topic got dismissed as you asked for specific advice on overcoming the issue and I don't think there currently is any (using the built-in timeout at least). What I've done is that I've set the timeout to 10 days and if I need to get notified of some sensor sooner than that, I'll just setup a script that will send a notification after the specified idle time. If this kind of approach is something you'd be interested in, search the forum for "lua timedifference function" or check the wiki :)

Re: Specific sensor timeout

Posted: Tuesday 28 March 2017 22:17
by krizzz
Nautilus wrote:
krizzz wrote:No one has the same need for this? Interesting!
The need is surely there, but I guess the topic got dismissed as you asked for specific advice on overcoming the issue and I don't think there currently is any (using the built-in timeout at least). What I've done is that I've set the timeout to 10 days and if I need to get notified of some sensor sooner than that, I'll just setup a script that will send a notification after the specified idle time. If this kind of approach is something you'd be interested in, search the forum for "lua timedifference function" or check the wiki :)
Yeah, good advice. Thanks, problem is when you have a lot of sensor again it is a lot of scripting. But thanks for confirming that there are more people with this need!

Re: Specific sensor timeout

Posted: Tuesday 28 March 2017 22:42
by Nautilus
krizzz wrote:Thanks, problem is when you have a lot of sensor again it is a lot of scripting.
True. One possibility would be to adapt e.g. this script https://www.domoticz.com/wiki/Battery_l ... LUA_script (I'm using a bit modified version of that one to get a notification once a day if any battery operated device is below given threshold and then a weekly summary of all used battery devices) so that it would loop through all sensors (just need to be able to define them based on some of the available parameters) and then report as needed based on "LastUpdate". But definitely it would be nice to see custom timeouts (with a notification option ;)) directly as a Domoticz feature! :)

Re: Specific sensor timeout

Posted: Tuesday 09 October 2018 14:41
by GSV3Miac
Late to the party but I'd like to be able to specify different timeout for some sensors too (as the OP says, virtual one in particular .. I can't even see a way to use a script fake out the lastupdate value for them,. unless I read and rewrite their actual values in LUA script).

Re: Specific sensor timeout

Posted: Monday 29 October 2018 15:09
by bewo
GSV3Miac wrote: Tuesday 09 October 2018 14:41 Late to the party but I'd like to be able to specify different timeout for some sensors too (as the OP says, virtual one in particular .. I can't even see a way to use a script fake out the lastupdate value for them,. unless I read and rewrite their actual values in LUA script).
And where's the problem?
I hate to see a red bar in my devices... So for a Dummy-Setpoint-Device I use a Lua-Script for years now without problems.... :-)
What is the value from the sensor? A number? Then i think it's easy to use my simple script. ;)

Code: Select all

-- Script for "Holding active" an dummy Setpoint-Device
-- Stand: 29.10.2018

-- Set your thermostat here:
local thermostat = 'Thermostat Heizautomatik'

commandArray = {}

-- Calculating time:
function timedifference(timestamp)
  y, m, d, H, M, S = timestamp:match("(%d+)-(%d+)-(%d+) (%d+):(%d+):(%d+)")
  difference = os.difftime(os.time(), os.time{year=y, month=m, day=d, hour=H, min=M, sec=S})
  return difference
end

local function updatenum(dev, value1)
    local cmd = string.format("%d|0|%d", otherdevices_idx[dev], value1)
    table.insert (commandArray, { ['UpdateDevice'] = cmd } )
end

-- Let's go:

for deviceName,deviceValue in pairs(otherdevices) do
    if (deviceName== thermostat ) then

        if tonumber(deviceValue) > 0 then
            
            if timedifference(otherdevices_lastupdate[thermostat]) > 3500
            
            then
            
            print ("Das Thermostat wurde mit der identischen Temperatur aktualisiert.")
            
            updatenum(thermostat, tonumber(otherdevices[thermostat]) + 0)
            
            end
        
       end
    end
end


return commandArray

Re: Specific sensor timeout

Posted: Monday 29 October 2018 16:14
by GSV3Miac
The problem is that that is just causing LUA extra work to read/write an unchanged sensor value, to get around the problem of fixed timeout. Yes, it works, but No, it isn't what I'd call 'elegant'.

Re: Specific sensor timeout

Posted: Monday 10 December 2018 11:35
by tvurce
+1

It would be nice, it will be in GUI. It looks like basic setting for a sensor and it should be sensor specific.

Re: Specific sensor timeout

Posted: Friday 01 November 2019 23:50
by jeecee
Disregard.
It seems that text sensors do not timeout.