how to activate autodiscovery - installed the plugin, created a new HarmonyHubActivitiesButtonsDevice - but didn’t find the id’s. I enable debug mode - but couldn’t find somethin in the log.
-
New Plugin for Logitech Harmony Hub
-
@vivathan said in New Plugin for Logitech Harmony Hub:
how to activate autodiscovery
check here
https://forum.pimatic.org/topic/1919/v0-9-autodiscovery-of-devicespimatic v0.9 has been released!
Support Pimatic and get some free stickers
Like us on Facebookmake it so !
-
Thx! I missed this
-
@thex: Thx for this great plugin. Using it since yesterday.
Is it right that it*s currently not possible to make a long press like:
if... then press aButton for 3 seconds
Some devices can be controled via only one power button. Depending from the time the button is pressed it will be powered on or off.
Could this be it will be powered on or off implemented? -
I don’t know if the button device in general has the option to do this… as far as I remember it does only have one pressed action, there is no event for the release.
Technically it should be possible however I’m afraid I won’t find time for it anytime soon.
-
hi there!
yesterday i installed this plugin. as it is now possible again to enable xmpp on the hub it works really nice. but what i would like to know: what happened to the follwing? is there any kind of event triggered by this plugin?@partovic said in New Plugin for Logitech Harmony Hub:
Would be cool to have a CurrentActivity Variable to access in rules. Something like
when Activity of HarmonyBridge changes to "FireTV+Beamer" then lower Leinwand
.This should be realizeable doesn’t it?
Edit: At least, according to this https://github.com/maddox/harmony-api
@thex said in New Plugin for Logitech Harmony Hub:
Should be possible but I think I need to pull this as the client doesn’t get notified on changes. So there would be a delay as you should not pull this every second or so.
-
Not implemented yet and currently not planned to as I’m triggering all actions from pimatic and don’t even use a physical harmony remote or the harmony scenes.
-
not good to read this (for me) but thanks for the feedback. so if you don’t use a remote i think there is in general no possibility (with this plugin) to react on any kind of key press and i have to switch to lirc?
-
Yes, I guess lirc or similar is the easiest, just set it to a device you don’t have and interpret the IR commands.
As far as I know harmony also supports hue so maybe you can also achieve something with a fake hue bridge where the fake bulbs are present in Harmony as well as Pimatic.
The only way currently would be to pull the changes, if you can/want to implement that I’m happy to integrate the pull-request.
-
Maybe a little off-topic: Logitech disabled local access via XMPP in late 2018 to fix security vulnerabilities as they stated in the release. As the user
community screamed, Logitech decided to re-enable the feature and announced another firmware which has been released
in early 2019. It should be noted however, the newer firmware release have XMPP support disabled by default and can be enabled with Harmony App.
@thex I think it would be I good idea to add a short note to the README about how to enable XMPP support on the hub.https://github.com/thexperiments/pimatic-harmonyhub/issues/5
"It always takes longer than you expect, even when you take into account Hofstadter's Law.", Hofstadter's Law
-
good Idea, will do
-
@thex said in New Plugin for Logitech Harmony Hub:
if you can/want to implement that
i’m completely new to coffee script. i can develop in c, c++ an c#…
am i right, that in the constructor of the device i have have to do something like
on(event...
class HarmonyHubPowerSwitch extends env.devices.PowerSwitch # constructor: (@config, @plugin, lastState) -> @name = @config.name @id = @config.id @hubIP = @config.hubIP @commandType = @config.commandType @onCommand = @config.onCommand @offCommand = @config.offCommand @deviceId = @config.deviceId #new code HarmonyHubClient.on('stateDigest', ...) super()
at least according to line 59 on https://github.com/swissmanu/harmonyhubjs-client/blob/develop/lib/harmonyclient.js
could this be right somehow?
-
@quotschmacher Yes, that’s a good starting point. Make sure indentations are two spaces, e.g. a block is indented by two spaces.
class HarmonyHub extends env.plugins.Plugin ... registerStateDigestHandler: (hubIP, handler) => @getHubInstance(@hubIP).then () => @hubInstance.on 'stateDigest', handler env.logger.debug 'received state digest', JSON.stringify(stateDigest) ... class HarmonyHubPowerSwitch extends env.devices.PowerSwitch # constructor: (@config, @plugin, lastState) -> @name = @config.name @id = @config.id @hubIP = @config.hubIP @commandType = @config.commandType @onCommand = @config.onCommand @offCommand = @config.offCommand @deviceId = @config.deviceId #new code @plugin.registerStateDigestHandler('stateDigest', (stateDigest) => env.logger.debug 'received state digest', JSON.stringify(stateDigest) # just an example (i am not sure about the exact structure of the stateDigest object) # the corresponding stanza is documented here: # https://github.com/swissmanu/harmonyhubjs-client/blob/develop/docs/protocol/stateDigest.md if stateDigest.data.activityStatus is 0 @_setState false else @_setState true ) super()
"It always takes longer than you expect, even when you take into account Hofstadter's Law.", Hofstadter's Law
-
ok. thanks. i will give it a try, when i find some spare time…
-
@quotschmacher No worries. Please also note my edit to the code snippet above. I revisited the code and noticed that you’ll need to register the handler with a hub instance instead of the HarmonyHubClient object type. As instance handling is implemented as part of the plugin class which provides methods for devices to perform activities and such, my suggestion is to add another method to the plugin class which I called
registerStateDigestHandler
. This method then can be used as part of the power switch device code to register a handler in the context of the device instance."It always takes longer than you expect, even when you take into account Hofstadter's Law.", Hofstadter's Law
-
@mwittig i gave it a try… implemented both
class HarmonyHub extends env.plugins.Plugin init: (app, @framework, @config) => ... registerStateDigestHandler: (hubIP, handler) => @getHubInstance(@hubIP).then () => @hubInstance.on 'stateDigest', handler env.logger.debug("state digest handler") sendHarmonyHubCommand: (hubIP, command, commandType, deviceId) =>
and
class HarmonyHubActivitiesButtonsDevice extends env.devices.ButtonsDevice constructor: (@config, @plugin) -> ... env.logger.debug("test eintrag") @Plugin.registerStateDigestHandler('stateDigest', (activityId, activityStatus) => env.logger.debug("event ausgeloest") ) super(@config)
but when i start pimatic a error is thrown:
19:08:42.852 [pimatic-harmonyhub] test eintrag 19:08:42.854 [pimatic] Error loading device "activities-192-168.188.23": Cannot read property 'registerStateDigestHandler' of undefined 19:08:42.864 [pimatic] TypeError: Cannot read property 'registerStateDigestHandler' of undefined 19:08:42.864 [pimatic]> at new HarmonyHubActivitiesButtonsDevice (/home/ubuntu/pimatic-dev/node_modules/pimatic-harmonyhub/harmonyhub.coffee:295:14) 19:08:42.864 [pimatic]> at Object.framework.deviceManager.registerDeviceClass.createCallback (/home/ubuntu/pimatic-dev/node_modules/pimatic-harmonyhub/harmonyhub.coffee:61:18) 19:08:42.864 [pimatic]> at DeviceManager._loadDevice (/home/ubuntu/pimatic-dev/node_modules/pimatic/lib/devices.coffee:1517:26) 19:08:42.864 [pimatic]> at /home/ubuntu/pimatic-dev/node_modules/pimatic/lib/devices.coffee:1546:16 19:08:42.864 [pimatic]> at tryCatcher (/home/ubuntu/pimatic-dev/node_modules/pimatic/node_modules/bluebird/js/release/util.js:16:23) 19:08:42.864 [pimatic]> at Promise._settlePromiseFromHandler (/home/ubuntu/pimatic-dev/node_modules/pimatic/node_modules/bluebird/js/release/promise.js:512:31) 19:08:42.864 [pimatic]> at Promise._settlePromise (/home/ubuntu/pimatic-dev/node_modules/pimatic/node_modules/bluebird/js/release/promise.js:569:18) 19:08:42.864 [pimatic]> at Promise._fulfillPromises (/home/ubuntu/pimatic-dev/node_modules/pimatic/node_modules/bluebird/js/release/promise.js:669:14) 19:08:42.864 [pimatic]> at Promise._settlePromises (/home/ubuntu/pimatic-dev/node_modules/pimatic/node_modules/bluebird/js/release/promise.js:695:18) 19:08:42.864 [pimatic]> at _drainQueueStep (/home/ubuntu/pimatic-dev/node_modules/pimatic/node_modules/bluebird/js/release/async.js:138:12) 19:08:42.864 [pimatic]> at _drainQueue (/home/ubuntu/pimatic-dev/node_modules/pimatic/node_modules/bluebird/js/release/async.js:131:9) 19:08:42.864 [pimatic]> at Async._drainQueues (/home/ubuntu/pimatic-dev/node_modules/pimatic/node_modules/bluebird/js/release/async.js:147:5) 19:08:42.864 [pimatic]> at Immediate.Async.drainQueues [as _onImmediate] (/home/ubuntu/pimatic-dev/node_modules/pimatic/node_modules/bluebird/js/release/async.js:17:14) 19:08:42.864 [pimatic]> at processImmediate [as _immediateCallback] (timers.js:383:17)
any ideas?
-
@quotschmacher said in New Plugin for Logitech Harmony Hub:
any ideas?
Sorry, my fault. Try
@plugin
instead of@Plugin
, i.e.class HarmonyHubActivitiesButtonsDevice extends env.devices.ButtonsDevice constructor: (@config, @plugin) -> ... env.logger.debug("test eintrag") @plugin.registerStateDigestHandler('stateDigest', (activityId, activityStatus) => env.logger.debug("event ausgeloest") ) super(@config)
"It always takes longer than you expect, even when you take into account Hofstadter's Law.", Hofstadter's Law
-
this error is gone, next error solved by putting ‘super’ before the register method. new error is
22:20:49.912 [pimatic] TypeError: Cannot read property 'on' of undefined 22:20:49.912 [pimatic]> at HarmonyHub.registerStateDigestHandler (/home/ubuntu/pimatic-dev/node_modules/pimatic-harmonyhub/harmonyhub.coffee:155:19)
some googling says this is because the event function in harmonyclient.js has no return value.
function onStateDigest (stateDigest) { debug('received state digest') this.emit('stateDigest', stateDigest) }
as far as i can see i can’t get the result i want without any changes in harmonyclient.js, am i right?
-
@quotschmacher I think the problem is the indentation of the Promise function as part of the registerStateDigestHandler function
class HarmonyHub extends env.plugins.Plugin init: (app, @framework, @config) => ... registerStateDigestHandler: (hubIP, handler) => @getHubInstance(@hubIP).then () => @hubInstance.on 'stateDigest', handler env.logger.debug("state digest handler")
"It always takes longer than you expect, even when you take into account Hofstadter's Law.", Hofstadter's Law