SmartThings Community

[RELEASE] KuKuHarmony - DTH and SmartApp that support to control devices in Logitech Harmony(using Harmony-API)

smartapp_av
harmony
dth_av
requires_server
project_av

(DJAC) #617

No luck!!

etc/systemd/system $ sudo systemctl start harmony-api.service && sudo systemctl status harmony-api.service
Failed to start harmony-api.service: Unit harmony-api.service is not loaded properly: Invalid argument.
See system logs and ‘systemctl status harmony-api.service’ for details.

etc/systemd/system sudo systemctl start harmony-api.service && sudo systemctl status harmony-api.service** Failed to start harmony-api.service: Unit harmony-api.service is not loaded properly: Invalid argument. See system logs and 'systemctl status harmony-api.service' for details. **:/etc/systemd/system sudo systemctl status harmony-api.service
● harmony-api.service - Harmony API container
Loaded: error (Reason: Invalid argument)
Active: inactive (dead)

Nov 07 15:34:54 raspberrypi systemd[1]: [/etc/systemd/system/harmony-api.service:1] Assignment outside of section.
Nov 07 15:34:54 raspberrypi systemd[1]: [/etc/systemd/system/harmony-api.service:2] Assignment outside of section.
Nov 07 15:34:54 raspberrypi systemd[1]: [/etc/systemd/system/harmony-api.service:15] Missing ‘=’.
Nov 07 15:35:23 raspberrypi systemd[1]: [/etc/systemd/system/harmony-api.service:1] Assignment outside of section.
Nov 07 15:35:23 raspberrypi systemd[1]: [/etc/systemd/system/harmony-api.service:2] Assignment outside of section.
Nov 07 15:35:23 raspberrypi systemd[1]: [/etc/systemd/system/harmony-api.service:15] Missing ‘=’.
Nov 07 15:36:15 raspberrypi systemd[1]: [/etc/systemd/system/harmony-api.service:1] Assignment outside of section.
Nov 07 15:36:15 raspberrypi systemd[1]: [/etc/systemd/system/harmony-api.service:2] Assignment outside of section.
Nov 07 15:36:15 raspberrypi systemd[1]: [/etc/systemd/system/harmony-api.service:15] Missing ‘=’.
lines 1-13/13 (END)


(Bill S.) #618

Ohhhhh, ok. That helps. Give me a sec.


(Bill S.) #619

Ok, let’s back out the harmony-api.service file (sudo rm -vf /etc/systemd/system/harmony-api.service). Then, run sudo nano /etc/systemd/system/harmony-api.service.

Paste JUST the following:

[Unit]
Description=Harmony API container
Requires=docker.service
After=docker.service

[Service]
Restart=always
ExecStart=/usr/bin/docker start -a harmony-api
ExecStop=/usr/bin/docker stop -t 2 harmony-api

[Install]
WantedBy=multi-user.target

Then, hit CTRL+x to save the file. Then run the following:
sudo systemctl daemon-reload
sudo systemctl enable harmony-api.service
sudo systemctl start harmony-api.service
journalctl -f -u harmony-api.service and watch the output. If all goes well and the service is running, then you can CTRL+c to get out of journalctl.


(DJAC) #620

I get this when i journal

journalctl -f -u harmony-api.service
– Logs begin at Wed 2018-11-07 15:05:13 SAST. –
Nov 07 15:52:41 raspberrypi docker[1641]: warn: --minUptime not set. Defaulting to: 1000ms
Nov 07 15:52:41 raspberrypi docker[1641]: warn: --spinSleepTime not set. Your script will exit if it does not stay up for at least 1000ms
Nov 07 15:52:46 raspberrypi docker[1641]: Starting discovery.
Nov 07 15:52:47 raspberrypi docker[1641]: Hub discovered: Main 1 at 192.168.1.8.
Nov 07 15:52:47 raspberrypi docker[1641]: Updating activities for main-1.
Nov 07 15:52:47 raspberrypi docker[1641]: Updating state for main-1.
Nov 07 15:52:47 raspberrypi docker[1641]: Updating devices for main-1.
Nov 07 15:52:52 raspberrypi docker[1641]: Updating state for main-1.
Nov 07 15:52:57 raspberrypi docker[1641]: Updating state for main-1.
Nov 07 15:53:02 raspberrypi docker[1641]: Updating state for main-1.
Nov 07 15:53:07 raspberrypi docker[1641]: Updating state for main-1.
Nov 07 15:53:12 raspberrypi docker[1641]: Updating state for main-1.

