Page 1 of 2

[SOLVED] Recent en working solution for Harmony Hub Devices

Posted: Saturday 23 June 2018 17:16
by jpvaneijk
Hi All,

I've been working myself through a serious amount of topics on this subject on multiple fora.
The native support for the Harmony Hub in Domoticz is great but lags the functionality for the use of the individual devices. #willthereeverbesupportforthis

Is there any recent en and working solution and/or howto so I can change TV channels or change/mute the volume?

My devices:
  • Raspberry Pi 3B+ running Domoticz V3.9654
  • Logitech Harmony Hub
  • TV decoder: Arris VIP2952 (for switching channels)
  • TV: Samsung UE49KS7502UXXH (for use as Monitor)
  • AVReceiver: Denon AVR-3800 (no Wifi/ethernet) for volume
The Harmony Hub itself controles everything flawlesly so my first wish is a solution using the Harmony Hub.
Thanks for any contribution guys.

Re: Recent en working solution for Harmony Hub Devices

Posted: Saturday 23 June 2018 17:25
by gizmocuz
#willthereeverbesupportforthis, well this is an open source project, please contribute some code

Another thing is, WHY you need to do this via domoticz ?

WHY don't you get yourself something like an amazon alexa, and ask here to tune to netherlands 2 ?

Seems much easier then to launch domoticz, press a remote control/favorite list, and tune to a channel,
it is probably faster to do so with the original harmony remote.

I also have a harmony, and i use domoticz to turn everything off (when i tell my hourse to go to sleep for instance),
or change to movie, or change activity to tv

I bed 99% of the time when you change to a channel you have to adjust the volume anyway

Another solution could be to get yourself an OpenPLI enabled STB, and via HTTP commands you can switch channels or do whatever you want it to do.
Then you can use a standard domoticz switch to send an http command

Another option is to use a standard switch (with an HTTP action), and use a third party program like

https://github.com/maddox/harmony-api

So... will this every be supported.... it is already, and maybe you can contribute some code ?

Re: Recent en working solution for Harmony Hub Devices

Posted: Saturday 23 June 2018 18:10
by jpvaneijk
Hi Gizmocuz,

Thanx for the (quick) reply.
I'm pretty new at this and I'm verry sorry if a gave an impression that I'm not happy with Domoticz or all the work that's been done so far.
So far my only experiance with code is the terminal in Raspbian and I got that one only 6 weeks ago.

If there's any moment that I feel comfortable writing some code of my own that's interesting enough to share on Domoticz (or anywhere for that matter) you can be sure I will do so. For now, I totaly get your responce :oops:
Never intended any offence, just frustration on my part.
Another thing is, WHY you need to do this via domoticz ?
The harmony Hub is not supported in my Google Home. The workarround I found was using Domoticz in combination with Controlicz.
This is great for activitys and working verry wel but I'm missing the changing channels or volume options.
WHY don't you get yourself something like an amazon alexa, and ask here to tune to netherlands 2 ?
Perhaps not the right choice for this issue, but as said, I got myself a Google Home speaker.
Seems much easier then to launch domoticz, press a remote control/favorite list, and tune to a channel,
it is probably faster to do so with the original harmony remote.
You are absolutly right.
Another option is to use a standard switch (with an HTTP action), and use a third party program like
https://github.com/maddox/harmony-api
Thanx, I will give this a try and send you som dutch stroopwafels if it's up-n-running
So... will this every be supported.... it is already, and maybe you can contribute some code ?
Again, 'you are right and I'm sorry. I've been working on a solution for many hours and the hashtag was my personal frustration. It will not happen again.

Thanx for now!

Re: Recent en working solution for Harmony Hub Devices

Posted: Saturday 23 June 2018 18:56
by gordonb3
Hate to say, but it is really the Harmony Hub itself being the issue here. The problem is not that we can't send commands to individual devices from Domoticz, but that Harmony Hub does not report anything back when we issue those commands. This also means that it does not send any informational messages when you issue commands from the normal remote or the phone app. As a result there is no way that we can ever know the state of any device. We can't tell whether it's on or off, what the volume level is, what channel it is at. And that's the reason why it is not in Domoticz.

Re: Recent en working solution for Harmony Hub Devices

Posted: Sunday 24 June 2018 8:54
by gizmocuz
That might be partly true, but this -> "Change TV channels or change/mute the volume" should work,
as you can create a list of favorite channels, and select them from the remote, and also controlling the volume/mute works.
Maybe there is no status/return that says what channel is selected, or if the volume is muted, but sending those commands might/could/should work

