otherdevices_temperature issue

Easy to use, 100% Lua-based event scripting framework.

Moderator: leecollings

Post Reply
IanDury
Posts: 50
Joined: Wednesday 08 April 2015 15:22
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

otherdevices_temperature issue

Post 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?
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: otherdevices_temperature issue

Post 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.
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
IanDury
Posts: 50
Joined: Wednesday 08 April 2015 15:22
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: otherdevices_temperature issue

Post by IanDury »

otherdevices_temperature is part of the Domoticz Events and not defined in my script.
See: https://www.domoticz.com/wiki/Events
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: otherdevices_temperature issue

Post 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))
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
dannybloe
Posts: 1355
Joined: Friday 29 August 2014 11:26
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Ermelo
Contact:

Re: otherdevices_temperature issue

Post by dannybloe »

otherdevices_* is not available (and certainly not needed) in dzVents scripts.
Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.
IanDury
Posts: 50
Joined: Wednesday 08 April 2015 15:22
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: otherdevices_temperature issue

Post 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.
dannybloe
Posts: 1355
Joined: Friday 29 August 2014 11:26
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Ermelo
Contact:

Re: otherdevices_temperature issue

Post 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.
Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.
IanDury
Posts: 50
Joined: Wednesday 08 April 2015 15:22
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: otherdevices_temperature issue

Post by IanDury »

Works great with the dzVents API.

Thanks!
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 1 guest