Page 1 of 1

youless_device.lua:19: attempt to perform arithmetic on a nil value

Posted: Tuesday 31 July 2018 11:58
by barbaar
Using latest Domoticz Beta:

Moving from lua to dzvents. Just created my first script (see below for full script).

After setting the script to active, my log is flooded with the error below:

Code: Select all

2018-07-31 11:53:50.380 Error: EventSystem: in /home/pi/domoticz/dzVents/runtime/dzVents.lua: ...oticz/dzVents/runtime/device-adapters/youless_device.lua:19: attempt to perform arithmetic on a nil value
Current first (and only) script:

Code: Select all

return {
    on = {
	timer = {'45 minutes after sunset'}
	       },
	execute = function(domoticz)
		domoticz.log('Gordijnen beneden sluiten', domoticz.LOG_INFO)
		local gordijnenVoorkamer = domoticz.devices("Gordijnen Voorkamer")
		local gordijnenAchterkamer = domoticz.devices("Gordijnen Achterkamer")
		gordijnenAchterkamer.switchOn().checkFirst().forMin(5)
		gordijnenVoorkamer.switchOn().checkFirst().forMin(5)
	end
}

Re: youless_device.lua:19: attempt to perform arithmetic on a nil value

Posted: Tuesday 31 July 2018 12:58
by waaren
barbaar wrote: Tuesday 31 July 2018 11:58 After setting the script to active, my log is flooded with the error below:
Spoiler: show

Code: Select all

2018-07-31 11:53:50.380 Error: EventSystem: in /home/pi/domoticz/dzVents/runtime/dzVents.lua: ...oticz/dzVents/runtime/device-adapters/youless_device.lua:19: attempt to perform arithmetic on a nil value
Current first (and only) script:

Code: Select all

return {
    on = {
	timer = {'45 minutes after sunset'}
	       },
	execute = function(domoticz)
		domoticz.log('Gordijnen beneden sluiten', domoticz.LOG_INFO)
		local gordijnenVoorkamer = domoticz.devices("Gordijnen Voorkamer")
		local gordijnenAchterkamer = domoticz.devices("Gordijnen Achterkamer")
		gordijnenAchterkamer.switchOn().checkFirst().forMin(5)
		gordijnenVoorkamer.switchOn().checkFirst().forMin(5)
	end
}
I do not see anything in this script that could trigger this device-adapter.

Do you have more scripts in the ..oticz/scripts/dzVents/scripts/ or ..oticz/scripts/dzVents/generated-scripts/ directories ?
Can you do a cat of ...oticz/dzVents/runtime/device-adapters/youless_device.lua ?
Anything else in the logs ?
Do you have a Youless device configured in domoticz ?

Re: youless_device.lua:19: attempt to perform arithmetic on a nil value

Posted: Tuesday 31 July 2018 13:13
by barbaar
waaren wrote: Tuesday 31 July 2018 12:58 I do not see anything in this script that could trigger this device-adapter.

Do you have more scripts in the ..oticz/scripts/dzVents/scripts/ or ..oticz/scripts/dzVents/generated-scripts/ directories ?
Nope!
Can you do a cat of ...oticz/dzVents/runtime/device-adapters/youless_device.lua ?
This is line 19:

Code: Select all