Re: Recent en working solution for Harmony Hub Devices

Posted: Sunday 24 June 2018 11:30
by gordonb3
As said: yes, we can send those commands.

AFAIK there is currently no support for devices with an unknown state in Domoticz though. Any button I click will want to show me that I clicked it and you end up with buttons reporting the exact opposite of the actual state. Or in the case of channel select: a completely different channel than you are watching and making it impossible to select it because according to our interface it is already on.

Re: Recent en working solution for Harmony Hub Devices

Posted: Sunday 24 June 2018 13:24
by jpvaneijk
On GitHub I found harmoniHubCLi : https://github.com/sushilks/harmonyHubCLI
It's not fast, but it's running. For a test I did:

Code: Select all

cd harmonyHubCLI

Code: Select all

node harmonyHubCli.js -l 192.168.2.174 -d 'AV-ontvanger Denon' -c 'Mute'
Is there anyway to script this in Domoticz guy's? Sorry if I'm beeing like a noob, as said, I'm pretty new at this and I can't seem to find an easy answer to this.

Re: Recent en working solution for Harmony Hub Devices

Posted: Sunday 24 June 2018 13:45
by gordonb3
There's also an up to date version of HarmonyHubControl: https://github.com/gordonb3/HarmonyHubControl/

I think you'll find this to be quicker than using node. To use that from Domoticz you can add a dummy switch and enter the required command as a ` script://` action in the On/Off action properties of the switch.

Re: Recent en working solution for Harmony Hub Devices

Posted: Sunday 24 June 2018 16:26
by jpvaneijk
Thanks.
I'm having some trouble getting it up and running. Seems the .exe can't be found?

Code: Select all

bash: HarmonyHubControl.exe: opdracht niet gevonden

Code: Select all

./HarmonyHubControl [MY EMAIL] [MY PSSW] [HUB IP]
gives:
Syntax:
HarmonyHubControl [harmony_ip] [command]
where command can be any of the following:
list_activities
list_activities_raw
get_current_activity_id
get_current_activity_id_raw
start_activity <ID>
start_activity_raw <ID>
list_devices
list_devices_raw
list_device_commands <deviceId>
list_device_commands_raw <deviceId>
issue_device_command <deviceId> <command> [...]
issue_device_command_raw <deviceId> <command> [...]
get_config
get_config_raw


Adding another command give's the same result. Can you advise?

Can you also give me an example for a Domoticz-script?

Re: Recent en working solution for Harmony Hub Devices

Posted: Sunday 24 June 2018 17:41
by gordonb3
HarmonyHubControl does not require username and password. Simply specify the IP address (or internal DNS name) as the first parameter and it should return the current activity. Add one of the list* commands to let it return information about activities, devices and what commands you can give it. I have not actually worked on making the CLI more comprehensible than it was in the original unmaintained code, but the idea is that the "raw" methods will only return pure json for use in web pages and other automation systems and the non-raw methods (also) produce user readable output.

With regard to scripting first place to look would be here: https://www.domoticz.com/wiki/Scripting_in_Domoticz

Re: Recent en working solution for Harmony Hub Devices

Posted: Sunday 24 June 2018 18:28
by jpvaneijk
Ok. Thanx. It's working now. Great.
Can you give me an example for using this in a domoticz-script in a dummy-switch?

Thanx!

Re: Recent en working solution for Harmony Hub Devices

Posted: Monday 25 June 2018 20:07
by gordonb3
Something like this:

Code: Select all

"script://" + $path-to-harmonyhubcontrol + "/HarmonyHubControl" + " " + $IP + " issue_device_command " + $deviceID + " " + "1 0 0" 
Or a more strict example:

Code: Select all

script:///opt/HarmonyHubControl/HarmonyHubControl 192.168.0.60 issue_device_command 1234567  1 0 0
Will switch to channel 100 (do note the spaces between the last three digits)

You can specify up to three commands to issue_device_command specifically for above reason, so you can also do something like this:

Code: Select all

script:///opt/HarmonyHubControl/HarmonyHubControl 192.168.0.60 issue_device_command 1234567 VolumeUp VolumeUp

Re: Recent en working solution for Harmony Hub Devices

Posted: Thursday 28 June 2018 18:02
by jpvaneijk
Sorry for the late responce. It's all working great!
For now this is the best solution to use your Pi in combination with Harmony Hub devices and Google Home speaker (and Controlicz by Madgeni).
If (when) Google gets the dutch language this will no longer be necessary Logitech will also support the Dutch language.

Some codes working for me:
AV Receiver