What did you do different…!!!
Amazing, thank you


(Bill S.) #621

I think that you had the lines “-------------------------” in your service file. Hence why it couldn’t start the service.


(DJAC) #622

Really appreciat e all your help and TIME…
.PRICELESS


(Tony Kerwin) #623

I’ve finally got this working in the QNAP container docker.
Now i’m trying to control a series of inputs replicating the harmony activities ie TV on, input HDMI 1 and a seperate activity switching candles on, change colour, make candle flicker etc.
My question is there a device handler that will setup a routine\activity within ST to control a series of commands for multiple devices independently?

Thanks
Tony


(Eric) #624

Ok…finally got a RPB3+. I think I’ve installed everything, but when I go to Add Device, nothing comes up. My old Direct TV DVR is in the list when I tried getting this to run in Windows.

[EDIT] When I run this command: docker run -ti --net=host --name harmony-api turlvo/harmony-api:latest /home/harmony-api/harmony-api/script/server

I get this:

pi@Pi_Eric:~ $ docker run -ti --net=host --name harmony-api turlvo/harmony-api:latest /home/harmony-api/harmony-api/script/server
docker: Error response from daemon: Conflict. The container name “/harmony-api” is already in use by container “52082d9707beb2f3d179ad38260c910e8d4a41a33c0103f33bd8f2329ec86b08”. You have to remove (or rename) that container to be able to reuse that name.
See ‘docker run --help’.

Also, I don’t understand how to run this part:

  • Make a container restarting when rebooting
    # sudo vim /etc/systemd/system/harmony-api.service

    <harmony-api.service File content>
    -----------------------------------------------------------------------------            
    [Unit]
    Description=Harmony API container
    Requires=docker.service
    After=docker.service

    [Service]
    Restart=always
    ExecStart=/usr/bin/docker start -a harmony-api
    ExecStop=/usr/bin/docker stop -t 2 harmony-api

    [Install]
    WantedBy=multi-user.target
    -----------------------------------------------------------------------------

    # sudo systemctl enable /etc/systemd/system/harmony-api.service

I tried this, but don’t know if it worked. I went back and removed the line, and then rebooted it, to try to rerun the docker, but I’m still getting the error.


(Eric) #625

I get this error

$ docker start docker run -ti --net=host --name harmony-api turlvo/harmony-api:latest /home/harmony-api/harmony-api/script/server
unknown shorthand flag: ‘t’ in -ti
See ‘docker start --help’.

The weird thing is, I got this to work on my Windows computer a long time ago. Can’t seem to figure it out on the Pi, though. Apparently, I also have another docker running the Harmony API, and can’t figure out how to stop it.


(Eric) #626

Ok, this apparently worked, in that I can see my Pi discovered the hub. However, it’s not showing up in the app, and I can’t see the website with the ip address either (yes, I added :8282)

[EDIT] I think I may have another instance of a docker with the Harmony API running, but can’t shut it down.How would I stop all dockers?

[EDIT] Ok, just rebooted. journalctl -f -u harmony-api.service shows no service

[EDIT] Restarted service. journalctl shows discovery, but it still doesn’t show on app, nor can I access ip through chrome

sudo ln -s which nodejs /usr/bin/node


(Eric) #627

I am just having one problem after another…Can’t believe the windows install was easier than this.

When I run this command: sudo ln -s which nodejs /usr/bin/node**

I get this:

[quote]~ $ sudo ln -s which nodejs /usr/bin/node
ln: failed to create symbolic link ‘/usr/bin/node’: File exists[/quote]

I will say, I originally typed it with the grave symbol around “nodejs”, instead of “which nodejs”. Looking in usr/bin, I see there is a file called node. I wondered if I accidentally made this file, but I do not have permission to rename it, so can’t troubleshoot that.

When I try to run the next command:/opt $ git clone https://github.com/maddox/harmony-api.git2 6

I get this

And I can’t change permissions there, either. I’m at a complete loss. Could someone please help?!?