Page 1 of 1

Update an device Kelvin -> Celsius -> crash

Posted: Wednesday 12 February 2025 13:59
by niki_lauda
I'm trying to write a lua script and its crashing domoticz.

What am I doing wrong?

Code: Select all

The  log 
2025-02-12 13:51:01.311 Status: LUA: 281.15
2025-02-12 13:51:01.311 Status: LUA: 8.15
2025-02-12 13:51:01.311 Status: LUA: 8.0
2025-02-12 13:51:01.311 Status: LUA: Temp8.0
2025-02-12 13:51:01.312 Error: Domoticz(pid:2948081, tid:2977392('luaThread')) received fatal signal 6 (Aborted)
2025-02-12 13:51:01.312 Error: siginfo address=0x2cfbf1, address=0x7f81f609fc 
The LUA

Code: Select all

commandArray = {}

	print( tonumber(otherdevices['Batterij in Kelvin']))
	print( tonumber(otherdevices['Batterij in Kelvin']) -273)
 	temp = tostring( tonumber(otherdevices['Batterij in Kelvin']) -273.15)
 	print (temp)
	commandArray['UpdateDevice'] = {'3012|0|'.. tostring(temp)}
 	print ('Temp'  ..temp)
return commandArray

Found the culprit if you use commandArray['UpdateDevice'] ={3012|0|'.. tostring(temp)}
Domoticz crashes.
You should use commandArray['UpdateDevice'] = '3012|0|'.. tostring(temp)

Re: Update an device Kelvin -> Celsius

Posted: Wednesday 12 February 2025 14:44
by waltervl
Moved to Lua forum.
Sorry I cannot help you, I only use dzvents...