Code: Select all

script:///home/pi/HarmonyHubControl/HarmonyHubControl 192.168.2.3 issue_device_command 55207356 Mute
script:///home/pi/HarmonyHubControl/HarmonyHubControl 192.168.2.3 issue_device_command 55207356 VolumeUp
script:///home/pi/HarmonyHubControl/HarmonyHubControl 192.168.2.3 issue_device_command 55207356 VolumeDown
script:///home/pi/HarmonyHubControl/HarmonyHubControl 192.168.2.3 issue_device_command 55207356 ModeStereo
script:///home/pi/HarmonyHubControl/HarmonyHubControl 192.168.2.3 issue_device_command 55207356 ModeDolby/DTSSurround
Decoder TV

Code: Select all

script:///home/pi/HarmonyHubControl/HarmonyHubControl 192.168.2.3 issue_device_command 55207349 ChannelPrev
script:///home/pi/HarmonyHubControl/HarmonyHubControl 192.168.2.3 issue_device_command 55207349 ChannelUp
script:///home/pi/HarmonyHubControl/HarmonyHubControl 192.168.2.3 issue_device_command 55207349 ChannelDown
script:///home/pi/HarmonyHubControl/HarmonyHubControl 192.168.2.3 issue_device_command 55207349 Record
script:///home/pi/HarmonyHubControl/HarmonyHubControl 192.168.2.3 issue_device_command 55207349 Select
script:///home/pi/HarmonyHubControl/HarmonyHubControl 192.168.2.3 issue_device_command 55207349 Exit
Thanx a million for your assistance guys and your patience ofcourse.

Re: [SOLVED] Recent en working solution for Harmony Hub Devices

Posted: Sunday 02 September 2018 10:21
by Ascari
Hello,

How I can install the PyHarmony ?

I want just the possibility to add Dummy Mute Switch for my harmony.

Thank

Re: Recent en working solution for Harmony Hub Devices

Posted: Wednesday 26 September 2018 20:35
by steef84
gordonb3 wrote: Monday 25 June 2018 20:07 Something like this:

Code: Select all

"script://" + $path-to-harmonyhubcontrol + "/HarmonyHubControl" + " " + $IP + " issue_device_command " + $deviceID + " " + "1 0 0" 
Or a more strict example:

Code: Select all

script:///opt/HarmonyHubControl/HarmonyHubControl 192.168.0.60 issue_device_command 1234567  1 0 0
Will switch to channel 100 (do note the spaces between the last three digits)

You can specify up to three commands to issue_device_command specifically for above reason, so you can also do something like this:

Code: Select all

script:///opt/HarmonyHubControl/HarmonyHubControl 192.168.0.60 issue_device_command 1234567 VolumeUp VolumeUp
Tried you HarmonyHubControl but somehow cannot get it to work. The script ends with a "null" Any hints in for what im missing? Trying to VolumeUp my AVR

Code: Select all

pi@raspberrypi:~/domoticz/scripts/python/HarmonyHubControl $ ./HarmonyHubControl 10.0.0.152 issue_device_command 54611955 VolumeUp
LOGITECH WEB SERVICE LOGIN     : BYPASSED
HARMONY COMMUNICATION LOGIN    : SUCCESS
HARMONY COMMAND SUBMISSION     : SUCCESS
null
DeviceID is correct and double checked. Extra info

Code: Select all

pi@raspberrypi:~/domoticz/scripts/python/HarmonyHubControl $ ./HarmonyHubControl 10.0.0.152 list_device_commands 54611955
LOGITECH WEB SERVICE LOGIN     : BYPASSED
HARMONY COMMUNICATION LOGIN    : SUCCESS
HARMONY COMMAND SUBMISSION     : SUCCESS
PARSE ACTIVITIES AND DEVICES   : SUCCESS
Harmony Commands for Device:

