Thing-Konfiguration with channels directly using command?

Most of my configuration is done via text files.

Because in a few days I will get a Bosswerk MI600 (Photovoltaic), I’m already looking for a smooth integration.

I found a python script able to ask every Value. E.G. mi600 |host| |username| |type| like mi600 1.1.1.1 master webdata_now_p

Now my question: Is there a way to define a thing with directly including the channels using the output of a specified command?

Like

 Thing http:url:wi600 "Bosswerk600" [
      command="wi600 x.x.x.x USERNAME",
          Channels:
              Type number:output "webdata_now_p" [
                  mode="READONLY",
                  commandTransformation="REGEX((.*))"
              ]
  }


You mean the Exec binding?

I know how to do with exec one item per value, but I thought could be directly done in one thing with channels like work with http too?

You mean send multiple parameters to the script? You can’t do that unless you can collect the parameters into a single Item state. You’d use a rule to do that - and then you might as well use executeCommandLine() in the rule with a command string built out of the parts, and not bother with the binding.

If instead, you mean extracting multiple values from the single script return string, that’s what the binding can do, with multiple channels using different transformations to extract.

As the values will come explicitly, that will not work. :frowning:

With http I have got a thing like

Thing

  • channels

Channel a send parameter A gives answer with the value
channel b send parameter B gives answer with another value

So as I understood: this is not possible in a thing with bash commands.

So I will do with a Script. For that I know how.

Would be interesting to have same logic like with http binding in exec too as an option creating smarter things :wink:

You might give an example of what you are trying to do.
The exec binding allows you to build a Thing which executes lines like

some fixed string [some Item command] some more fixed string

but what you cannot do is

some fixed string [some ItemA command] [some ItemB command] some more fixed string

because there is only one command involved

Yes, so like with http in following thing and stateExtension doesn’t work:


Thing http:url:r2d2status "HTTP: R2D2 JSON Status" [ baseURL="http://x.x.x.x/json?user=User&pass=Password", commandMethod="GET", 
                                                    timeout="10000", refresh="90" ] {
    Channels:
        Type string : json-status "JSON Status" [ mode="READONLY", stateExtension="&cmd=status" ]
        Type string : name        "Name"         [ mode="READONLY", stateExtension="&cmd=status", stateTransformation="JSONPATH:$.name" ]
        Type string : id          "ID"           [ mode="READONLY", stateExtension="&cmd=status", stateTransformation="JSONPATH:$.id" ]
        Type number : status      "Status"       [ mode="READONLY", stateExtension="&cmd=status", stateTransformation="JSONPATH:$.status.status" ]
        Type number : distance    "Distance"     [ mode="READONLY", stateExtension="&cmd=status", stateTransformation="JSONPATH:$.status.distance" ]
        Type switch : stopped     "Stopped"      [ mode="READONLY", stateExtension="&cmd=status", stateTransformation="JSONPATH:$.status.stopped", onValue="true", offValue="false" ]
        Type number : duration    "Duration"     [ mode="READONLY", stateExtension="&cmd=status", stateTransformation="JSONPATH:$.status.duration" ]
        Type number : mode        "mode"         [ mode="READONLY", stateExtension="&cmd=status", stateTransformation="JSONPATH:$.status.mode" ]
        Type number : battery     "battery"      [ mode="READONLY", stateExtension="&cmd=status", stateTransformation="JSONPATH:$.status.battery" ]
        Type number : timer       "Timer"        [ mode="READONLY", stateExtension="&cmd=status", stateTransformation="JSONPATH:$.timer.status" ]
        Type string : timer-date  "Timer Date"   [ mode="READONLY", stateExtension="&cmd=status", stateTransformation="REGEX:(.*timer.next.*)nJSONPATH:$.timer.next.date" ]
        Type string : timer-time  "Timer Time"   [ mode="READONLY", stateExtension="&cmd=status", stateTransformation="REGEX:(.*timer.next.*)nJSONPATH:$.timer.next.time" ]
        Type number : timer-unix  "Timer Unix"   [ mode="READONLY", stateExtension="&cmd=status", stateTransformation="REGEX:(.*timer.next.*)nJSONPATH:$.timer.next.unix" ]
        Type number : blades-quality "Blades Quality" [ mode="READONLY", stateExtension="&cmd=status", stateTransformation="JSONPATH:$.blades.quality" ]
        Type number : blades-hours "Blades Hours" [ mode="READONLY", stateExtension="&cmd=status", stateTransformation="JSONPATH:$.blades.hours" ]
        Type number : blades-days "Blades Days"  [ mode="READONLY", stateExtension="&cmd=status", stateTransformation="JSONPATH:$.blades.days" ]
        Type number : wlan-signal "WLAN-Signal"  [ mode="READONLY", stateExtension="&cmd=status", stateTransformation="JSONPATH:$.wlan.signal" ]
}

Would be great if this would work with cmds too :wink:

I‘ll do with rules. Thank you for your patience with me