[LUA] devicechanged problem for temp sensors ? Topic is solved

Please use template to report bugs and problems. Post here your questions when not sure where else to post
Only for bugs in the Domoticz application! other problems go in different subforums!

Moderators: leecollings, remb0

Forum rules
Before posting here, make sure you are on the latest Beta or Stable version.
If you have problems related to the web gui, clear your browser cache + appcache first.

Use the following template when posting here:

Version: xxxx
Platform: xxxx
Plugin/Hardware: xxxx
Description:
.....

If you are having problems with scripts/blockly, always post the script (in a spoiler or code tag) or screenshots of your blockly

If you are replying, please do not quote images/code from the first post

Please mark your topic as Solved when the problem is solved.
Post Reply
zicht
Posts: 308
Joined: Sunday 11 May 2014 11:09
Target OS: Windows
Domoticz version: 2023.1+
Location: NL
Contact:

[LUA] devicechanged problem for temp sensors ?

Post by zicht »

v2026.2 (build 18013)
Build Hash
39bcec5d1
Compile Date
2026-06-07 09:48:18

it seems like a change in temperature sensor value does not trigger devicechanged anymore


How to test ?
log:
RFXCOM: Temp + Humidity + Baro (Binnen)
test :

Code: Select all

if devicechanged["Binnen"] then print("Binnen") print(otherdevices_lastupdate["Binnen"])
the above code does not print in 2026.2, no print "Binnen" + no print of lastupdate time.
Usercases :
1. I used to have actions on temp change (run temperature code only if there is new data just to keep domoticz lean and fast)
2. do some checks for validation on lastupdate (to avoid using old values)
3. i used a temp sensor in vehicles to detect if they are home or not. (flank up/flank down weight in prensence script)

Is this intentional or a bug ?
Rpi & Win x64. Using : cam's,RFXCom, LaCrosse, RFY, HuE, google, standard Lua, Tasker, Waze traveltime, NLAlert&grip2+,curtains, vacuum, audioreceiver, smart-heating&cooling + many more (= automate all repetitive simple tasks)
User avatar
waltervl
Posts: 7021
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2026.3
Location: NL
Contact:

Re: devicechanged problem for temp sensors ?

Post by waltervl »

Lua, right?
If you do the same in dzvents do you see the same issue?
From what version did you upgrade? As there is a change already for some time that a sensor value is logged only when it is different from the previous value.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
zicht
Posts: 308
Joined: Sunday 11 May 2014 11:09
Target OS: Windows
Domoticz version: 2023.1+
Location: NL
Contact:

Re: devicechanged problem for temp sensors ?

Post by zicht »

From what version did you upgrade? As there is a change already for some time that a sensor value is logged only when it is different from the previous value.
Thanks for the very fast reply !

I am aware of that change. But the problem is it is also not triggeren on an actual change.

I went from 2025_2.17001 --> 2026.1 stable --> 2026.2 beta
and noticed after 2026.2 beta some ux change.

Will try dzevents later today when i am at home.

Extra info :
Yeah lua its to much work to convert, i tried with chat gpt but that turned out to be a mess with scripts over 5000 lua lines.
Why so much lines ? Because i dont do "if this then that" but create contex rules and the make a decision on what to adjust based on the outcom and weight of the context values. (So i do not plain automation but create a context awareness and that uses devicechanged[] a lot.)

Eventualy i need to convertto dzevents, but that needs some free/spare time what i dont have at the moment.

I can circumvent the problem by making a uservar and compaire to that, This way i can get a lastupdate again to work with
But that is fixing something that not should be needed in my optinion.
Semantic it says devicechanged so when it changes it should trigger.
Rpi & Win x64. Using : cam's,RFXCom, LaCrosse, RFY, HuE, google, standard Lua, Tasker, Waze traveltime, NLAlert&grip2+,curtains, vacuum, audioreceiver, smart-heating&cooling + many more (= automate all repetitive simple tasks)
User avatar
waltervl
Posts: 7021
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2026.3
Location: NL
Contact:

Re: devicechanged problem for temp sensors ?

Post by waltervl »

I am not into Lua so not sure how to help. If it works in dzvents it should also work in Lua as dzvents is build upon lua.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
zicht
Posts: 308
Joined: Sunday 11 May 2014 11:09
Target OS: Windows
Domoticz version: 2023.1+
Location: NL
Contact:

Re: devicechanged problem for temp sensors ?

Post by zicht »

waltervl wrote: Friday 12 June 2026 13:53 I am not into Lua so not sure how to help. If it works in dzvents it should also work in Lua as dzvents is build upon lua.
I agree, maybe some unintended code regression happend somewhere....
Thanks anyway
Rpi & Win x64. Using : cam's,RFXCom, LaCrosse, RFY, HuE, google, standard Lua, Tasker, Waze traveltime, NLAlert&grip2+,curtains, vacuum, audioreceiver, smart-heating&cooling + many more (= automate all repetitive simple tasks)
User avatar
waltervl
Posts: 7021
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2026.3
Location: NL
Contact:

Re: [LUA] devicechanged problem for temp sensors ?

Post by waltervl »

By accident you do not have 2 devices called "Binnen"?
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
zicht
Posts: 308
Joined: Sunday 11 May 2014 11:09
Target OS: Windows
Domoticz version: 2023.1+
Location: NL
Contact:

Re: [LUA] devicechanged problem for temp sensors ?

Post by zicht »

