Install Tado plugin

Hi guys,

Can anyone help me debug the Tado plugin install on openluup?

I have put the files on openluup and created the Tado device, like I’m supposed to. AltUI says the device is created successfully, but then openluup gets unresponsive.

However I see the following in my docker container log:


  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current,

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  0     0    0     0    0     0      0      0 --:--:--  0:00:01 --:--:--     0
  0     0    0     0    0     0      0      0 --:--:--  0:00:02 --:--:--     0
  0     0    0     0    0     0      0      0 --:--:--  0:00:03 --:--:--     0
  0     0    0     0    0     0      0      0 --:--:--  0:00:04 --:--:--     0
  0     0    0     0    0     0      0      0 --:--:--  0:00:05 --:--:--     0
  0     0    0     0    0     0      0      0 --:--:--  0:00:06 --:--:--     0
  0     0    0     0    0     0      0      0 --:--:--  0:00:07 --:--:--     0
  0     0    0     0    0     0      0      0 --:--:--  0:00:08 --:--:--     0
  0     0    0     0    0     0      0      0 --:--:--  0:00:09 --:--:--     0
  0     0    0     0    0     0      0      0 --:--:--  0:00:10 --:--:--     0
  0     0    0     0    0     0      0      0 --:--:--  0:00:11 --:--:--     0
  0     0    0     0    0     0      0      0 --:--:--  0:00:12 --:--:--     0
  0     0    0     0    0     0      0      0 --:--:--  0:00:13 --:--:--     0
  0     0    0     0    0     0      0      0 --:--:--  0:00:14 --:--:--     0
  0     0    0     0    0     0      0      0 --:--:--  0:00:15 --:--:--     0
  0     0    0     0    0     0      0      0 --:--:--  0:00:16 --:--:--     0
  0     0    0     0    0     0      0      0 --:--:--  0:00:17 --:--:--     0
  0     0    0     0    0     0      0      0 --:--:--  0:00:18 --:--:--     0
  0     0    0     0    0     0      0      0 --:--:--  0:00:19 --:--:--     0
  0     0    0     0    0     0      0      0 --:--:--  0:00:20 --:--:--     0
  0     0    0     0    0     0      0      0 --:--:--  0:00:21 --:--:--     0
  0     0    0     0    0     0      0      0 --:--:--  0:00:22 --:--:--     0
  0     0    0     0    0     0      0      0 --:--:--  0:00:23 --:--:--     0
  

This keeps on going until I restart openluup. So it’s trying to download files, I guess, but this gets openluup in a loop.

The only thing I see in the openluup log after the restart is this:

2020-11-05 13:32:53.306   openLuup.server:: GET /data_request?id=action&output_format=json&DeviceNum=0&serviceId=urn:micasaverde-com:serviceId:HomeAutomationGateway1&action=CreateDevice&Description=Tado&UpnpDevFilename=D_Tado1.xml&UpnpImplFilename=I_Tado1.xml&RoomNum=0&Reload=1 HTTP/1.1 tcp{client}: 0x556d5dc4f1b8
2020-11-05 13:32:53.307   luup.call_action:: 0.urn:micasaverde-com:serviceId:HomeAutomationGateway1.CreateDevice 
2020-11-05 13:32:53.318   luup.create_device:: [89] D_Tado1.xml / I_Tado1.xml / D_Tado1.json   (urn:schemas-fr87-com:device:Tado:1)
2020-11-05 13:32:53.318   openLuup.server:: request completed (65 bytes, 1 chunks, 11 ms) tcp{client}: 0x556d5dc4f1b8
2020-11-05 13:32:53.318   openLuup.scheduler:: [89] Tado device startup
2020-11-05 13:32:53.318   luup.variable_set:: 89.urn:fr87-com:serviceId:Tado1.username was: EMPTY now:  #hooks:0
2020-11-05 13:32:53.318   luup.variable_set:: 89.urn:fr87-com:serviceId:Tado1.password was: EMPTY now:  #hooks:0
2020-11-05 13:32:53.318   luup.variable_set:: 89.urn:fr87-com:serviceId:Tado1.debug was: EMPTY now: 0 #hooks:0

I use this plugin:

The first method that attempts to make a connection is this function:

function Tado_GetTempScale()
    -- Function to get the Vera temperature unit used.
    
    local curlCommand = 'curl -k -L -H "Content-Type: application/json" "http://localhost:3480/data_request?id=lu_sdata"'
    local stdout = io.popen(curlCommand)
    local tado_controller = stdout:read("*a")
    stdout:close()

    local obj, pos, err = tado_json.decode (tado_controller, 1, nil)
    
    TADO_SCALE = obj.temperature
end

Is this curl command supported by openluup? I don’t know why the plugin wants to transfer any information

it seems to me it’s trying to get the temperature format.

AFAIK there’s no way to get it from Vera’s luup engine, but maybe @akbooer has something special for openLuup.

@RHCPNG I’ll probably change this code to read a variable anyway, since it’s not that efficient to do it. Just try to return “F” or “C” from this function and see if it’s working on openLuup for you.

The curl command is nothing to do with openLuup, but all to do with the OS (and shell) under which it is running.

The io.popen() function is the correct way to pipe output from a shell command to Lua.

If you’re talking about the Luup temperature format in Vera (or openLuup), this is accessible as a system-wide attribute:

local t = luup.attr_get "TemperatureFormat"
print("Temperature format: " .. t)

giving this result, on my Vera Edge system:

Temperature format: C

1 Like

Thanks @akbooer!
@RHCPNG , just change the function to return what’s included here and you should be good.

Thanks @akbooer @therealdb

This helped me a step further. But I still think there is something fishy about the curl part, because now it seems to be looping on the next curl action in the code. I need to dig in deeper however to be sure.

I now got more than 40 newly created tado devices because of a loop in the install of the plugin :sweat:

I think I’m going to get me a test instance of openluup for this :smile:

To be continued…

I’m not sure where this code comes from, but there should be almost no occasion that you need to run curl.

Judging from the above code, the author wasn’t terribly familiar with vera either.


Ah, yes, I see that you referenced GitHub at the start, and I note that the README says:

This is my first attempt at a MiOS plugin and my first time programming in Lua.

This explains quite a lot.

I’ll try to take a look at the code, but I have just an old tado ac controller I’ve used 3 years ago.

Really appreciate it, @therealdb! I can test it for you of course.

I took a quick look at the code. It’s not that bad, but it needs some work. Part of the problems are in the way the child devices are created and HTTP calls are composed. I’ll add async http as one of the first thing.

I’ll start some refactoring in the next days, but I’m not sure it’ll be very quick. Please hold on and be patient :slight_smile:

1 Like

No problem, I’m not in a hurry. I’m glad somebody makes the effort.

I’m slowly making some progress. I’ve already rewritten the code, but I’m now trying to make it completely async, so it’s not that easy when dealing with child devices, but I’ll eventually get there.
I’ve already removed unwanted variables, to optimize the impact on the storage.

Next step is to get rid of custom devices and try to use standard thermostats, plus add support for humidity devices. I’ve not so much spare time, but I’ll try to have something to try in the upcoming weeks. Stay tuned :slight_smile:

That’s great news! Sounds awesome, more than I hoped for.

Best Home Automation shopping experience. Shop at getvera!

© 2020 Vera Control Ltd., All Rights Reserved. Terms of Use | Privacy Policy | Forum Rules