HarmonyHubControl doesn't work from dzVents, does from PuTTY

Post Reply
nosehook
Posts: 22
Joined: Thursday 31 March 2016 20:49
Target OS: Raspberry Pi
Domoticz version: Beta
Location: Netherlands
Contact:

HarmonyHubControl doesn't work from dzVents, does from PuTTY

Post by nosehook » Saturday 03 March 2018 12:21

Version: 3.8975
Build Hash: 63d0d07e
Platform: RPi 2
Plugin/Hardware: Harmony Hub with HarmonyHubControl script
Setup:
/home/pi/domoticz/
/home/pi/HarmonyHubControl/

Harmony Hub at ip: 192.168.0.114

The issue:

I recently picked up on Domoticz again. In the past I had set up hidden switches that call HarmonyHubControl (https://www.domoticz.com/wiki/Harmony_Hub_Control) via os.execute to switch events etc, this system worked.

Now I have updated Domoticz and it doens't work anymore. The switches don't work anymore and I have tried to set up a new script in dzVents that gives me exit 1 or exit 127 codes.
If I open Putty and type:

Code: Select all

./home/pi/HarmonyHubControl/HarmonyHubControl e@ma.il PW 192.168.0.114 issue_device_command 32138574 InputHdmi3
it works...

The dzVents (test)script I made is as follows:

Code: Select all

return {


	active = true, -- set to false to disable this script
	on = {
		devices = {
			182, 183,
		},
        timer = {'every 5 minutes'},
	},

	execute = function(domoticz, device)

    if device.idx == 182 then
        if domoticz.devices(device.idx).state == 'Toggle' then
            print ('------------ HK Toggle --------')
        elseif domoticz.devices(device.idx).state == 'ARC' then
            print ('------------ HK Toggle --------')
        end
    elseif device.idx == 183 then
        if domoticz.devices(device.idx).state == 'On' then
            print ('------------ TV On --------')
        elseif domoticz.devices(device.idx).state == 'TV' then
            print ('------------ TV TV --------')
        elseif domoticz.devices(device.idx).state == 'CC' then
            print ('------------ TV CC --------')
           print( os.execute('./home/pi/HarmonyHubControl/HarmonyHubControl e@ma.il PW 192.168.0.114 issue_device_command 32138574 InputHdmi3'))
    
        end
    end
   
       
    end 
    
}
I have tried:
./home/pi/HarmonyHubControl/HarmonyHubControl etc
sudo ./home/pi/HarmonyHubControl/HarmonyHubControl etc
./HarmonyHubControl/HarmonyHubControl etc
sudo ./HarmonyHubControl/HarmonyHubControl etc


Furthermore I have tried with a selector switch and assign the script to a selector level via

Code: Select all

script:///home/pi/HarmonyHubControl/HarmonyHubControl e@ma.il PW 192.168.0.114 issue_device_command 32138574 InputHdmi3
This results in Domotizc telling me the directory/file does not exist, it seems only to look in the scripts derectory.

I copied the HarmonyHubControl to the scripts folder, no succes, I double checked ownership: Root, and made sure HarmonyHubControl is +x

No succes so far, shilst in the past the system would control the Hub. I'd like that back, any suggestions?
B+ Domoticz | B+ OpenElec | Pi3 RetroPie | RFXcom 433E | 6 KAKU/COCO |
Harmony Hub | Panasonic TV | KODI (win) | YouLess | 4 x HS100 | VoxCommando (win) | Xiaomi gateway | sensors | scripts

Nautilus
Posts: 751
Joined: Friday 02 October 2015 12:12
Target OS: Raspberry Pi
Domoticz version: beta
Location: Finland
Contact:

Re: HarmonyHubControl doesn't work from dzVents, does from PuTTY

Post by Nautilus » Sunday 04 March 2018 0:29

I noticed at some point that HarmonyHubControl was not actively supported anymore and it stopped working after one of the hub's firmware updates. I'm not sure what is the situation now as I moved to harmonyHubCLI which also had more features available:
viewtopic.php?f=4&t=21166#p164004

nosehook
Posts: 22
Joined: Thursday 31 March 2016 20:49
Target OS: Raspberry Pi
Domoticz version: Beta
Location: Netherlands
Contact:

Re: HarmonyHubControl doesn't work from dzVents, does from PuTTY

Post by nosehook » Sunday 04 March 2018 15:01

That is a shame. However the thing that puzzles me is why a the os.execute does not work from a dzvents script, however directly from the shell environment it does...

Will look into the link! Thanks!
B+ Domoticz | B+ OpenElec | Pi3 RetroPie | RFXcom 433E | 6 KAKU/COCO |
Harmony Hub | Panasonic TV | KODI (win) | YouLess | 4 x HS100 | VoxCommando (win) | Xiaomi gateway | sensors | scripts

Nautilus
Posts: 751
Joined: Friday 02 October 2015 12:12
Target OS: Raspberry Pi
Domoticz version: beta
Location: Finland
Contact:

Re: HarmonyHubControl doesn't work from dzVents, does from PuTTY

Post by Nautilus » Monday 05 March 2018 0:36

nosehook wrote:
Sunday 04 March 2018 15:01
That is a shame. However the thing that puzzles me is why a the os.execute does not work from a dzvents script, however directly from the shell environment it does...

Will look into the link! Thanks!
Sorry, overlooked your initial question where you said you can run it from command line. This indeed tells that it should work also from a script. Upon checking the script you posted I noticed that you had only a "print" statement there, is this a typo or copy from the actual script? I guess print only outputs the line to Domoticz log.

Also, when running a script from a (selector) switch I think there is some limit (maybe character?) for the parameters that can be included. When I used HarmonyHubControl I added the command trunk to a bash script and only passed to variables, device id and command, and it worked. I changed that to harmonyHubCLI but you get the idea. Bash script's name is HarmonyDeviceCommand:

Code: Select all

#!/bin/bash
device_name="$1"; command_name="$2"
node /home/pi/node_modules/harmonyHubCLI/harmonyHubCli.js -l 192.168.11.70 -d "$device_name" -c "$command_name"
you can then call it with something like:

Code: Select all

script:///home/pi/domoticz/scripts/HarmonyDeviceCommand TV ChannelUp
Use quotes around the parameters if needed...

nosehook
Posts: 22
Joined: Thursday 31 March 2016 20:49
Target OS: Raspberry Pi
Domoticz version: Beta
Location: Netherlands
Contact:

Re: HarmonyHubControl doesn't work from dzVents, does from PuTTY

Post by nosehook » Monday 05 March 2018 15:25

I used the print to get any feedback in the domoticz log, hence the exit and 1 or 127 code.
The strange thing is that in the older version of Domoticz it used to work and now it doesn't I heard it might have something to do with firmware, however I would expect the same outcome from PuttY/command line, as from a script/derect call from Domoticz.

I have made a bash script that calls for the HarmonyHubControl command/program, and I get the same return.

Ran into some issues with the CLI install too. I am not that familiar with the Pi, but think it has to do with the OS I have, didn't recognize npm and complained about armV6, will look further during my weekend.
B+ Domoticz | B+ OpenElec | Pi3 RetroPie | RFXcom 433E | 6 KAKU/COCO |
Harmony Hub | Panasonic TV | KODI (win) | YouLess | 4 x HS100 | VoxCommando (win) | Xiaomi gateway | sensors | scripts

Nautilus
Posts: 751
Joined: Friday 02 October 2015 12:12
Target OS: Raspberry Pi
Domoticz version: beta
Location: Finland
Contact:

Re: HarmonyHubControl doesn't work from dzVents, does from PuTTY

Post by Nautilus » Tuesday 06 March 2018 0:12

Ok, well I think this does not work in any case:

Code: Select all

print( os.execute 
reason being that os.execute is not a variable and thus it would need to be quoted (use double since you have single within the string). But that of course does not solve your issue which sounds like a very strange one. RPi2 should be an ok platform, which OS are you running then? On the latest I think npm is preinstalled but on Jessie or later you might need to run first something like

Code: Select all

sudo apt-get install nodejs npm
Probably you in any case need to:

Code: Select all

sudo apt-get install nodejs
After this it should be just:

Code: Select all

npm install harmonyHubCLI
So, do you get the error codes with dzVents only or also when triggering from a selector switch?

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest