[EDGE DEVICE] Simple Harmony Bridge **Alpha Testing**

Hi @Rob_DeSpain

There is a problem stopping the ‘button command’ setting on the settings page working correctly, however that setting is really only used for testing. Is that what you are having trouble with?

Let me know what you are trying to do and I’ll advise you

Under settings → Button command - Put your command here it won’t let me put anything in there. I select it by tapping on it, doesn’t open a box to enter in the command.

@Rob_DeSpain

Yes, that’s the bit that is broken, but as I said it’s only really used for testing anyway.

Can you tell me what you were planning to use it for and I’ll advise and alternative way to achieve it.

Oh of course! I lost all functionality of my lights, and remote power switches. I used to be able to hit a button the remote (the light switch button on the harmony) and it would turn my lights on and off. I also had my power switches on my amps automatically turn on during my harmony sequences. But something (most likely an update) recently broke the integration on both of them.

I then imported (linked / connected) smart things with harmony, and found that was a HUGE mistake. It imported all 79 devices and made the remote so laggy it was useless.

All I would like to do is remap the button on the logitech remote (one of the light buttons) to control my lights again (that are already setup in smartthings).

And I would like to add my amp functionality again so I can re-add them to the harmony startup / shut down scripts.

This driver is for controlling harmony devices from st

This driver cannot do this directly, you cannot map the light/plug buttons on your remote to st devices without the official integration. What you can do is make the lights/plugs come on at the same time as an activity by using automations and this driver.

so the communication only works one way? It is meant for smart things to control harmony, not the other way around? well back to square one haha

@Rob_DeSpain Almost, it’s not quite one way as activity status goes in both directions.

E.g if you have a ‘watch movie’ activity in harmony. You can build an automation in st that will turn the lights down ( or whatever you want) when the activity starts, and back up when it stops. This will work regardless of where the activity is started from ( st, harmony app, harmony devices etc etc)

I hope this helps

that would be perfect, can you link where it may explain that setup a bit?

@Rob_DeSpain
Just turn on activity devices in settings, you will get a device in st that represents each harmony activity.

You can then build routines in st around those activities

ahh, you use the activity as a trigger to do whatever you want in automation. That is pretty savvy. Thanks.

1 Like

to bad you can’t set a harmony button command to trigger automation… that would be awesome.

2 Likes

I am using this Bridge in a Routine that watches for my Activities to start which then invokes a Scene that sets my lights in my HT as is being described here. But I also have some virtual switches that I use with the device buttons at the bottom of the Harmony Elite remote to control lighting in my HT. It is still working fine but I am using these new virtual switches described here.

Again thank you for this driver, it has saved our Harmony-smartthings world.

Has there been any new understanding on the 10 activity limit (actually 9 because the all off activity takes one).
I still have a few activities that would be great to monitor especially with the “last status” monitoring.

@JEFFBUSSE

There is nothing in the driver code that limits you to 10 devices, I can only assume this is a limit Smartthings has put in to limit child devices of parent devices (this is the model this driver uses, each activity is a child of a parent hub device. The parent hub device is what handles all of the harmony communications)

@nayelyz are you aware of what would limit the number of child devices? There seems to be a limit of 10

The devices are created like so with the parent id explicitly set to help manage ownership and device communication (both parent–>child and child–>parent)

          local metadata = {
            type = "LAN",
            -- the DNI must be unique across your hub, using static ID here so that we
            -- only ever have a single instance of this "device"
            device_network_id = dni,
            label = "HB "..hubId.." Activity - "..a.label,
            profile = "harmony-bridge-activity.v1",
            manufacturer = "HBActivity",
            model = "HBActivity",
            vendor_provided_label = a.id,
            parent_device_id = device.id
          }
          driver:try_create_device(metadata)

Hi, @lmullineux
I asked the team about this, I’ll let you know once I get more info.

1 Like

Following up, the team mentioned there’s no limit of 10 child devices and they have drivers where they are using 17 for example, so, something else must be going on.
We need to report this issue, so, @JEFFBUSSE, please share the following info:

  1. As I understand, when you select a certain config, all child devices are created, right, @lmullineux?
    If so, it would be helpful that you repeat this step to see why they don’t get created correctly and to get the driver logs of that process.
    That can be done by setting up the CLI and running the command smartthings edge:drivers:logcat --hub-address=x.x.x.x --all > driverlog.log

