Comments (11)
yesterday i had several problems with my hubs too.
maybe something on the Logitech server side was broken.
from harmony-api.
EDIT: Back down again, the same issue continues for me
You may well be right, funny timing that I decided to get it running and test it yesterday...I've been running for a couple of hours this morning without issue which I wasn't able to do yesterday
from harmony-api.
Having the same issue here since a week or so: Hub will get lost after a while after which harmony-api has to be restarted to bring it back.
from harmony-api.
I`m having the same issues :-(
from harmony-api.
Same boat, it's like its stuck on updating state
from harmony-api.
Has anybody found a solution for this? It keeps loosing the hub
from harmony-api.
I'm using the api with node-red - for whatever its worth, I solved (okay, well, wrote around) this issue by periodically polling the activity. If the response contains "No" (As in ""No hubs available") the flow runs systemctl stop harmony-api-server.service
, waits 20 seconds and then runs systemctl start harmony-api-server.service
.
It also does the same if it gets "ECONNREFUSED" like if the api crashed.
It's been pretty rock solid that way for months.
from harmony-api.
I think I found a very simple solution to this issue. The underlying XMPP client seems to disconnect after about 62 seconds. All that's needed is to set reconnect: true
when creating this client. I've created a PR for harmonyhub-client to address this: swissmanu/harmonyhubjs-client#42
from harmony-api.
I'm using the api with node-red - for whatever its worth, I solved (okay, well, wrote around) this issue by periodically polling the activity. If the response contains "No" (As in ""No hubs available") the flow runs
systemctl stop harmony-api-server.service
, waits 20 seconds and then runssystemctl start harmony-api-server.service
.It also does the same if it gets "ECONNREFUSED" like if the api crashed.
It's been pretty rock solid that way for months.
Hey mate,
Could you share your flow for this?
Never tinkered with node-red so not really sure where to start.
Thanks
from harmony-api.
Hey mate,
Could you share your flow for this?
Never tinkered with node-red so not really sure where to start.
Thanks
I was about to comment "wow, I did the same thing" and realized - that was my comment from 6 years ago.
So with the caveat that this is janky work I did years ago, but the note that - I'm still using it exactly like this just fine - this is my "harmony probe" subflow. I'm using it in a flow that connects custom control panels with illuminated status indicators to their relevant appliances. This subflow is polled whenver a panel requests the current system status, and it returns some weirdly named parameters that something later interprets what light to turn on, and if it doesn't detect the hub, or connection is refused, it kills the process and respawns it.
I think, this might not be the right way to do this because I might have had to run node-red as root to do this? Which is really something to avoid. think I had to add nodered user to sudoers which, is possibly inadvisable. I had no idea what I was doing.
So - strictly as a starting point here's my subflow, you'll need to specify the api IP and hub name of your setup.
{
"id": "d5d40326.4ca4f",
"type": "subflow",
"name": "Harmony-Probe",
"info": "",
"in": [
{
"x": 58.571428298950195,
"y": 888.5714874267578,
"wires": [
{
"id": "5f8f09c1.2a0b18"
}
]
}
],
"out": [
{
"x": 1421.8571395874023,
"y": 890.2855060100555,
"wires": [
{
"id": "b4bba93e.d8a9d8",
"port": 0
}
]
},
{
"x": 1480.0000686645508,
"y": 937.9999301433563,
"wires": [
{
"id": "12073f57.1e6611",
"port": 0
}
]
},
{
"x": 1481.6747093200684,
"y": 1000.2379760742188,
"wires": [
{
"id": "daa9b85.ebcaf48",
"port": 0
}
]
}
]
},
{
"id": "5f8f09c1.2a0b18",
"type": "http request",
"z": "d5d40326.4ca4f",
"name": "Harmony",
"method": "GET",
"ret": "obj",
"paytoqs": "ignore",
"url": "http://[HARMONY-API-IP-GOES-HERE]/hubs/harmony-hub/status",
"tls": "",
"persist": false,
"proxy": "",
"authType": "",
"credentials": {},
"x": 240.00000762939453,
"y": 965.9999768733978,
"wires": [
[
"96eaf6a.8847d08",
"6d27df60.58e0a",
"5a9a8889.ac76e8"
]
]
},
{
"id": "58ef6d6d.164cc4",
"type": "switch",
"z": "d5d40326.4ca4f",
"name": "Is the TV On?",
"property": "payload.off",
"propertyType": "msg",
"rules": [
{
"t": "false"
},
{
"t": "else"
}
],
"checkall": "true",
"outputs": 2,
"x": 556.9047546386719,
"y": 942.7300243377686,
"wires": [
[
"ecb51d23.3b5a3"
],
[
"daa9b85.ebcaf48"
]
]
},
{
"id": "ecb51d23.3b5a3",
"type": "switch",
"z": "d5d40326.4ca4f",
"name": "Whats The Activity",
"property": "payload.current_activity.slug",
"propertyType": "msg",
"rules": [
{
"t": "cont",
"v": "watch-tv",
"vt": "str"
},
{
"t": "cont",
"v": "watch-roku",
"vt": "str"
}
],
"checkall": "true",
"outputs": 2,
"x": 864.8571701049805,
"y": 946.2857491970062,
"wires": [
[
"b4bba93e.d8a9d8"
],
[
"12073f57.1e6611"
]
]
},
{
"id": "b4bba93e.d8a9d8",
"type": "change",
"z": "d5d40326.4ca4f",
"name": "Ok, TV it is. ",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "TEEVEE",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1271.8571395874023,
"y": 890.2855060100555,
"wires": [
[]
]
},
{
"id": "12073f57.1e6611",
"type": "change",
"z": "d5d40326.4ca4f",
"name": "I guess it's Roku then. ",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "ROKEEE",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1300.0000686645508,
"y": 937.9999301433563,
"wires": [
[]
]
},
{
"id": "daa9b85.ebcaf48",
"type": "change",
"z": "d5d40326.4ca4f",
"name": "Television is a wasteland. ",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "BULLSHIT",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1302.8571243286133,
"y": 986.8571412563324,
"wires": [
[]
]
},
{
"id": "b06467c9.7497d8",
"type": "comment",
"z": "d5d40326.4ca4f",
"name": "Yes",
"info": "",
"x": 704.7142333984375,
"y": 951.1428229808807,
"wires": []
},
{
"id": "c228b8f6.a87048",
"type": "comment",
"z": "d5d40326.4ca4f",
"name": "No",
"info": "",
"x": 704.7142944335938,
"y": 985.4286410808563,
"wires": []
},
{
"id": "2f38360a.90e91a",
"type": "comment",
"z": "d5d40326.4ca4f",
"name": "msg cntains \"watch-tv\"",
"info": "",
"x": 1068.2857208251953,
"y": 892.5714123249054,
"wires": []
},
{
"id": "5747c21f.c9344c",
"type": "comment",
"z": "d5d40326.4ca4f",
"name": "msg ctns \"watch-roku\"",
"info": "",
"x": 1081.1428909301758,
"y": 939.7143838405609,
"wires": []
},
{
"id": "96eaf6a.8847d08",
"type": "switch",
"z": "d5d40326.4ca4f",
"name": "",
"property": "payload",
"propertyType": "msg",
"rules": [
{
"t": "cont",
"v": "ECONNREFUSED ",
"vt": "str"
},
{
"t": "else"
}
],
"checkall": "true",
"outputs": 2,
"x": 289.78570556640625,
"y": 887.4285278320312,
"wires": [
[
"972b9223.21b3f"
],
[
"58ef6d6d.164cc4"
]
]
},
{
"id": "78d58146.b91c7",
"type": "debug",
"z": "d5d40326.4ca4f",
"name": "",
"active": true,
"console": "false",
"complete": "false",
"x": 547.0396537780762,
"y": 983.4127655029297,
"wires": []
},
{
"id": "972b9223.21b3f",
"type": "exec",
"z": "d5d40326.4ca4f",
"command": "/usr/bin/sudo",
"addpay": false,
"append": "systemctl stop harmony-api-server.service",
"useSpawn": "",
"timer": "",
"name": "Stop-Harmony",
"x": 355.28570556640625,
"y": 1031.7144165039062,
"wires": [
[
"13b261ca.e353de"
],
[
"13b261ca.e353de"
],
[
"13b261ca.e353de"
]
]
},
{
"id": "db35537f.99d05",
"type": "exec",
"z": "d5d40326.4ca4f",
"command": "/usr/bin/sudo",
"addpay": false,
"append": "systemctl start harmony-api-server.service",
"useSpawn": "",
"timer": "",
"name": "Start-Harmony",
"x": 634.5714073181152,
"y": 1092.7143211364746,
"wires": [
[
"21e8f856.94e998"
],
[
"21e8f856.94e998"
],
[
"21e8f856.94e998"
]
]
},
{
"id": "13b261ca.e353de",
"type": "delay",
"z": "d5d40326.4ca4f",
"name": "",
"pauseType": "delay",
"timeout": "20",
"timeoutUnits": "seconds",
"rate": "1",
"nbRateUnits": "1",
"rateUnits": "second",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": false,
"outputs": 1,
"x": 290.6785888671875,
"y": 1099.500207901001,
"wires": [
[
"b526a47f.4fde28"
]
]
},
{
"id": "a849a4da.915538",
"type": "delay",
"z": "d5d40326.4ca4f",
"name": "",
"pauseType": "delay",
"timeout": "45",
"timeoutUnits": "seconds",
"rate": "1",
"nbRateUnits": "1",
"rateUnits": "second",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": false,
"outputs": 1,
"x": 768.5714416503906,
"y": 1040.464267730713,
"wires": [
[
"5f8f09c1.2a0b18"
]
]
},
{
"id": "6d27df60.58e0a",
"type": "debug",
"z": "d5d40326.4ca4f",
"name": "",
"active": true,
"console": "false",
"complete": "payload",
"x": 529.2857142857142,
"y": 701.4285714285713,
"wires": []
},
{
"id": "b526a47f.4fde28",
"type": "delay",
"z": "d5d40326.4ca4f",
"name": "",
"pauseType": "rate",
"timeout": "5",
"timeoutUnits": "seconds",
"rate": "1",
"nbRateUnits": "5",
"rateUnits": "second",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": true,
"outputs": 1,
"x": 447.85713195800776,
"y": 1098.5713558197021,
"wires": [
[
"db35537f.99d05"
]
]
},
{
"id": "21e8f856.94e998",
"type": "delay",
"z": "d5d40326.4ca4f",
"name": "",
"pauseType": "rate",
"timeout": "5",
"timeoutUnits": "seconds",
"rate": "1",
"nbRateUnits": "5",
"rateUnits": "second",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": true,
"outputs": 1,
"x": 592.8571510314941,
"y": 1040.0000343322754,
"wires": [
[
"a849a4da.915538"
]
]
},
{
"id": "5a9a8889.ac76e8",
"type": "switch",
"z": "d5d40326.4ca4f",
"name": "",
"property": "payload.message",
"propertyType": "msg",
"rules": [
{
"t": "cont",
"v": "No",
"vt": "str"
}
],
"checkall": "true",
"outputs": 1,
"x": 293.3333053588867,
"y": 841.6665992736816,
"wires": [
[
"78d58146.b91c7",
"972b9223.21b3f"
]
]
},
{
"id": "694e9f66.48f01",
"type": "split",
"z": "d5d40326.4ca4f",
"name": "",
"splt": "\\n",
"spltType": "str",
"arraySplt": 1,
"arraySpltType": "len",
"stream": false,
"addname": "",
"x": 326.5,
"y": 255,
"wires": [
[]
]
}
]```
from harmony-api.
Hey mate,
Could you share your flow for this?
Never tinkered with node-red so not really sure where to start.
ThanksI was about to comment "wow, I did the same thing" and realized - that was my comment from 6 years ago.
So with the caveat that this is janky work I did years ago, but the note that - I'm still using it exactly like this just fine - this is my "harmony probe" subflow. I'm using it in a flow that connects custom control panels with illuminated status indicators to their relevant appliances. This subflow is polled whenver a panel requests the current system status, and it returns some weirdly named parameters that something later interprets what light to turn on, and if it doesn't detect the hub, or connection is refused, it kills the process and respawns it.
I think, this might not be the right way to do this because I
might have had to run node-red as root to do this? Which is really something to avoid.think I had to add nodered user to sudoers which, is possibly inadvisable. I had no idea what I was doing.So - strictly as a starting point here's my subflow, you'll need to specify the api IP and hub name of your setup.
{ "id": "d5d40326.4ca4f", "type": "subflow", "name": "Harmony-Probe", "info": "", "in": [ { "x": 58.571428298950195, "y": 888.5714874267578, "wires": [ { "id": "5f8f09c1.2a0b18" } ] } ], "out": [ { "x": 1421.8571395874023, "y": 890.2855060100555, "wires": [ { "id": "b4bba93e.d8a9d8", "port": 0 } ] }, { "x": 1480.0000686645508, "y": 937.9999301433563, "wires": [ { "id": "12073f57.1e6611", "port": 0 } ] }, { "x": 1481.6747093200684, "y": 1000.2379760742188, "wires": [ { "id": "daa9b85.ebcaf48", "port": 0 } ] } ] }, { "id": "5f8f09c1.2a0b18", "type": "http request", "z": "d5d40326.4ca4f", "name": "Harmony", "method": "GET", "ret": "obj", "paytoqs": "ignore", "url": "http://[HARMONY-API-IP-GOES-HERE]/hubs/harmony-hub/status", "tls": "", "persist": false, "proxy": "", "authType": "", "credentials": {}, "x": 240.00000762939453, "y": 965.9999768733978, "wires": [ [ "96eaf6a.8847d08", "6d27df60.58e0a", "5a9a8889.ac76e8" ] ] }, { "id": "58ef6d6d.164cc4", "type": "switch", "z": "d5d40326.4ca4f", "name": "Is the TV On?", "property": "payload.off", "propertyType": "msg", "rules": [ { "t": "false" }, { "t": "else" } ], "checkall": "true", "outputs": 2, "x": 556.9047546386719, "y": 942.7300243377686, "wires": [ [ "ecb51d23.3b5a3" ], [ "daa9b85.ebcaf48" ] ] }, { "id": "ecb51d23.3b5a3", "type": "switch", "z": "d5d40326.4ca4f", "name": "Whats The Activity", "property": "payload.current_activity.slug", "propertyType": "msg", "rules": [ { "t": "cont", "v": "watch-tv", "vt": "str" }, { "t": "cont", "v": "watch-roku", "vt": "str" } ], "checkall": "true", "outputs": 2, "x": 864.8571701049805, "y": 946.2857491970062, "wires": [ [ "b4bba93e.d8a9d8" ], [ "12073f57.1e6611" ] ] }, { "id": "b4bba93e.d8a9d8", "type": "change", "z": "d5d40326.4ca4f", "name": "Ok, TV it is. ", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "TEEVEE", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1271.8571395874023, "y": 890.2855060100555, "wires": [ [] ] }, { "id": "12073f57.1e6611", "type": "change", "z": "d5d40326.4ca4f", "name": "I guess it's Roku then. ", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "ROKEEE", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1300.0000686645508, "y": 937.9999301433563, "wires": [ [] ] }, { "id": "daa9b85.ebcaf48", "type": "change", "z": "d5d40326.4ca4f", "name": "Television is a wasteland. ", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "BULLSHIT", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1302.8571243286133, "y": 986.8571412563324, "wires": [ [] ] }, { "id": "b06467c9.7497d8", "type": "comment", "z": "d5d40326.4ca4f", "name": "Yes", "info": "", "x": 704.7142333984375, "y": 951.1428229808807, "wires": [] }, { "id": "c228b8f6.a87048", "type": "comment", "z": "d5d40326.4ca4f", "name": "No", "info": "", "x": 704.7142944335938, "y": 985.4286410808563, "wires": [] }, { "id": "2f38360a.90e91a", "type": "comment", "z": "d5d40326.4ca4f", "name": "msg cntains \"watch-tv\"", "info": "", "x": 1068.2857208251953, "y": 892.5714123249054, "wires": [] }, { "id": "5747c21f.c9344c", "type": "comment", "z": "d5d40326.4ca4f", "name": "msg ctns \"watch-roku\"", "info": "", "x": 1081.1428909301758, "y": 939.7143838405609, "wires": [] }, { "id": "96eaf6a.8847d08", "type": "switch", "z": "d5d40326.4ca4f", "name": "", "property": "payload", "propertyType": "msg", "rules": [ { "t": "cont", "v": "ECONNREFUSED ", "vt": "str" }, { "t": "else" } ], "checkall": "true", "outputs": 2, "x": 289.78570556640625, "y": 887.4285278320312, "wires": [ [ "972b9223.21b3f" ], [ "58ef6d6d.164cc4" ] ] }, { "id": "78d58146.b91c7", "type": "debug", "z": "d5d40326.4ca4f", "name": "", "active": true, "console": "false", "complete": "false", "x": 547.0396537780762, "y": 983.4127655029297, "wires": [] }, { "id": "972b9223.21b3f", "type": "exec", "z": "d5d40326.4ca4f", "command": "/usr/bin/sudo", "addpay": false, "append": "systemctl stop harmony-api-server.service", "useSpawn": "", "timer": "", "name": "Stop-Harmony", "x": 355.28570556640625, "y": 1031.7144165039062, "wires": [ [ "13b261ca.e353de" ], [ "13b261ca.e353de" ], [ "13b261ca.e353de" ] ] }, { "id": "db35537f.99d05", "type": "exec", "z": "d5d40326.4ca4f", "command": "/usr/bin/sudo", "addpay": false, "append": "systemctl start harmony-api-server.service", "useSpawn": "", "timer": "", "name": "Start-Harmony", "x": 634.5714073181152, "y": 1092.7143211364746, "wires": [ [ "21e8f856.94e998" ], [ "21e8f856.94e998" ], [ "21e8f856.94e998" ] ] }, { "id": "13b261ca.e353de", "type": "delay", "z": "d5d40326.4ca4f", "name": "", "pauseType": "delay", "timeout": "20", "timeoutUnits": "seconds", "rate": "1", "nbRateUnits": "1", "rateUnits": "second", "randomFirst": "1", "randomLast": "5", "randomUnits": "seconds", "drop": false, "outputs": 1, "x": 290.6785888671875, "y": 1099.500207901001, "wires": [ [ "b526a47f.4fde28" ] ] }, { "id": "a849a4da.915538", "type": "delay", "z": "d5d40326.4ca4f", "name": "", "pauseType": "delay", "timeout": "45", "timeoutUnits": "seconds", "rate": "1", "nbRateUnits": "1", "rateUnits": "second", "randomFirst": "1", "randomLast": "5", "randomUnits": "seconds", "drop": false, "outputs": 1, "x": 768.5714416503906, "y": 1040.464267730713, "wires": [ [ "5f8f09c1.2a0b18" ] ] }, { "id": "6d27df60.58e0a", "type": "debug", "z": "d5d40326.4ca4f", "name": "", "active": true, "console": "false", "complete": "payload", "x": 529.2857142857142, "y": 701.4285714285713, "wires": [] }, { "id": "b526a47f.4fde28", "type": "delay", "z": "d5d40326.4ca4f", "name": "", "pauseType": "rate", "timeout": "5", "timeoutUnits": "seconds", "rate": "1", "nbRateUnits": "5", "rateUnits": "second", "randomFirst": "1", "randomLast": "5", "randomUnits": "seconds", "drop": true, "outputs": 1, "x": 447.85713195800776, "y": 1098.5713558197021, "wires": [ [ "db35537f.99d05" ] ] }, { "id": "21e8f856.94e998", "type": "delay", "z": "d5d40326.4ca4f", "name": "", "pauseType": "rate", "timeout": "5", "timeoutUnits": "seconds", "rate": "1", "nbRateUnits": "5", "rateUnits": "second", "randomFirst": "1", "randomLast": "5", "randomUnits": "seconds", "drop": true, "outputs": 1, "x": 592.8571510314941, "y": 1040.0000343322754, "wires": [ [ "a849a4da.915538" ] ] }, { "id": "5a9a8889.ac76e8", "type": "switch", "z": "d5d40326.4ca4f", "name": "", "property": "payload.message", "propertyType": "msg", "rules": [ { "t": "cont", "v": "No", "vt": "str" } ], "checkall": "true", "outputs": 1, "x": 293.3333053588867, "y": 841.6665992736816, "wires": [ [ "78d58146.b91c7", "972b9223.21b3f" ] ] }, { "id": "694e9f66.48f01", "type": "split", "z": "d5d40326.4ca4f", "name": "", "splt": "\\n", "spltType": "str", "arraySplt": 1, "arraySpltType": "len", "stream": false, "addname": "", "x": 326.5, "y": 255, "wires": [ [] ] } ]```
Thanks the reply!
The Length of your reply scared me abit haha, so had one more go at a โsimplerโ solution.
Ended up finding a way for a Siri shortcut to be constantly running/checking the status of the hub and then running a command via terminal if it detects it not running. Much like your setup.
This is the Siri shortcut if anyone is curious, it possibly could be optimised.
https://www.icloud.com/shortcuts/d18cdafbee1448d0940ed811a3156f03
from harmony-api.
Related Issues (20)
- Hubs are found and then lost
- Can no longer find hub HOT 8
- errorhub { [Error: connect ECONNREFUSED] HOT 6
- Logitech reinstates local API HOT 3
- Hub not listed HOT 1
- Harmony firmware officially supports XMPP again - sort of.
- Failure when installing HOT 1
- Specifying hub_ip has not effect HOT 4
- How to actually run commands? HOT 2
- Still active? HOT 3
- Hubs not detected HOT 1
- Loosing connection to hub HOT 1
- No hubs available - random issue HOT 6
- how to use static IP for Hub ?
- No MQTT commands work HOT 1
- Get Activity Start/End Sequence?
- when ever i run script/bootstrap i receive this HOT 7
- Feature request: Please add MQTT Messages for Activity status
- Cross Domain errors when using Jquery
- list commands ok but 404 on GET HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from harmony-api.