Specific sensor timeout

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

Moderators: leecollings, remb0

Post Reply
krizzz
Posts: 200
Joined: Wednesday 20 November 2013 20:36
Target OS: Linux
Domoticz version:
Location: The Netherlands
Contact:

Specific sensor timeout

Post 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?
krizzz
Posts: 200
Joined: Wednesday 20 November 2013 20:36
Target OS: Linux
Domoticz version:
Location: The Netherlands
Contact:

Re: Specific sensor timeout

Post by krizzz »

No one has the same need for this? Interesting!
Nautilus
Posts: 722
Joined: Friday 02 October 2015 12:12
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Finland
Contact:

Re: Specific sensor timeout

Post 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 :)
krizzz
Posts: 200
Joined: Wednesday 20 November 2013 20:36
Target OS: Linux
Domoticz version:
Location: The Netherlands
Contact:

Re: Specific sensor timeout

Post 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!
Nautilus
Posts: 722
Joined: Friday 02 October 2015 12:12
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Finland
Contact:

Re: Specific sensor timeout

Post 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! :)
GSV3Miac
Posts: 24
Joined: Sunday 05 February 2017 12:00
Target OS: Raspberry Pi / ODroid
Domoticz version: latest
Location: Shropshire UK
Contact:

Re: Specific sensor timeout

Post 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).
User avatar
bewo
Posts: 74
Joined: Monday 13 July 2015 12:27
Target OS: Linux
Domoticz version: 2021.1
Location: Bavaria - Germany
Contact:

Re: Specific sensor timeout

Post 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
Individual projects:
Domoticz on a Intel Xeon Server | AeonLabs Z-Wave Gen.5 | RFXCOM RFXtrx433E USB | ESP-Wifi-Modules | Shellys
Wall-mounted 22" Touch Control Display (self construct) | LUA wind monitor| LUA heating control | and many many more :)
GSV3Miac
Posts: 24
Joined: Sunday 05 February 2017 12:00
Target OS: Raspberry Pi / ODroid
Domoticz version: latest
Location: Shropshire UK
Contact:

Re: Specific sensor timeout

Post 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'.
tvurce
Posts: 30
Joined: Saturday 27 October 2018 19:12
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Specific sensor timeout

Post 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.
jeecee
Posts: 5
Joined: Tuesday 27 February 2018 13:46
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Specific sensor timeout

Post by jeecee »

Disregard.
It seems that text sensors do not timeout.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest