Specific sensor timeout

Topics (not sure which fora)
when not sure where to post, post here and mods will move it to right forum.
Post Reply
krizzz
Posts: 171
Joined: Wednesday 20 November 2013 21:36
Target OS: Linux
Domoticz version:
Location: The Netherlands
Contact:

Specific sensor timeout

Post by krizzz » Saturday 25 March 2017 11:45

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: 171
Joined: Wednesday 20 November 2013 21:36
Target OS: Linux
Domoticz version:
Location: The Netherlands
Contact:

Re: Specific sensor timeout

Post by krizzz » Tuesday 28 March 2017 22:05

No one has the same need for this? Interesting!

Nautilus
Posts: 780
Joined: Friday 02 October 2015 12:12
Target OS: Raspberry Pi
Domoticz version: beta
Location: Finland
Contact:

Re: Specific sensor timeout

Post by Nautilus » Tuesday 28 March 2017 22:15

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: 171
Joined: Wednesday 20 November 2013 21:36
Target OS: Linux
Domoticz version:
Location: The Netherlands
Contact:

Re: Specific sensor timeout

Post by krizzz » Tuesday 28 March 2017 22:17

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: 780
Joined: Friday 02 October 2015 12:12
Target OS: Raspberry Pi
Domoticz version: beta
Location: Finland
Contact:

Re: Specific sensor timeout

Post by Nautilus » Tuesday 28 March 2017 22:42

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: 20
Joined: Sunday 05 February 2017 13:00
Target OS: Windows
Domoticz version:
Contact:

Re: Specific sensor timeout

Post by GSV3Miac » 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).

User avatar
bewo
Posts: 42
Joined: Monday 13 July 2015 12:27
Target OS: Linux
Domoticz version: 4.10***
Location: Vilshofen - Bavaria - Germany
Contact:

Re: Specific sensor timeout

Post by bewo » Monday 29 October 2018 16:09

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
Wall-mounted iPad (self construct) | LUA wind monitor| LUA thermostat control | and many many more :)

GSV3Miac
Posts: 20
Joined: Sunday 05 February 2017 13:00
Target OS: Windows
Domoticz version:
Contact:

Re: Specific sensor timeout

Post by GSV3Miac » Monday 29 October 2018 17:14

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'.

Post Reply

Who is online

Users browsing this forum: No registered users and 5 guests