I am still unable to write a plugin but I figure I can work around with “ShellSwitch” so I came up with a little bash script that I called tcp-light
and that I store under /usr/bin/
with proper executable permissions on it. The tcp-light
script is nothing else that a curl wrapper that takes two options like so
/usr/bin/tcp-light xxxxxxxx 1
where xxxxxx is the DID of the device you want to control and 1 for ON or 0 for OFF, this works like a charm in the shell but when I try to add
{
"id": "office-bulb",
"name": "Office Bulb",
"class": "ShellSwitch",
"onCommand": "/usr/bin/tcp-light 216778325265872249 1",
"offCommand": "/usr/bin/tcp-light 216778325265872249 0"
}
to the config.json the switch shows in the UI but I get the message following in the logs and nothing is happening.
13:06:37.053 [pimatic-shell-execute] error: % Total % Received % Xferd Average Speed Time Time Time Current
13:06:37.053 [pimatic-shell-execute] error:> Dload Upload Total Spent Left Speed
100 209 100 43 100 166 43 168 0:00:01 --:--:-- 0:00:01 171
13:06:37.053 [pimatic-shell-execute] error:>
Pimatic, smart home made by smart folks, for the rest of us!