device.counterDeliveredToday = tonumber((string.gsub(device.counnterToday, "kWh", ""))) * 1000
Note the typo in counnter (could be a problem with my current terminal, please check)
Anything else in the logs ?
Nope!
Do you have a Youless device configured in domoticz ?
Yes, I have two. And both are not measuring anything (the tape doesn't stick :( ). I think this is the problem, as device.counter is probably not filled (or should be 0)

Re: youless_device.lua:19: attempt to perform arithmetic on a nil value

Posted: Tuesday 31 July 2018 13:22
by waaren
barbaar wrote: Tuesday 31 July 2018 13:13
waaren wrote: Tuesday 31 July 2018 12:58
Spoiler: show
I do not see anything in this script that could trigger this device-adapter.

Do you have more scripts in the ..oticz/scripts/dzVents/scripts/ or ..oticz/scripts/dzVents/generated-scripts/ directories ?
Nope!
Can you do a cat of ...oticz/dzVents/runtime/device-adapters/youless_device.lua ?
[/spoiler]
This is line 19:

Code: Select all

device.counterDeliveredToday = tonumber((string.gsub(device.counnterToday, "kWh", ""))) * 1000
Note the typo in counnter (could be a problem with my current terminal, please check)
Spoiler: show
Anything else in the logs ?
Nope!
Do you have a Youless device configured in domoticz ?
Yes, I have two. And both are not measuring anything (the tape doesn't stick :( ). I think this is the problem, as device.counter is probably not filled (or should be 0)[/spoiler]
my line 19:

device.counterDeliveredToday = tonumber((string.gsub(device.counterToday, "kWh", ""))) * 1000

so there is an extra n in your line 19. Likely that this is causing the errors in your log.

Re: youless_device.lua:19: attempt to perform arithmetic on a nil value

Posted: Tuesday 31 July 2018 13:31
by barbaar
just checked. Currently, I have to use a websocket-connection via Unifi to SSH to my Domoticz-box. The typo was a terminal issue...

So still not solved :(

Re: youless_device.lua:19: attempt to perform arithmetic on a nil value

Posted: Tuesday 31 July 2018 17:45
by waaren
barbaar wrote: Tuesday 31 July 2018 13:31 just checked. Currently, I have to use a websocket-connection via Unifi to SSH to my Domoticz-box. The typo was a terminal issue...

So still not solved :(
If you add the line

Code: Select all

device.dump() 
just before the failing codeline and remove it directly after you see at least one dump in the log, it will give us some more info to work with.
Other option is to set the youless devices inactive on the devices tab until you re attached them. (I use tiewraps to firmly couple the Youless to my meter)

Re: youless_device.lua:19: attempt to perform arithmetic on a nil value

Posted: Tuesday 31 July 2018 23:11
by barbaar
Sure!

Code: Select all

2018-07-31 23:08:25.096 Status: dzVents: > switchOn()
2018-07-31 23:08:25.097 Status: dzVents: > lastUpdate:
2018-07-31 23:08:25.097 Status: dzVents: > week: 31
2018-07-31 23:08:25.097 Status: dzVents: > ruleIsAfterSunset()
2018-07-31 23:08:25.097 Status: dzVents: > raw: 2018-07-31 23:08:14
2018-07-31 23:08:25.097 Status: dzVents: > ruleIsBeforeSunrise()
2018-07-31 23:08:25.097 Status: dzVents: > minutes: 8
2018-07-31 23:08:25.097 Status: dzVents: > minutesAgo: 0
2018-07-31 23:08:25.097 Status: dzVents: > millisecondsAgo: 11013
2018-07-31 23:08:25.097 Status: dzVents: > yday: 212
2018-07-31 23:08:25.097 Status: dzVents: > milliseconds: 0
2018-07-31 23:08:25.097 Status: dzVents: > dDate: 1533071294
2018-07-31 23:08:25.097 Status: dzVents: > wday: 3
2018-07-31 23:08:25.097 Status: dzVents: > utils:
2018-07-31 23:08:25.097 Status: dzVents: > LOG_DEBUG: 4
2018-07-31 23:08:25.097 Status: dzVents: > log()
2018-07-31 23:08:25.097 Status: dzVents: > osExecute()
2018-07-31 23:08:25.097 Status: dzVents: > LOG_ERROR: 1
2018-07-31 23:08:25.097 Status: dzVents: > print()
2018-07-31 23:08:25.097 Status: dzVents: > fileExists()
2018-07-31 23:08:25.097 Status: dzVents: > LOG_MODULE_EXEC_INFO: 2
2018-07-31 23:08:25.097 Status: dzVents: > urlEncode()
2018-07-31 23:08:25.097 Status: dzVents: > toJSON()
2018-07-31 23:08:25.097 Status: dzVents: > fromJSON()
2018-07-31 23:08:25.097 Status: dzVents: > rgbToHSB()
2018-07-31 23:08:25.097 Status: dzVents: > LOG_FORCE: 0.5
2018-07-31 23:08:25.097 Status: dzVents: > LOG_INFO: 3
2018-07-31 23:08:25.097 Status: dzVents: > min: 8
2018-07-31 23:08:25.097 Status: dzVents: > isToday: true
2018-07-31 23:08:25.097 Status: dzVents: > rawTime: 23:08:14
2018-07-31 23:08:25.097 Status: dzVents: > ruleMatchesTime()
2018-07-31 23:08:25.097 Status: dzVents: > dayAbbrOfWeek: tue
2018-07-31 23:08:25.097 Status: dzVents: > secondsSinceMidnight: 83294
2018-07-31 23:08:25.097 Status: dzVents: > ruleIsOnDate()
2018-07-31 23:08:25.097 Status: dzVents: > ruleIsAtNight()
2018-07-31 23:08:25.097 Status: dzVents: > day: 31
2018-07-31 23:08:25.098 Status: dzVents: > msAgo: 11013
2018-07-31 23:08:25.098 Status: dzVents: > ruleIsAtSunrise()
2018-07-31 23:08:25.098 Status: dzVents: > ruleIsAtSunset()
2018-07-31 23:08:25.098 Status: dzVents: > hour: 23
2018-07-31 23:08:25.098 Status: dzVents: > ruleMatchesHourSpecification()
2018-07-31 23:08:25.098 Status: dzVents: > compare()
2018-07-31 23:08:25.098 Status: dzVents: > ruleMatchesMinuteSpecification()
2018-07-31 23:08:25.098 Status: dzVents: > isdst: true
2018-07-31 23:08:25.098 Status: dzVents: > ruleIsOnDay()
2018-07-31 23:08:25.098 Status: dzVents: > ruleIsAtDayTime()
2018-07-31 23:08:25.098 Status: dzVents: > rawDate: 2018-07-31
2018-07-31 23:08:25.098 Status: dzVents: > secondsAgo: 11
2018-07-31 23:08:25.098 Status: dzVents: > matchesRule()
2018-07-31 23:08:25.098 Status: dzVents: > milliSeconds: 0
2018-07-31 23:08:25.098 Status: dzVents: > ruleIsBeforeSunset()
2018-07-31 23:08:25.098 Status: dzVents: > ruleIsAfterSunrise()
2018-07-31 23:08:25.098 Status: dzVents: > ruleIsInWeek()
2018-07-31 23:08:25.098 Status: dzVents: > year: 2018
2018-07-31 23:08:25.098 Status: dzVents: > month: 7
2018-07-31 23:08:25.098 Status: dzVents: > ruleMatchesTimeRange()
2018-07-31 23:08:25.098 Status: dzVents: > ruleMatchesBetweenRange()
2018-07-31 23:08:25.098 Status: dzVents: > sec: 14
2018-07-31 23:08:25.098 Status: dzVents: > seconds: 14
2018-07-31 23:08:25.098 Status: dzVents: > current:
2018-07-31 23:08:25.098 Status: dzVents: > day: 31
2018-07-31 23:08:25.098 Status: dzVents: > year: 2018
2018-07-31 23:08:25.098 Status: dzVents: > hour: 23
2018-07-31 23:08:25.098 Status: dzVents: > min: 8
2018-07-31 23:08:25.098 Status: dzVents: > sec: 25
2018-07-31 23:08:25.098 Status: dzVents: > isdst: true
2018-07-31 23:08:25.098 Status: dzVents: > yday: 212
2018-07-31 23:08:25.098 Status: dzVents: > month: 7
2018-07-31 23:08:25.098 Status: dzVents: > wday: 3
2018-07-31 23:08:25.098 Status: dzVents: > hoursAgo: 0
2018-07-31 23:08:25.099 Status: dzVents: > getISO()
2018-07-31 23:08:25.099 Status: dzVents: > daysAgo: 0
2018-07-31 23:08:25.099 Status: dzVents: > isUTC: false
2018-07-31 23:08:25.099 Status: dzVents: > usage: 0 m3
2018-07-31 23:08:25.099 Status: dzVents: > changed: true
2018-07-31 23:08:25.099 Status: dzVents: > pause()
2018-07-31 23:08:25.099 Status: dzVents: > rawData:
2018-07-31 23:08:25.099 Status: dzVents: > 1: 26047300
2018-07-31 23:08:25.099 Status: dzVents: > 2: 0
2018-07-31 23:08:25.099 Status: dzVents: > hardwareId: 21
2018-07-31 23:08:25.099 Status: dzVents: > decreaseBrightness()
2018-07-31 23:08:25.099 Status: dzVents: > active: false
2018-07-31 23:08:25.099 Status: dzVents: > updateWetness()
2018-07-31 23:08:25.099 Status: dzVents: > description:
2018-07-31 23:08:25.099 Status: dzVents: > isHTTPResponse: false
2018-07-31 23:08:25.099 Status: dzVents: > setNightMode()
2018-07-31 23:08:25.099 Status: dzVents: > updateCustomSensor()
2018-07-31 23:08:25.099 Status: dzVents: > updateGas()
2018-07-31 23:08:25.099 Status: dzVents: > switchType: Doorbell
2018-07-31 23:08:25.099 Status: dzVents: > isSecurity: false
2018-07-31 23:08:25.099 Status: dzVents: > baseType: device
2018-07-31 23:08:25.099 Status: dzVents: > updateSoundLevel()
2018-07-31 23:08:25.099 Status: dzVents: > isGroup: false
2018-07-31 23:08:25.099 Status: dzVents: > bState: false
2018-07-31 23:08:25.099 Error: EventSystem: in /home/pi/domoticz/dzVents/runtime/dzVents.lua: ...oticz/dzVents/runtime/device-adapters/youless_device.lua:20: attempt to perform arithmetic on a nil value
2018-07-31 23:08:35.105 Status: dzVents: > min: 8
2018-07-31 23:08:35.105 Status: dzVents: > millisecondsAgo: 10021
2018-07-31 23:08:35.105 Status: dzVents: > ruleIsOnDay()
2018-07-31 23:08:35.105 Status: dzVents: > rawTime: 23:08:25
2018-07-31 23:08:35.105 Status: dzVents: > utils:
2018-07-31 23:08:35.105 Status: dzVents: > fromJSON()
2018-07-31 23:08:35.105 Status: dzVents: > osExecute()
2018-07-31 23:08:35.105 Status: dzVents: > LOG_DEBUG: 4
2018-07-31 23:08:35.105 Status: dzVents: > LOG_MODULE_EXEC_INFO: 2
2018-07-31 23:08:35.105 Status: dzVents: > rgbToHSB()
2018-07-31 23:08:35.105 Status: dzVents: > toJSON()
2018-07-31 23:08:35.105 Status: dzVents: > print()
2018-07-31 23:08:35.105 Status: dzVents: > log()
2018-07-31 23:08:35.105 Status: dzVents: > LOG_FORCE: 0.5
2018-07-31 23:08:35.105 Status: dzVents: > LOG_ERROR: 1
2018-07-31 23:08:35.105 Status: dzVents: > urlEncode()
2018-07-31 23:08:35.105 Status: dzVents: > LOG_INFO: 3
2018-07-31 23:08:35.105 Status: dzVents: > fileExists()
2018-07-31 23:08:35.105 Status: dzVents: > secondsSinceMidnight: 83305
2018-07-31 23:08:35.105 Status: dzVents: > updateAirQuality()
2018-07-31 23:08:35.105 Status: dzVents: > switchOn()
2018-07-31 23:08:35.105 Status: dzVents: > updateSoilMoisture()
2018-07-31 23:08:35.105 Status: dzVents: > _nValue: 0
2018-07-31 23:08:35.105 Status: dzVents: > updateRain()
2018-07-31 23:08:35.105 Status: dzVents: > updateCustomSensor()
2018-07-31 23:08:35.105 Status: dzVents: > setRGB()
2018-07-31 23:08:35.105 Status: dzVents: > _adapters:
2018-07-31 23:08:35.106 Status: dzVents: > setDiscoMode()
2018-07-31 23:08:35.106 Status: dzVents: > armAway()
2018-07-31 23:08:35.106 Status: dzVents: > setNightMode()
2018-07-31 23:08:35.106 Status: dzVents: > baseType: device
2018-07-31 23:08:35.106 Status: dzVents: > playFavorites()
2018-07-31 23:08:35.106 Status: dzVents: > startPlaylist()
2018-07-31 23:08:35.106 Status: dzVents: > _data:
2018-07-31 23:08:35.106 Status: dzVents: > lastUpdate: 2018-07-31 23:08:25
2018-07-31 23:08:35.106 Status: dzVents: > deviceType: YouLess Meter
2018-07-31 23:08:35.106 Status: dzVents: > subType: YouLess counter
2018-07-31 23:08:35.106 Status: dzVents: > switchTypeValue: 1
2018-07-31 23:08:35.106 Status: dzVents: > deviceID: 80
2018-07-31 23:08:35.106 Status: dzVents: > signalLevel: 12
2018-07-31 23:08:35.106 Status: dzVents: > id: 527
2018-07-31 23:08:35.106 Status: dzVents: > rawData:
2018-07-31 23:08:35.106 Status: dzVents: > 1: 26047300
2018-07-31 23:08:35.106 Status: dzVents: > 2: 0
2018-07-31 23:08:35.106 Status: dzVents: > changed: true
2018-07-31 23:08:35.106 Status: dzVents: > description:
2018-07-31 23:08:35.106 Status: dzVents: > lastLevel: 0
2018-07-31 23:08:35.106 Status: dzVents: > name: Youless Gas
2018-07-31 23:08:35.106 Status: dzVents: > switchType: Doorbell
2018-07-31 23:08:35.106 Status: dzVents: > data:
2018-07-31 23:08:35.106 Status: dzVents: > valueQuantity:
2018-07-31 23:08:35.106 Status: dzVents: > counterToday: 0 m3
2018-07-31 23:08:35.106 Status: dzVents: > hardwareType: YouLess Meter with LAN interface
2018-07-31 23:08:35.106 Status: dzVents: > valueUnits:
2018-07-31 23:08:35.106 Status: dzVents: > _nValue: 0
2018-07-31 23:08:35.106 Status: dzVents: > hardwareID: 21
2018-07-31 23:08:35.106 Status: dzVents: > icon: counter
2018-07-31 23:08:35.106 Status: dzVents: > protected: false
2018-07-31 23:08:35.106 Status: dzVents: > unit: 1
2018-07-31 23:08:35.106 Status: dzVents: > hardwareName: YouLess Gas
2018-07-31 23:08:35.106 Status: dzVents: > usage: 0 m3
2018-07-31 23:08:35.106 Status: dzVents: > counter: 260473.000
2018-07-31 23:08:35.106 Status: dzVents: > hardwareTypeValue: 6
2018-07-31 23:08:35.106 Status: dzVents: > _state: 26047300;0
2018-07-31 23:08:35.107 Status: dzVents: > baseType: device
2018-07-31 23:08:35.107 Status: dzVents: > timedOut: false
2018-07-31 23:08:35.107 Status: dzVents: > batteryLevel: 255
2018-07-31 23:08:35.107 Status: dzVents: > increaseBrightness()
2018-07-31 23:08:35.107 Status: dzVents: > updateRadiation()
2018-07-31 23:08:35.107 Status: dzVents: > idx: 527
2018-07-31 23:08:35.107 Status: dzVents: > updatePressure()
2018-07-31 23:08:35.107 Status: dzVents: > setVolume()
2018-07-31 23:08:35.107 Status: dzVents: > updateTemperature()
2018-07-31 23:08:35.107 Status: dzVents: > hardwareID: 21
2018-07-31 23:08:35.107 Status: dzVents: > description:
2018-07-31 23:08:35.107 Status: dzVents: > dump()
2018-07-31 23:08:35.107 Status: dzVents: > isTimer: false
2018-07-31 23:08:35.107 Status: dzVents: > stop()
2018-07-31 23:08:35.107 Status: dzVents: > decreaseBrightness()
2018-07-31 23:08:35.107 Status: dzVents: > updatePercentage()
2018-07-31 23:08:35.107 Status: dzVents: > isVariable: false
2018-07-31 23:08:35.107 Status: dzVents: > setState()
2018-07-31 23:08:35.107 Status: dzVents: > updateWetness()
2018-07-31 23:08:35.107 Status: dzVents: > cancelQueuedCommands()
2018-07-31 23:08:35.107 Status: dzVents: > hardwareType: YouLess Meter with LAN interface
2018-07-31 23:08:35.107 Status: dzVents: > updateHumidity()
2018-07-31 23:08:35.107 Status: dzVents: > deviceId: 80
2018-07-31 23:08:35.107 Status: dzVents: > nValue: 0
2018-07-31 23:08:35.107 Status: dzVents: > updateDistance()
2018-07-31 23:08:35.107 Status: dzVents: > updateTempHum()
2018-07-31 23:08:35.107 Status: dzVents: > update()
2018-07-31 23:08:35.107 Status: dzVents: > usage: 0 m3
2018-07-31 23:08:35.107 Status: dzVents: > open()
2018-07-31 23:08:35.107 Status: dzVents: > kodiPlayFavorites()
2018-07-31 23:08:35.107 Status: dzVents: > counterToday: 0 m3
2018-07-31 23:08:35.107 Status: dzVents: > rawData:
2018-07-31 23:08:35.107 Status: dzVents: > 1: 26047300
2018-07-31 23:08:35.107 Status: dzVents: > 2: 0
2018-07-31 23:08:35.107 Status: dzVents: > hardwareTypeValue: 6
2018-07-31 23:08:35.107 Status: dzVents: > state: 26047300;0
2018-07-31 23:08:35.107 Error: EventSystem: in /home/pi/domoticz/dzVents/runtime/dzVents.lua: ...oticz/dzVents/runtime/device-adapters/youless_device.lua:20: attempt to perform arithmetic on a nil value
Edit:
Just disabled the Youless that is running the firmware to read my Gas meter. That solves the problem

Edit 2:
Link to the firmware
http://www.youless.nl/tl_files/download ... 2.0-G4.exe

Re: youless_device.lua:19: attempt to perform arithmetic on a nil value

Posted: Wednesday 01 August 2018 1:30
by waaren
barbaar wrote: Tuesday 31 July 2018 23:11
Just disabled the Youless that is running the firmware to read my Gas meter. That solves the problem
@barbaar thx.

This problem is caused by the device-adapter code for the youless meter. When it was created I was not aware of a youless meter for gas which is reported in m3.

If line 19

Code: Select all

device.counterDeliveredToday = tonumber((string.gsub(device.counterToday, "kWh", ""))) * 1000 
is replaced by

Code: Select all

device.counterDeliveredToday = tonumber((string.match(device.counterToday, "%d+"))) * 1000
the error should not occur anymore.
The updated code will not change the results for a kWh meter and will also report values for a youless gas meter. I am not 100% sure it will report the gas values correctly. It might just be the case that something has te be done with the correct location of the decimal point.

Can you please check and reply ? Would be very helpfull

Until this update is implemented on github, the modified device-adapter will be overwritten by every beta version update, so my advice is to make an extra copy of the file and use that after you do a domoticz version update.

Re: youless_device.lua:19: attempt to perform arithmetic on a nil value

Posted: Wednesday 01 August 2018 17:37
by barbaar
Checked and no error occurs!

Thanks!

Re: youless_device.lua:19: attempt to perform arithmetic on a nil value

Posted: Wednesday 01 August 2018 20:47
by waaren
barbaar wrote: Wednesday 01 August 2018 17:37 Checked and no error occurs!

Thanks!
Thx for testing.

Small problem with this line is that you loose the decimals. Can you please test both youless devices (gas and power) with
this line ? I tested for power and that one seem to be OK now.

Code: Select all

device.counterDeliveredToday = string.match(device.counterToday, "%d+.%d+") * 1000

Re: youless_device.lua:19: attempt to perform arithmetic on a nil value

Posted: Wednesday 01 August 2018 23:06
by barbaar
No, the initial error returns..

Code: Select all

2018-08-01 23:04:56.185 Error: EventSystem: in /home/pi/domoticz/dzVents/runtime/dzVents.lua: ...oticz/dzVents/runtime/device-adapters/youless_device.lua:19: attempt to perform arithmetic on a nil value

Re: youless_device.lua:19: attempt to perform arithmetic on a nil value

Posted: Thursday 02 August 2018 7:28
by waaren
barbaar wrote: Wednesday 01 August 2018 23:06 No, the initial error returns..


2018-08-01 23:04:56.185 Error: EventSystem: in /home/pi/domoticz/dzVents/runtime/dzVents.lua: ...oticz/dzVents/runtime/device-adapters/youless_device.lua:19: attempt to perform arithmetic on a nil value
Again thx for testing. I assume your gasmeter is still 0 and that is not handled correctly in the line I sent you.
Can you please replace the previous sent line with this one ?

Code: Select all

device.counterDeliveredToday = string.match(device.counterToday, "%d+.%d*") * 1000
also do you know if there could be a situation where the youless returns a negative value ?

Re: youless_device.lua:19: attempt to perform arithmetic on a nil value

Posted: Thursday 02 August 2018 21:41
by barbaar
Works!

A Youless should never return a negative value. Or at least, I have never seen one ;)

Re: youless_device.lua:19: attempt to perform arithmetic on a nil value

Posted: Thursday 02 August 2018 23:04
by waaren
barbaar wrote: Thursday 02 August 2018 21:41 Works!

A Youless should never return a negative value. Or at least, I have never seen one ;)
Thx for your testing and reply.

Re: youless_device.lua:19: attempt to perform arithmetic on a nil value

Posted: Wednesday 05 September 2018 20:56
by barbaar
The error returned after upgrading Domoticz to the latest beta (4.9961). Replacing line 19 with the one no longer works :(

Code: Select all

2018-09-05 20:54:59.604 Error: EventSystem: in /home/pi/domoticz/dzVents/runtime/dzVents.lua: ...oticz/dzVents/runtime/device-adapters/youless_device.lua:19: attempt to perform arithmetic on a nil value

Re: youless_device.lua:19: attempt to perform arithmetic on a nil value  [SOLVED]

Posted: Wednesday 05 September 2018 23:48
by waaren
barbaar wrote: Wednesday 05 September 2018 20:56 The error returned after upgrading Domoticz to the latest beta (4.9961). Replacing line 19 with the one no longer works :(

Code: Select all

2018-09-05 20:54:59.604 Error: EventSystem: in /home/pi/domoticz/dzVents/runtime/dzVents.lua: ...oticz/dzVents/runtime/device-adapters/youless_device.lua:19: attempt to perform arithmetic on a nil value
As far as I can see nothing has changed in the device-adapter area but can you try this line 19 ? It should prevent the error

Code: Select all

counterDeliveredToday = (string.match(counterToday, "%d+.%d*") or 0) * 1000