SonOff Switch with Espurna sw

I have a Vera Plus and some SonOff 4ch switches.
My problem is that I can´t get Vera to read the real status.
I can controll it but have no monitor.

I´ve been editing the Evak WiFi files to respond to the newer Sonoff fw.
I´m new at this so it might be easy… :wink: (4.3 KB)

I’m not familiar with espunta, but if it have the ability to read the status of the device, you can update the device back in Vera. What are you using and which device are you trying to update?

I have a section in the lua file that will retrieve status but nothing happened.
The string for retrieving status is correct and works:
0 is off
1 is on
I must have written something wrong … that I do not see …

I have attached the App files in my case

in your code, you’r looking for status = 0, but it’d be better to look for httpStatusCode (3rd param). the first parameter is not the content.

try this in GetRemoteStatus:

local status, result, statusCode = luup.inet.wget(url,6)
if statusCode == 200 then
  luup.variable_set("urn:upnp-org:serviceId:SwitchPower1", "Status",  result, parentDevice)

no need to have complicated code.

So greatful for your help, but…
Your suggested solution does not work

The online status works which is annoying because the on/off-status is more important.
I can control these switches via external buttons and after external change the status is no longer correct

doesn’t work is too generic. start with executing the code directly and by logging each variable. when the code is working, you can start integrating it back into the plug-in,