Plugin: Harmony Hub Control

my app/plugin just updated to 3.9, stating it was on 3.6
since then only 1 of my 2 hubs are recognized
both hubs are at v .250
it keeps saying “Hub connection failed. Check IP Address.”
the IP address is correct
the hub is online
i also gave the hub a new IP and tried again
it still will not connect, initially saying it could not retrieve info from the hub
i also did a download and re-sync of the hub
i even tried enabling xmpp, then disabling when it did not help
i also created a new instance of the device and it has the same issue connecting to this hub

i also have a hass.io container I sometimes run for testing
it can connect to both hubs without issue
the container is normally off
so they are not fighting for control

why would one hub work and not the other
and only since the app update

*** Update

the hub in question mysteriously re-connected within the vera harmony app today
i got a notification that it reconnected
its been fine since

Hi @charettepa, good to hear the magic happened.

Hi Rene

Happy New Year to you.

I am trying to run a Sequence however I can’t get it working.

I have tried this command in a web brower

http://192.168.1.1/port_3480/data_request?id=lr_Harmony184&cmd=start_activity&cmdp1=“1444624”

1444624 is the Sequence ID I found in the Variables tab in Vera on the main Harmony device and 184 is its device number.

The browser returns:

{ “status”: “OK”, “msg”: “OK”, “data”: “1444624”, “code”: 200 }

But my Sequence is not run. It should start Spotify on my Fire TV stick.

If I run this “Spotify” sequence from the actual Harmony Elite remote it works fine and launches the Spotify app.

I then tried this command in the Vera - Apps - Develop Apps - Test Luup code (Lua) area

luup.call_action(“urn:rboer-com:serviceId:Harmony1”, “IssueSequenceCommand”,{SequenceID=”1444624”},184)

However it says it failed to test code.

Any idea what I am doing wrong ?

Thanks

EDIT:

I just got the luup.call_action command working in Vera.

Looks like there was something wrong with my quotes formatting.

I can also use the Sequence name rather than its ID number.

However the http command to run a sequence still doesn’t work.

Hi @cw-kid,

Good you got the luup.call_action command working. Looking at the code I forgot to add the sequence command to the http handler. I have some other fix pending, so I’ll add the command to the next release.

Update: V3.16 with the fix is available in the ALTUI App store and pending approval in the Mios App market. The GitHub wiki has been updated as well.

Cheers Rene

2 Likes

Hi @reneboer

Sorry if this has been asked before, I did search but didn’t find exactly what I am looking for.

I want to send a HTTP command to my FireTV stick to bring up a security cam in picture-in-picture, but only send that HTTP command in my Vera scene if the Harmony activity for the FireTV is the current activity ?

My coding isn’t the best, the plug-in help document states you can use this to get the current activity ID.

rc, rs, jb, rarg = luup.call_action("urn:rboer-com:serviceId:Harmony1",
"GetCurrentActivityID",{},184)
if (rc==0) then curActID = rarg.currentActivityID end

The ID of my Harmony hub in my lounge is Vera device ID 184.

I know the activity ID for the FireTV activity its ID number: 42772934

And this is the HTTP command I want to send in my scene, but only when the FireTV activity is the current one.