{
   "Amplifier" : "HEOS HomeCinema",
   "Denon" : "Heos HomeCinema",
   "Functions" : {
      "Miscellaneous" : [
         "InputAuxIn",
         "InputCoaxIn",
         "InputHdmiArc",
         "InputHdmiIn",
         "InputOpticalIn"
      ],
      "PlayMode" : [ "Repeat", "Shuffle" ],
      "TransportBasic" : [ "Stop", "Play", "Pause" ],
      "TransportExtended" : [ "SkipBack", "SkipForward" ],
      "Volume" : [ "Mute", "VolumeDown", "VolumeUp" ]
   },
   "ID" : 54611955

Re: [SOLVED] Recent en working solution for Harmony Hub Devices

Posted: Thursday 27 September 2018 10:12
by gordonb3
Hmmm.... Does it not do the VolumeUp?

I think if you do the `issue_device_command_raw` version of the command it will show you a status OK in json. The `null` you are seeing is from trying to output a variable that is in fact never filled.

Re: [SOLVED] Recent en working solution for Harmony Hub Devices

Posted: Friday 06 September 2019 21:49
by CronoS
This is an old threat, but hopefully someone can help... I want to setup the HarmonyHubControl plugin, to have more control on my Hub, but I don't know how to install it on a Synology? Anyone advice how I can install it? I have the Domticz with the plugin support, but I don't get the file structure..

I want to use it with Controllicz and Google Assistent. The built-in plugin for Harmony Hub is working OK, but I want to have more control for audio, channels etc..

Re: [SOLVED] Recent en working solution for Harmony Hub Devices

Posted: Saturday 26 October 2019 10:48
by JerryZvW
Hi All,

just started with this, I'm able to connect to the hub but when I request a list of activities :
jerry@server:~/HarmonyHubControl$ ./HarmonyHubControl [email protected] password 192.168.0.xx list_activities
LOGITECH WEB SERVICE LOGIN : BYPASSED
HARMONY COMMUNICATION LOGIN : SUCCESS
HARMONY COMMAND SUBMISSION : SUCCESS
PARSE ACTIVITIES AND DEVICES : SUCCESS
Activities Available via Harmony :

-1 - PowerOff
Same with the devices... :
jerry@server:~/HarmonyHubControl$ ./HarmonyHubControl [email protected] password 192.168.0.xx list_activities
LOGITECH WEB SERVICE LOGIN : BYPASSED
HARMONY COMMUNICATION LOGIN : SUCCESS
HARMONY COMMAND SUBMISSION : SUCCESS
PARSE ACTIVITIES AND DEVICES : SUCCESS
Devices Controllable via Harmony :
But when I do a get_config, I do see all kinds of activities and devices in the output.
Am I doing something wrong ? or am I missing something?
Can I use the information from the get_config output to control my devices ?
(I will try this today....)

Thanks,
Jerry

Re: [SOLVED] Recent en working solution for Harmony Hub Devices

Posted: Saturday 26 October 2019 14:34
by JerryZvW
I did find the activity id's for the activities I use by starting the activity and putting in the following command :
jerry@server:~/domoticz/scripts/HarmonyHubControl$ ./HarmonyHubControl [email protected] password 192.168.0.xx get_current_activity_id
LOGITECH WEB SERVICE LOGIN : BYPASSED
HARMONY COMMUNICATION LOGIN : SUCCESS
HARMONY COMMAND SUBMISSION : SUCCESS
Current Activity ID is : 33716588
with this I am able to start the activity like so :
./HarmonyHubControl [email protected] password 192.168.0.xx start_activity 33716588
However I'm unable to start the activity using the method described in the wiki. (domoticz_main). My domoticz_main script looks like this :
#!/bin/sh

startup_path=$1
hardware_id=$2
device_id=$3
status=$4
status2=$5
devname=$6

echo "startup_path=${startup_path}, hardware_id=${hardware_id}, device_id=${device_id}, status=${status}, status2=${status2}, devname=${devname}"

//TV

if [ "$device_id" = "3855" ] ; then
if [ "$status" = "On" ] ; then
exec `/home/jerry/domoticz/scripts/HarmonyHubControl/HarmonyHubControl [email protected] password 192.168.0.xx start_activity 29493890` &
fi
fi

//RADIO

if [ "$device_id" = "3856" ] ; then
if [ "$status" = "On" ] ; then
exec `/home/jerry/domoticz/scripts/HarmonyHubControl/HarmonyHubControl [email protected] password 192.168.0.xx start_activity 33716588` &
fi
fi

//AV control

if [ "$device_id" = "3854" ] ; then
if [ "$status" = "Off" ] ; then
exec `/home/jerry/domoticz/scripts/HarmonyHubControl/HarmonyHubControl [email protected] password 192.168.0.xx start_activity -1` &
fi
fi
But I'm having no success with this when I switch them on or off...
Does anyone know why..? It should work as far as I can see, as the same rule in the terminal works flawless.

Thanks

Re: [SOLVED] Recent en working solution for Harmony Hub Devices

Posted: Sunday 27 October 2019 8:47
by renerene
Is it possible to play a Spotify playlist in random order on a specific device?
Would be great if this is possible. Listen to music, with just one press on Dashticz or Domoticz