By accident you do not have 2 devices called "Binnen"?
No just double checked.
But I have another device with "binnen<space><somethingelse>" Just to make sure i renamed that temporary but does not make a change.
Dont think it does matter but its an RFX temp sensor. I would expect on change the devicechanged{"Binnen"] is triggered. Its ok if it isnt triggered if values are unchanged.

tried this:

Code: Select all

return {
    on = {
        devices = {
            'Binnen'
        }
    },

    execute = function(domoticz, device)
        domoticz.log(
            'Binnen gewijzigd: waarde=' .. tostring(device.rawData[1]) ..
            ' | sValue=' .. tostring(device.sValue) ..
            ' | nValue=' .. tostring(device.nValue),
            domoticz.LOG_INFO
        )
    end
}
also no info in log.

Its for all my rfx temp sensors.
if i print every device changed the devicename i get this in my log :
2026-06-12 20:19:51.271 HueBridgePro: Temp (Hue outdoor temp. front)
2026-06-12 20:19:51.287 Smartmeter: P1 Smart Meter (Smartmeter Power)
2026-06-12 20:19:51.287 Smartmeter: General/Voltage (Smartmeter Voltage L1)
2026-06-12 20:19:51.287 Smartmeter: Usage (Usage L1)
2026-06-12 20:19:51.287 Smartmeter: Usage (Delivery L1)
2026-06-12 20:19:51.287 Smartmeter: Usage (Actual Usage (L1 + L2 + L3))
2026-06-12 20:19:51.287 Smartmeter: Usage (Actual Delivery (L1 + L2 + L3))
2026-06-12 20:19:51.287 Smartmeter: General/kWh (kWh Usage L1 (Calculated))
2026-06-12 20:19:51.287 Smartmeter: General/kWh (kWh Delivery L1 (Calculated))
2026-06-12 20:19:51.436 Status: LUA: Hue outdoor temp. front
2026-06-12 20:19:51.637 Status: LUA: Smartmeter Power
2026-06-12 20:19:51.845 Status: LUA: Usage L1
2026-06-12 20:19:52.036 Status: LUA: Delivery L1
2026-06-12 20:19:52.631 Status: LUA: NEST mode
2026-06-12 20:19:52.838 Status: LUA: NEST status_text

2026-06-12 20:19:53.870 RFXCOM2: Temp + Humidity (Vriezer_temp)
2026-06-12 20:19:54.013 Status: LUA: Vriezer_temp
2026-06-12 20:19:55.663 HueBridgePro: Temp (Hue outdoor temp. front)
2026-06-12 20:19:56.904 HueBridgePro: Light/Switch (licht outdoor light sensor 216)
2026-06-12 20:19:56.904 HueBridgePro: Lux (LUX outdoor motion 216)
2026-06-12 20:19:57.062 Status: LUA: licht outdoor light sensor 216
2026-06-12 20:19:57.269 Status: LUA: LUX outdoor motion 216

2026-06-12 20:19:58.646 RFXCOM2: Temp + Humidity + Baro (Binnen_rfx2)
2026-06-12 20:19:58.678 RFXCOM: Temp + Humidity + Baro (Binnen)
2026-06-12 20:19:59.695 RFXCOM2: Temp + Humidity (Zolder rfx2)
2026-06-12 20:19:59.728 RFXCOM: Temp + Humidity (Zolder)
2026-06-12 20:20:01.135 HueBridgePro: Lux (LUX outdoor motion 216)
2026-06-12 20:20:01.294 Smartmeter: General/kWh (kWh Usage L1 (Calculated))
2026-06-12 20:20:01.294 Smartmeter: General/kWh (kWh Delivery L1 (Calculated))
2026-06-12 20:20:02.929 Status: LUA: batterij_2 - Active Voltage
Rpi & Win x64. Using : cam's,RFXCom, LaCrosse, RFY, HuE, google, standard Lua, Tasker, Waze traveltime, NLAlert&grip2+,curtains, vacuum, audioreceiver, smart-heating&cooling + many more (= automate all repetitive simple tasks)
User avatar
waltervl
Posts: 7021
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2026.3
Location: NL
Contact:

Re: [LUA] devicechanged problem for temp sensors ?

Post by waltervl »

Vriezer_temp is logged so it is not only rfx that is not logged...

Code: Select all

2026-06-12 20:19:53.870 RFXCOM2: Temp + Humidity (Vriezer_temp)
2026-06-12 20:19:54.013 Status: LUA: Vriezer_temp
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
zicht
Posts: 308
Joined: Sunday 11 May 2014 11:09
Target OS: Windows
Domoticz version: 2023.1+
Location: NL
Contact:

Re: [LUA] devicechanged problem for temp sensors ?

Post by zicht »

waltervl wrote: Friday 12 June 2026 21:20 Vriezer_temp is logged so it is not only rfx that is not logged...

Code: Select all

2026-06-12 20:19:53.870 RFXCOM2: Temp + Humidity (Vriezer_temp)
2026-06-12 20:19:54.013 Status: LUA: Vriezer_temp
Yeah i noticed it.

I''ll did some testing bij subtype also to see if there are changes depending on that. (its all manual testing & some lack of time, sorry)
first results are indeed only an update if value has changed. This is conform what you earlier mention is implementend in the past for temp sensors.
So not on every update received. This means i have correct temp but not on every incomming package. What makes i need to change my logic...

That closed my issue.
Rpi & Win x64. Using : cam's,RFXCom, LaCrosse, RFY, HuE, google, standard Lua, Tasker, Waze traveltime, NLAlert&grip2+,curtains, vacuum, audioreceiver, smart-heating&cooling + many more (= automate all repetitive simple tasks)
Post Reply