luup.inet.wget(“http://192.168.0.135:8765/?frontgarden=pip”)

Does anyone know how to code this together ?

Many thanks.

EDIT:

I thought this might work but it does not, no errors either.

local rc = luup.variable_get("urn:rboer-com:serviceId:Harmony1", "CurrentActivityID", 184)
if (rc==42772934)
 then
      luup.inet.wget("http://192.168.0.135:8765/?frontgarden=pip")
 end

This doesn’t work either

local rc = luup.call_action("urn:rboer-com:serviceId:Harmony1","GetCurrentActivityID",184)
if (rc==42772934)
 then
      luup.inet.wget("http://192.168.0.135:8765/?frontgarden=pip")
 end

EDIT 2:

OK this code works and only sends the PIP command to the FireTV stick if the Harmony FireTV is currently active.

if( luup.variable_get("urn:rboer-com:serviceId:Harmony1","CurrentActivityID",184)=="42772934" ) then
   luup.inet.wget("http://192.168.0.135:8765/?frontgarden=pip")
   else
end

Hi @reneboer

I’m on version 3.17 in AltUI on openluup, but it won’t update to the latest release when I click the “Update Now” button at the plugins screen. Is there any other way to update? Can I use a comparable URL as for Vera?

BTW. It says “GitHub.master” at the version column in the plugins screen. Is this normal?

Hi,
The github master is the latest.

Cheers Rene

O ok, but in the variables it still says 3.17. And the activities are not updated realtime (one of the latest features I read).

It seems something is corrupted, the plugin doesn’t react to anything. Can I reinitialize the plugin i some way or downgrade to a previous version or something? I don’t want to uninstall it, if I don’t have to.

You can try to put V4.1 in the version and try an update to see if that makes a difference. Check the startup log file as well to see if any errors occur.

Cheers Rene

I see this in the startup log:

openLuup.chdev:: [string "L_Harmony.lua"]:212: module 'cjson' not found:
	no field package.preload['cjson']
	no file './cjson.lua'
	no file '/usr/local/share/lua/5.1/cjson.lua'
	no file '/usr/local/share/lua/5.1/cjson/init.lua'
	no file '/usr/local/lib/lua/5.1/cjson.lua'
	no file '/usr/local/lib/lua/5.1/cjson/init.lua'
	no file '../cmh-lu/cjson.lua'
	no file 'files/cjson.lua'
	no file 'openLuup/cjson.lua'
	no file './cjson.so'
	no file '/usr/local/lib/lua/5.1/cjson.so'
	no file '/usr/local/lib/lua/5.1/loadall.so'
2020-07-07 10:32:07.341   luup.create_device:: [71] D_HarmonyDevice.xml / X / D_HarmonyDevice.json   (urn:schemas-rboer-com:device:HarmonyDevice:1)

Is cjson needed since one of the latest releases? I guess I’ve missed it. Could this be the cause of the issue? Will take it up with the creator of the docker of openluup.

Ok, this indeed was the problem. I installed cjson in the docker container and now everything is reacting again. Version is 4.3 now.

Is there an ‘easy’ way to delete the xml and json files that get created with the device id? I changed my devices id and would like to clean up the unused files.
Would executing this work
os.execute(“rm -rf /etc/cmh-ludl/D_Harmony97.json.lzo”)
os.execute(“rm -rf /etc/cmh-ludl/D_Harmony97.xml.lzo”)

I just did a little research and the -r is probably not necessary with specifying the exact filename but seems like it could be dangerous.
I am not extremely familiar with the unix commands.

Hi @RHCPNG,

I will have a look at scenario’s where cjson is not installed. The idea is that that will still work. It works for Vera so not sure why openLuup chokes on the same lines of code.

Cheers Rene

Hi @Tim88,

You can remove all files with the old device number yes. Do not use the -r option though. You should not need any option. Other way if to use WinSCP or program like that. It is always simpler if you can see what you are doing.

Cheers Rene

@reneboer

Hello

I am seeing this in my Luup Log

v:0x11422a8/NONE duplicate:1 <0x770ca520>
01	09/06/20 16:53:38.244	luup_require can't find cjson <0x770ca520>
06	09/06/20 16:53:38.248	Device_Variable::m_szValue_set device: 184 service: urn:rboer-com:serviceId:Harmony1 variable: LinkStatus was: Ok now: Starting... #hooks: 0 upnp: 0 skip: 0 v:0x117fce8/NONE duplicate:0 <0x770ca520>
06	09/06/20 16:53:38.250	Device_Variable::m_szValue_set device: 184 service: urn:rboer-com:serviceId:Harmony1 variable: IconSet was: 0 now: 3 #hooks: 0 upnp: 0 skip: 0 v:(nil)/NONE duplicate:0 <0x770ca520>

It might not be related to the Harmony plugin but could be ?

Any idea what is means?

Thanks.

Hi cw,

Yes the Harmony plugin looks for the cjson module as a faster alternative for dkjson. If cjson is not installed you will see the message, but there is no impact.

Cheers Rene

1 Like

Hi @Rene

I guess this is not currently possible ?

I have a Harmony Hub in my bedroom that runs my TV / Cambridge Audio amplifier (ceiling speakers) with ChromeCast video and Kodi HTPC.

In the bedroom, I also have another small Denon amplifier that is connected to a stereo ceiling speaker in the bathroom via cables. I have a ChromeCast Audio device connected to the Denon amp.

On the Harmony hub I have a “ChromeCast Audio” activity that just turns on the Denon amp and sets it to the correct AUX input for the ChromeCast Audio etc.

In the bathroom I have a ceiling mounted Google Home Mini and its default playback device is the Denon amp / ChromeCast Audio in the bedroom.

Sorry for the long background explaination, now here is my question.

I guess its not possible to have a child device of the activities of the Harmony hub in the bedroom, e.g. to have a child device in Vera in the bathroom room that just has the “ChromeCast Audio” activity button on it.

With the Harmony plugin for Vera, I can create a child device for a “Harmony device” and add buttons on to the child device for the Harmony devices command buttons.

But I cannot create a child device that has only one activity button and put that child device in a different room to where the Harmony hub is located.

Hope this makes sense? I feel I am not explaining myself very well.

Cheers

Ideally I would like a “child” device like this one I have just made in MS Paint:

image

Where the child device not only has activity buttons you can assign to it, but it also has a button for turning on / off that particular Harmony activity.

As I said my Harmony hub is in my bedroom room.

But I want this child device in my bathroom room.