Please let me know if you need help with this part

  1. Send the Hub logs after repeating this process to see if something was registered there:
  1. In the IDE, enter “my hubs”
  2. Enter the corresponding Hub and go to “view utilities”
  3. Click on “send” below "send hub logs
  1. Provide support access to your account:

    1. Confirm the email account registered in the forum is the same one you use for SmartThings. If not, please share it with me over DM
    2. Enable support access to your account:
  1. Go to the SmartThings Web (my.smartthings.com)
  2. Log in to your Samsung Account
  3. Select Menu (⋮) and choose Settings
  4. Toggle on Account Data Access
  5. Select the time period and confirm - In this step, please select “Until turned off”, once the team finishes, we’ll let you know so you can disable it again.

Yes that is correct @nayelyz

I can re-create this issue myself,

The code is quite simple that creates the devices

    if args.old_st_store.preferences.activitydevices ~= device.preferences.activitydevices then
      log.info("[" .. device.id .. "] Activity Devices setting changed")
      local hubId = device:get_field("harmony_hub_id")
      if (device.preferences.activitydevices == true) then
        local activityList = device:get_field("activityList")
        for i, a in pairs(activityList) do
          log.info("[" .. device.id .. "] Creating Activity Device for - ",a.label)
          --deviceListString = deviceListString..a.label..[[{"activityId":"]]..a.id..[[","action":"startActivity"}]]..string.char(10)..string.char(13)
          local dni = "harmony_bridge_activity_"..a.id
          if(a.id == "-1") then
            --this is the poweroff activity
            dni = "harmony_bridge_"..hubId.."_activity_"..a.id
          end
          local metadata = {
            type = "LAN",
            -- the DNI must be unique across your hub, using static ID here so that we
            -- only ever have a single instance of this "device"
            device_network_id = dni,
            label = "HB "..hubId.." Activity - "..a.label,
            profile = "harmony-bridge-activity.v1",
            manufacturer = "HBActivity",
            model = "HBActivity",
            vendor_provided_label = a.id,
            parent_device_id = device.id
          }
          driver:try_create_device(metadata)
        end
      end

This results in the following logs, the first 10 devices are created (highlighted yellow), but the 11th device is not created - there is no error

I’m not saying there is an overall limit of number of devices a driver can have, even this driver supports more than the 10 i mentioned. The limit seems to come in when the parent device id is set in the meta data - it seems like 1 parent can only have 10 children each when using this field.

          local metadata = {
            type = "LAN",
            -- the DNI must be unique across your hub, using static ID here so that we
            -- only ever have a single instance of this "device"
            device_network_id = dni,
            label = "HB "..hubId.." Activity - "..a.label,
            profile = "harmony-bridge-activity.v1",
            manufacturer = "HBActivity",
            model = "HBActivity",
            vendor_provided_label = a.id,
            parent_device_id = device.id
          }

I have completed the other 2 steps in your post to share access and logs from my account (im on the eu ide)

Ps… I use the parent_device_id elsewhere in my code to broker inbound messages into to the correct activity devices - so it is important that it is set

function hbactivity_message_broker.activityMessageReceived(driver,device,msg)
    log.info("[" .. device.id .. "] Activity Message Broker - Received: ",utils.stringify_table(msg,"Activity Message: ",true))
    local device_list = driver:get_devices()
    for _, d in ipairs(device_list) do
        if (d.parent_device_id == device.id and d:component_exists("activitylogger")) then
            --this means that the child device is owned by the device that received the message (and it is as activity device)
            if msg.type == "connect.stateDigest?notify" then
                if(msg.data.activityId == d.vendor_provided_label) then
                    --this means this is a message about this activity for this device
                    --log the message to history

And again to broker outbound messages back through the correct parent

function hbactivity_command_handlers.switch_off(driver, device, command)
  log.debug(string.format("[%s] calling set_power(off)", device.device_network_id))
  --device:emit_event(capabilities.switch.switch.off())
  parent = hbactivity_command_handlers.getParentDevice(driver,device)
  sendHarmonyStartActivity(parent,"-1",0)
end

function hbactivity_command_handlers.getParentDevice(driver,device)
    local device_list = driver:get_devices()
    local dev = {}
    for _, d in ipairs(device_list) do
        if device.parent_device_id == d.id then
            dev = d
        end
    end
    log.info("[" .. device.id .. "] Returning Parent: ",dev.id)
    return dev
end
1 Like

Do you have the info from lmullineux or do you need mine too. It will probably be Sunday before I can have time.

1 Like

Hi, I think the info provided by him is enough, we’ll let you know in case we need something else.

2 Likes

@lmullineux Seeing a new issue today on one of my four Harmony hubs. The hub itself is working fine but it’s lost connection with ST. IP address has not changed.

Here’s the logs from trying a refresh on the ST hub device:

2023-04-03T22:18:23.818455658+00:00 TRACE Harmony Bridge Simple V2  Received event with handler capability
2023-04-03T22:18:23.830145658+00:00 INFO Harmony Bridge Simple V2  <Device: f8ac950a-a26a-47dc-ae3a-43f796c81381 (Harmony Bridge - Media Room)> received command: {"args":{},"capability":"refresh","command":"refresh","component":"main","positional_args":{}}
2023-04-03T22:18:23.834449658+00:00 TRACE Harmony Bridge Simple V2  Found CapabilityCommandDispatcher handler in harmony-bridge-simple.v1
2023-04-03T22:18:23.840028658+00:00 INFO Harmony Bridge Simple V2  <Device: f8ac950a-a26a-47dc-ae3a-43f796c81381 (Harmony Bridge - Media Room)> emitting event: {"attribute_id":"logger","capability_id":"universevoice35900.log","component_id":"main","state":{"value":"Refreshing the Harmony Connection"}}
2023-04-03T22:18:23.842825533+00:00 INFO Harmony Bridge Simple V2  [f8ac950a-a26a-47dc-ae3a-43f796c81381] Do Refresh Connection
2023-04-03T22:18:23.844245824+00:00 INFO Harmony Bridge Simple V2   [f8ac950a-a26a-47dc-ae3a-43f796c81381] IP Address 192.168.254.70
2023-04-03T22:18:23.845691158+00:00 INFO Harmony Bridge Simple V2   [f8ac950a-a26a-47dc-ae3a-43f796c81381] stored_harmony_ip : 192.168.254.70
2023-04-03T22:18:23.847125741+00:00 INFO Harmony Bridge Simple V2  [f8ac950a-a26a-47dc-ae3a-43f796c81381] Attempting to get hubID for ipAddress 192.168.254.70
2023-04-03T22:18:23.848567824+00:00 INFO Harmony Bridge Simple V2  [f8ac950a-a26a-47dc-ae3a-43f796c81381] Sending request...
2023-04-03T22:18:40.553085368+00:00 DEBUG Harmony Bridge Simple V2  [f8ac950a-a26a-47dc-ae3a-43f796c81381] Response Body :
2023-04-03T22:18:40.566542410+00:00 PRINT Harmony Bridge Simple V2  
2023-04-03T22:18:40.567393368+00:00 DEBUG Harmony Bridge Simple V2  [f8ac950a-a26a-47dc-ae3a-43f796c81381] Get Harmony Hub ID failed
2023-04-03T22:18:40.568302160+00:00 DEBUG Harmony Bridge Simple V2  driver device thread event handled
2023-04-03T22:18:40.569215035+00:00 DEBUG Harmony Bridge Simple V2  driver device thread event handled
2023-04-03T22:18:40.601967826+00:00 INFO Harmony Bridge Simple V2  [f8ac950a-a26a-47dc-ae3a-43f796c81381] Attempting to get hubID for ipAddress 192.168.254.70
2023-04-03T22:18:40.603012951+00:00 INFO Harmony Bridge Simple V2  [f8ac950a-a26a-47dc-ae3a-43f796c81381] Sending request...
2023-04-03T22:18:42.530076118+00:00 ERROR Harmony Bridge Simple V2  Harmony Bridge - Media Room thread encountered error: [string "st/dispatcher.lua"]:233: Error encountered while processing event for <Device: f8ac950a-a26a-47dc-ae3a-43f796c81381 (Harmony Bridge - Media Room)>:
    arg1: table: 0x2570850
[string "init.lua"]:155: attempt to concatenate a nil value
2023-04-03T22:18:42.532697076+00:00 DEBUG Harmony Bridge Simple V2  [f8ac950a-a26a-47dc-ae3a-43f796c81381] Get Harmony Hub ID failed
2023-04-03T22:18:42.533641785+00:00 PRINT Harmony Bridge Simple V2  
2023-04-03T22:18:42.534531410+00:00 DEBUG Harmony Bridge Simple V2  [f8ac950a-a26a-47dc-ae3a-43f796c81381] Response Body :
2023-04-03T22:18:42.546585743+00:00 INFO Harmony Bridge Simple V2  IP Address: 192.168.254.70
2023-04-03T22:18:42.547177076+00:00 DEBUG Harmony Bridge Simple V2  [f8ac950a-a26a-47dc-ae3a-43f796c81381] Get Harmony Hub ID failed
2023-04-03T22:18:42.548183785+00:00 PRINT Harmony Bridge Simple V2  
2023-04-03T22:18:42.548959243+00:00 DEBUG Harmony Bridge Simple V2  [f8ac950a-a26a-47dc-ae3a-43f796c81381] Response Body :
2023-04-03T22:18:42.553404326+00:00 INFO Harmony Bridge Simple V2  Hub Id: nil
2023-04-03T22:18:42.553974910+00:00 ERROR Harmony Bridge Simple V2  failed to get hubid for device