Wow. I go to bed having thrown out a suggestion and when I wake up Dan's @ogiewon already done it! Thanks Dan
I've replaced my bodged custom code with Dan's latest version from github and it all works beautifully. It's much better than hard coding the various device commands into the driver like I did and gives total flexibility to send any command to any device in the future.
This driver officially rocks!
I've been playing around with my own driver to implement something like this.
If you want to get really detailed,
You could have a custom driver with various buttons as commands (similar to a remote). Then have an input setting for each that allows you to pick the command that gets executed when that button is pressed. Its like assigning the command to the button on the harmony remote.
All of the commands available to that device are actually exposed in the json responses under "device". You can parse them out there and drop them in the device data section so they can be used in the input.
I don't think we care about the state of the device. Just sending the command. Kind of like how a dumb remote works.
All this is in theory. I'm playing around with it on my own app but thought I would share a way that it could possibly be done.
I think @armand's Roku TV integration, which I've found to be very useful, works something like that.
Dan - just got a chance to try it out. It works very well! Thank you so much for considering and implementing @Geoff_T's suggestion.
Yep, this all makes sense to me as well. I was considering a very similar approach last night as well. To me, though, it seems like a ton of work that has very little reward for my personal use-case. I know that this is valuable to some users, so I am not trying to stifle anyone's creativity. I look forward to seeing what you come up with. Please feel free to borrow as much code from my Harmony Hub Driver as you'd like!
No worries @adiventure! I wasn't trying to unload on you whatsoever. Sorry if I came across that way.
I am always willing to evaluate and incorporate changes from other users. Or, if someone is willing to build a better solution altogether, I am happy to let them take over as the new czar of Harmony Hub integrations. My feelings really would not be hurt. I wrote this integration because I like solving problems/puzzles like this. I selfishly focused on what was most important to me and my family. After the initial challenge is complete, my focus/interest usually moves elsewhere for a while. I am happy to make changes based on user feedback, as long as what is being asked for is useful to many and within my skill-set to implement in a reasonable time-frame. Last night's tweaks were very simple to implement. Adding new child devices that correspond to each Harmony Device appeared to me like a significant refactoring of the existing code base. A worthwhile endeavor, however not one that I feel I have the time for right now.
This is what I did on my end. It wasn't really hard at all. I can share the relevant pieces of code via pm if you want and you may have to adapt it a bit to your code but should be easy.
My devices and activities all show up as child devices to my hub.
Then in each device I have the relevant commands and the options to assign (I've only done power for now). I store the data in the data section to use.
Just finished it and did some quick tests and it works. I can send commands without affecting the activities. I was going to look into the hub json responses a bit and see if I could auto assign the commands based on how the remote is setup and if I can it will stay in sync with how the remote is configured. I would just have to actually look at the remote assignments in device mode and not in the activity mode. May or may not be possible or worth it.
@ogiewon, I'm getting the following error all of a sudden:
2020-02-05 09:12:46.495 am errororg.apache.http.conn.ConnectTimeoutException: Connect to 192.168.1.175:8088 [/192.168.1.175] failed: connect timed out on line 250 (updated)
Is your Harmony Hub up and running? Is its address still 192.168.1.175?
Hub was always up and running. I just rebooted it and it seems to have fixed the issue.
Just had a hub crash and went back in the logs and found this. Anything I can do / update ?
That’s normal behavior. I don’t believe that had anything to do with your hub crashing.
Thats a weird one cause I PM'd bobby the same screenshot and he said "thats concerning behaviour". But if its normal, i'll leave it at that.
I've also seen this for a long time, yet everything works fine, and no crashes here
It simply means the webSocket connection was dropped for some reason, and then automatically reconnected.
Hi Dan, after updating to the newest driver, when I try to add the new deviceCommand to a rule in RM, the command doesn't seem to go through and I'm seeing an error from the Harmony parent device. Have I entered something incorrectly into the rule?
The relevant part of the rule:
The Harmony device error:
[error] groovy.lang.MissingMethodException: No signature of method: user_driver_ogiewon_Logitech_Harmony_Hub_Parent_907.deviceCommand() is applicable for argument types: (java.lang.String) values: [("PowerOn", 64005682)]
The rule is triggering/executing as it should, I believe, and the deviceID is pasted from the Harmony parent device's settings page.
Thanks for any suggestions.
Hmmm... Does Rule Machine not allow passing multiple parameters to a custom command? The deviceCommand() expects a string for the command and a number for the device.
command "deviceCommand", ["String", "Number"]
Ah, I see what I was doing. It should be two parameters for the custom command in RM, one string and one number. I was entering one string with both values. Now the error has gone away, but the device still isn't turning on . One step closer at least, will have to keep looking into it. Thanks!
Edit: Now I've got it. Quotes around "PowerOn" doesn't work, but PowerOn does. This is great, thanks!!
I've been following the Harmony Hub Driver for the past weeks and I must say that this deviceCommand new feature is great and made many new home automations possible with Harmony. Thanks @ogiewon !
@gavincampbell what you did looks nice too and I was wondering if you had the pieces of code available to look into it ? I'd like to try to have the devices show up as child devices too. And I don't think ogiewon has plans to adapt it to his code at the moment ?
Thanks again, great job ! I'm only starting to modify drivers and I'm still learning but I found all the possibilities very interesting!
Cheers from France.