Harmony hub flow in home assistant using nodered contrib homeassistant

I know there are a good amount of users using Harmony hubs.

I’m having a hard time configuring automations in NodeRed, because I can’t figure out what the data portions or commands should look like.

I see the hub in hassio and all and within NodeRed, when I select the “remote” for the domain, I can select the Harmony hub, but I’m not sure where to go after that.

Would anyone mind sharing their flow? Just looking for a good working example so I can kind of reverse engineer.

Thanks!

did you ever have any luck figuring this out? struggling with the same issue. can’t seem to format the data properly to successfully send the command

This is what my Call Service node looks like for the Harmony Hub remote send command. Hope this helps.

2 Likes

Thanks! Will have to give this a shot.

What are you using to control? Mind sharing the flow?

I have now taken this out of Node Red and written a YAML automation for it but I think it was something like this:

image

[{"id":"c889668.7073698","type":"bigtimer","z":"bc6bef59.6f136","outtopic":"","outpayload1":"on","outpayload2":"","name":"Sunrise","comment":"","lat":"-34.163993","lon":"140.0794378","starttime":"5003","endtime":"720","starttime2":0,"endtime2":0,"startoff":"0","endoff":0,"startoff2":0,"endoff2":0,"offs":0,"outtext1":"","outtext2":"","timeout":1440,"sun":true,"mon":true,"tue":true,"wed":true,"thu":true,"fri":true,"sat":true,"jan":false,"feb":false,"mar":false,"apr":false,"may":false,"jun":false,"jul":false,"aug":false,"sep":false,"oct":false,"nov":false,"dec":true,"day1":0,"month1":0,"day2":0,"month2":0,"day3":0,"month3":0,"day4":0,"month4":0,"day5":0,"month5":0,"day6":0,"month6":0,"d1":0,"w1":0,"d2":0,"w2":0,"d3":0,"w3":0,"d4":0,"w4":0,"d5":0,"w5":0,"d6":0,"w6":0,"xday1":0,"xmonth1":0,"xday2":0,"xmonth2":0,"xday3":0,"xmonth3":0,"xday4":0,"xmonth4":0,"xday5":0,"xmonth5":0,"xday6":0,"xmonth6":0,"xd1":0,"xw1":0,"xd2":0,"xw2":0,"xd3":0,"xw3":0,"xd4":0,"xw4":0,"xd5":0,"xw5":0,"xd6":0,"xw6":0,"suspend":false,"random":false,"repeat":false,"atstart":false,"odd":false,"even":false,"x":200,"y":700,"wires":[["58fa55c0.bfc31c"],[],[]]},{"id":"58fa55c0.bfc31c","type":"switch","z":"bc6bef59.6f136","name":"On","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"on","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":390,"y":700,"wires":[["2ca7d046.a1ff9"]]},{"id":"2ca7d046.a1ff9","type":"api-call-service","z":"bc6bef59.6f136","name":"Open Blinds","server":"b9ff79d7.164bf8","version":1,"debugenabled":false,"service_domain":"remote","service":"send_command","entityId":"remote.harmony_hub","data":"{\"device\":\"59433490\",\"command\":\"up\"}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":600,"y":700,"wires":[[]]},{"id":"b9ff79d7.164bf8","type":"server","z":"","name":"Home Assistant"}]

My Harmony flow has become a bit mental. I’m in the process of trying to reduce the amount of nodes by using scripts and function nodes.

Happy to share any parts which interest you though :slight_smile:

2 Likes

Hi,

though already some months old, I was wondering, if revitalise this thread and would like to exploit your kind offer to share some ideas, thoughts and parts.

This truly looks a “bit mental” :wink:

I am trying to set up step-by-sep a Harmony Remote Control via node-red and plan to include the Xiaomi Magic Cube for selecting channels, turning on and off and so forth.

What I mean to see from your picture is that you are checking the state (“Which Mode” - Switch Node) the Harmony seems to be in. I am also trying to check the status on harmony (is an activity (not a device) running?) but have problems with that … how do you do that?

Have you meanwhile made any progress with using scripts and function nodes?

Thanks!

This is pretty simple and you can use the same principle in all other flows.
Here is an example:

[
    {
        "id": "9ba8fb54.17b008",
        "type": "api-current-state",
        "z": "8a2eb1df.353f7",
        "name": "",
        "server": "2fba4297.e4145e",
        "version": 1,
        "outputs": 2,
        "halt_if": "on",
        "halt_if_type": "str",
        "halt_if_compare": "is",
        "override_topic": false,
        "entity_id": "remote.living_room",
        "state_type": "str",
        "state_location": "payload",
        "override_payload": "msg",
        "entity_location": "data",
        "override_data": "msg",
        "blockInputOverrides": false,
        "x": 560,
        "y": 120,
        "wires": [
            [
                "e1c1565b.c021d8"
            ],
            []
        ]
    },
    {
        "id": "57b93a8a.f3ddb4",
        "type": "api-call-service",
        "z": "8a2eb1df.353f7",
        "name": "",
        "server": "2fba4297.e4145e",
        "version": 1,
        "service_domain": "remote",
        "service": "turn_off",
        "entityId": "remote.living_room",
        "data": "",
        "dataType": "json",
        "mergecontext": "",
        "output_location": "",
        "output_location_type": "none",
        "mustacheAltTags": false,
        "x": 930,
        "y": 120,
        "wires": [
            []
        ]
    },
    {
        "id": "e1c1565b.c021d8",
        "type": "switch",
        "z": "8a2eb1df.353f7",
        "name": "",
        "property": "data.attributes.current_activity",
        "propertyType": "msg",
        "rules": [
            {
                "t": "eq",
                "v": "Musik",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 1,
        "x": 770,
        "y": 120,
        "wires": [
            [
                "57b93a8a.f3ddb4"
            ]
        ]
    },
    {
        "id": "2fba4297.e4145e",
        "type": "server",
        "z": "",
        "name": "Home Assistant",
        "legacy": false,
        "addon": true,
        "rejectUnauthorizedCerts": true,
        "ha_boolean": "y|yes|true|on|home|open",
        "connectionDelay": true
    }
]

This basically takes a current state check on the remote. Then takes the correct message (you can easily find out what is the correct message to use with the complete debug node) and filters it with a switch node. Then it sends a service call to switch off the Harmony.

1 Like

Yes exactly as @AlmostSerious says, just use the state from the remote component when its set up in HA.
I went a step further and plumbed that info into a input_select in HA as I kept getting ‘unavailable’ states which were mucking up my automations.
Now when I get an unavailable state then it gets dropped and I use the input_select as the trigger or condition for automations.

Excellent - thank you!
You are right: Pretty simple, but only if you know :wink:

Thanks - interesting idea!
Did you get any further with reducing the amount of nodes by using scripts and functions nodes?

Hi i am really curious about your flows i have 3 harmony hubs in the house and would like
to control everything with tablet and alexa like tv, reciver, sat enigma sat reciver, teufel thx etc
maybe you can shre with me some of your flows to get some ideas.
Regards
Oliver

My set up has changed quite a bit since that screenshot. I’ve also started to move a lot of my automation back to YAML as I’ve had a massive overhaul of my config.

That’s not to say I won’t be able to provide some assistance if needed.

I tried to keep most controls on the remote itself and then used HA to ‘enhance it’.

For instance, we always switched to the same channel in the morning for my daughter to watch her kids programmes.
So after a while of doing it manually I decided to automate it by waiting until the satellite box started and then switching to the correct channel but only between certain times of the morning.

If you see anything else in that screenshot that interests you then let me know

Hi thanks for the answer.
in general i try to automate volume up and down with alexa hasio or node red (but without cloud)
channle change jump to special point in enigma reciver mediaportal etc
all kind of ideas what is possible with harmony hub in homeassistant or node red are wellcome
regards
Oliver

Thank you for sharing how to do this!

1 Like

I’m sure I am missing something simple. I want to turn my tv off. Here’s what I have so far:

[{"id":"b65c1c88.c543d","type":"api-call-service","z":"91df80f4.cc725","name":"Send Harmony Off Cmd","server":"3e7f7522.9e5aea","version":1,"debugenabled":false,"service_domain":"remote","service":"turn_off","entityId":"remote.family_room","data":"","dataType":"jsonata","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":750,"y":540,"wires":[["560e03b0.8e8e7c"]]},{"id":"3e7f7522.9e5aea","type":"server","name":"Home Assistant","addon":true}]

As you can see, nothing much happens when I press the inject. Just the timestamp comes through and nothing happens with the remote. When I press the remote buttons, I do see the state changes in the flow below.

Any ideas?

In your debug node, you set it to msg.payload only. Set it to show the whole msg object, then you will get more information. The payload you see is simply the timestamp that you injected.

Given the removal of switch controls I was using node-red + harmony + home assistant to control turning on my AMP and turning to correct input and volume as well as the projectors etc… if the PS5 is playing and if its not, just flip source on the AMP to FireTV etc… but I have to use the Harmony to do the IR mappings as my amp is not “smart”.

Ques… I have to move to service calls now as I was using switches to call the activities… that I coded into the hub. Do I need to know the guid of the hub now to make the service calls? how bout the activities…