fail to capture devicechanged for SolarEdge

Moderator: leecollings

Post Reply
User avatar
Domoberry
Posts: 121
Joined: Tuesday 30 May 2017 19:00
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.7
Contact:

fail to capture devicechanged for SolarEdge

Post by Domoberry »

Hi Forum,

Working on some script which is supposed to run directly after my SolarEdge inverter has updated its status, typically every 5 mins.
To that extend I'm checking 'devicechanged[GenerationDeviceName]' and quit the script when this is a nil.
As this did not work as I hoped, I made this small test script (device triggered) to figure out what I'm doing wrong:

Code: Select all

local GenerationDeviceName = "Solar system"             -- Device name for SolarEdge power/energy

commandArray = {}

if devicechanged[GenerationDeviceName] == nil then
        print (">>> TEST devicechanged[" .. GenerationDeviceName .. "] == nil. Last changed: " .. otherdevices_lastupdate[GenerationDeviceName])
    else
        print (">>> TEST devicechanged[" .. GenerationDeviceName .. "] == " .. devichanged[GenerationDeviceName] .. " Last changed: " .. otherdevices_lastupdate[GenerationDeviceName] .. "<<<<<<<<<<<<")
    end
return commandArray
However, the scripts never hits anything else but the '== nil' branch, even if there is a updated value.
Here are some lines from the log while new value from the Solar Edge was recorded (from 11:13:48 to 11:18:48):

Code: Select all

2017-07-07 11:18:47.513 LUA: >>> TEST devicechanged[Solar system] == nil. Last changed: 2017-07-07 11:13:48
2017-07-07 11:18:48.519 LUA: >>> TEST devicechanged[Solar system] == nil. Last changed: 2017-07-07 11:13:48
2017-07-07 11:18:48.660 LUA: >>> TEST devicechanged[Solar system] == nil. Last changed: 2017-07-07 11:18:48
2017-07-07 11:18:48.682 LUA: >>> TEST devicechanged[Solar system] == nil. Last changed: 2017-07-07 11:18:48
2017-07-07 11:18:48.703 LUA: >>> TEST devicechanged[Solar system] == nil. Last changed: 2017-07-07 11:18:48
2017-07-07 11:18:48.716 LUA: >>> TEST devicechanged[Solar system] == nil. Last changed: 2017-07-07 11:18:48
2017-07-07 11:18:48.728 LUA: >>> TEST devicechanged[Solar system] == nil. Last changed: 2017-07-07 11:18:48
I would have expected to see one line showing the other branch of the if statement.
Any suggestion on the mistake I made is appreciated!
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest