Custom Sensors and Data Push

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
kevster
Posts: 26
Joined: Tuesday 06 December 2016 23:14
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: UK
Contact:

Custom Sensors and Data Push

Post by kevster »

I couldn't really find anything about this.

I recently have started exporting sensor data to influxdb so I can do deep analitics over longer periods of time than the native domo store.

I use quite a lot of custom sensors on my deployment (for level checks, percentages etc) and so I would like their values to be logged in Influx.

However data from the custom sensors does not appear to be pushed to Influx. Does anyone know why ?

Questions:
1) On data export what is 'direct' supposed to do ?
2) Should this work ?

Someone recently fixed the custom sensors working with notifications which I am so greatful for. Is this something else that does not work with custom sensors ?

If this is the wrong forum subject can a mod please put in the correct one :)

Thanks
Last edited by kevster on Monday 08 July 2019 22:08, edited 1 time in total.
rrozema
Posts: 470
Joined: Thursday 26 October 2017 13:37
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Delft
Contact:

Re: Custom Sensors and Data Push

Post by rrozema »

According to the wiki on HttpLink sensor values written to a custom sensor using the UpdateDevice method are not forwarded into a DataPush, so in this case not into influxdb. The wiki suggests to change the script setting the sensor's value to use the json API instead of UpdateDevice.

So this appears to be documented behaviour, but this leaves me with 3 questions:
  • Why do custom sensors have to behave differently than standard sensors with regards to DataPush?
  • how do I change this dzVents script into "using the json API"?

    Code: Select all

    local TEMPHUM_DEVICE_NAME = '*: TempHum'
    
    return {
    	on = {
    		devices = {
    			TEMPHUM_DEVICE_NAME
    		}
    	},
    	execute = function(domoticz, device)
    		local device_name = string.sub( device.name, 1, string.len(device.name) - 9) .. ': Humidity'
    		local hum_device = domoticz.devices(device_name)
    
    		if nil ~= hum_device then
        	    local dampDruk
        	    if device.temperature >= 0 then
        	        dampDruk = (6.1078 * math.exp( math.log(10) * ((7.5 * device.temperature) / (237.3 + device.temperature)) ) );
        	    else
        	        dampDruk = (6.1078 * math.exp( math.log(10) * ((7.6 * device.temperature) / (240.7 + device.temperature)) ) );
        	    end
        	    
        		local absolute_humidity = math.floor(1000.0 * math.exp(math.log(10) * 5) * 18.016 / 8314.3 * (device.humidity / 100.0 * dampDruk) / (device.temperature + 273.15) + 0.5) / 1000.0
        		
        		hum_device.updateCustomSensor(tostring(absolute_humidity))
        	end
    	end
    }
  • How do I make my custom sensor values go into influxdb if my cusyom device is not shown in the list of devices available for logging into influxdb?
    influxdb device selection.JPG
    influxdb device selection.JPG (27.97 KiB) Viewed 769 times
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest