Very partial tado binding alternative

Because tado is now limiting the allowed API calls to 100 per day, I decided to remove my tado binding. @AndrewFG is working on a HomeKit binding, which will one day restore most of the features, but as that is a big task, that won’t be for the immediate future, I assume.

Coincidentally, I was working on a script to make making schedules (relatively) easier, and I decided to add the functionality to set temperatures as well.

This is my python code: GitHub - ErikDB87/tado-manual-control.

I then made a group item (tado_manual_items_group), in which I put all my items which were linked to the channels targetTemperature and operationMode.

I then wrote this rule:

configuration: {}
triggers:
  - id: "1"
    configuration:
      groupName: tado_manual_items_group
    type: core.GroupCommandTrigger
conditions: []
actions:
  - inputs: {}
    id: "2"
    configuration:
      type: application/javascript
      script: >-
        // All "zone" things have to be removed. Or maybe just the channel
        links. But since I had already removed the binding, I couldn't do that
        anymore.



        var itemnaam = event.itemName;

        var nieuwestatus = event.getItemCommand().toString();


        var tadozones = {
          // The zone id's must be strings
          "eetkamer": "2",
          "studieruimte": "3",
          "badkamer": "5",
          "keuken": "6",
          "gang_gelijkvloers": "8",
          "dressing": "9"
        };



        var kamer = itemnaam.split("_")[1];

        if (itemnaam.split("_").length > 3) {
          kamer = kamer.concat("_").concat(itemnaam.split("_")[2]);
        }

        var itemsoort = itemnaam.split("_")[itemnaam.split("_").length-1];

        var zone = tadozones[kamer];



        var pythoninvenv =
        '/var/lib/openhab/bin/python/tado-manual-control/venv/bin/python';

        var pythonscript =
        '/var/lib/openhab/bin/python/tado-manual-control/tado-manual-control.py';



        function callPython(command) {
          var pythonOutput = actions.Exec.executeCommandLine(time.Duration.ofSeconds(3), command);
          console.log("python output = "+pythonOutput);
        }



        function main() {
          if (itemsoort == "targetTemp") {
            var command = [pythoninvenv, pythonscript, 'manualtemp', '-t',  nieuwestatus, '-z', zone];
            callPython(command);
          } else if (nieuwestatus == "SCHEDULE") {
            var command = [pythoninvenv, pythonscript, 'back_to_schedule', '-z', zone];
            callPython(command);
          }

        }


        main();
    type: script.ScriptAction

I discovered the links to the channels had to be removed, otherwise the item states couldn’t be changed. I should have done that before removing the binding, so I ended up removing the things altogether…

I thought I’d share this, maybe someone else finds it useful.

I haven’t done a lot of alpha testing, so any improvement suggestions are welcome (both to the python code as to the rule), of course!

(Apologies for the Dutch variables, but I assume that won’t be a deal breaker. :slight_smile: I also had to do some patch work for an ill-advised item name. Obviously the “item name” part will need personalization in any setup.)