Page 1 of 1

otherdevices_temperature issue

Posted: Tuesday 13 March 2018 22:28
by IanDury
After about 2 months I decided to update to the latest beta (v3.9034). Everything works fine except my dzVents weather scripts that contain "otherdevices_temperature" shows the following error:

2018-03-13 22:15:00.548 dzVents: Info: ------ Start external script: weather_wu.lua:, trigger: function
2018-03-13 22:15:00.548 dzVents: Error (2.4.1): An error occured when calling event handler weather_wu
2018-03-13 22:15:00.548 dzVents: Error (2.4.1): /opt/domoticz/scripts/dzVents/scripts/weather_wu.lua:63: attempt to index global 'otherdevices_temperature' (a nil value)
2018-03-13 22:15:00.549 dzVents: Info: ------ Finished weather_wu.lua

Code snippet:

Code: Select all

    execute = function(domoticz)
        
      	local function CelciusToFarenheit(C)
	   return (C * (9/5)) + 32
	end

	Outside_Temp_Hum = 'Temperatuur Tuin'
        WU_URL = WU_URL .. "&tempf=" .. string.format("%3.1f", CelciusToFarenheit(otherdevices_temperature[Outside_Temp_Hum]))
	WU_URL = WU_URL .. "&humidity=" .. otherdevices_humidity[Outside_Temp_Hum]
	WU_URL = WU_URL .. "&dewptf=" .. string.format("%3.1f", CelciusToFarenheit(otherdevices_dewpoint[Outside_Temp_Hum]))
This used to work fine and besides upgrading I did not change the script. otherdevices_humidity and otherdevices_dewpoint don't have this issue.

Anybody else seeing this otherdevices_temperature issue?

Re: otherdevices_temperature issue

Posted: Tuesday 13 March 2018 22:52
by waaren
IanDury wrote: Tuesday 13 March 2018 22:28 After about 2 months I decided to update to the latest beta (v3.9034). Everything works fine except my dzVents weather scripts that contain "otherdevices_temperature" shows the following error:

2018-03-13 22:15:00.548 dzVents: Info: ------ Start external script: weather_wu.lua:, trigger: function
2018-03-13 22:15:00.548 dzVents: Error (2.4.1): An error occured when calling event handler weather_wu
2018-03-13 22:15:00.548 dzVents: Error (2.4.1): /opt/domoticz/scripts/dzVents/scripts/weather_wu.lua:63: attempt to index global 'otherdevices_temperature' (a nil value)
2018-03-13 22:15:00.549 dzVents: Info: ------ Finished weather_wu.lua


This used to work fine and besides upgrading I did not change the script. otherdevices_humidity and otherdevices_dewpoint don't have this issue.

Anybody else seeing this otherdevices_temperature issue?
Happy to help but can you please update / edit your post with the complete script ? Reason is that I do not recognize otherdevices_temperature as being standard lua or dzVents so I expect that they are defined elsewhere in the script.

Re: otherdevices_temperature issue

Posted: Tuesday 13 March 2018 23:04
by IanDury
otherdevices_temperature is part of the Domoticz Events and not defined in my script.
See: https://www.domoticz.com/wiki/Events

Re: otherdevices_temperature issue

Posted: Tuesday 13 March 2018 23:16
by waaren
OK.

if your change your WU_URL = WU_URL .. lines to the dzVents syntax this part of your script should work again.

Code: Select all

WU_URL = WU_URL .. "&tempf=" .. string.format("%3.1f", CelciusToFarenheit(domoticz.devices(Outside_Temp_Hum).temperature))
WU_URL = WU_URL .. "&humidity=" .. domoticz.devices(Outside_Temp_Hum).humidity
WU_URL = WU_URL .. "&dewptf=" .. string.format("%3.1f", CelciusToFarenheit(domoticz.devices(Outside_Temp_Hum).dewPoint))

Re: otherdevices_temperature issue

Posted: Wednesday 14 March 2018 8:54
by dannybloe
otherdevices_* is not available (and certainly not needed) in dzVents scripts.

Re: otherdevices_temperature issue

Posted: Wednesday 14 March 2018 18:07
by IanDury
@waaren
Thanks for the port. I will try this and report the results to this topic later this week. I realize I should review my scripts and change the API to dzVents API where applicable.

@dannyblue
Apparantly this must have changed then in the last 2 months. It works fine in beta V3.8806 that I installed last January:

2018-03-14 17:45:00.236 dzVents: Info: ------ Start external script: weather_wu.lua:, trigger: function
2018-03-14 17:45:00.251 dzVents: Info: ------ Finished weather_wu.lua

However, I alsno noticed that a "make install" does not copy/install the domoticz/dzVents directory to the installation tree so I might have used an even older version of dzVents.

Re: otherdevices_temperature issue

Posted: Wednesday 14 March 2018 18:36
by dannybloe
Yup. It was removed in 2.4.0. It was silly that it was there in the first place. It has no place in dzVents.

Re: otherdevices_temperature issue

Posted: Thursday 15 March 2018 17:59
by IanDury
Works great with the dzVents API.

Thanks!