Closed cjvawv82 closed 5 years ago
Are you referring to this script? I use a systemd service file definition on my implementation which is slightly different and I don't have a raspberry pi to test, but it looks like the wiki documentation might be missing a systemctl enable
command which tells systemd to start the service when it starts up. It looks like this article How to Enable /etc/rc.local with Systemd may help, but rc.local is a legacy system and It would make more sense to create a systemd service file instead. Here's an example which should roughly work:
/etc/systemd/system/infinitude.service
[Unit]
Description=Infinitude HVAC control
After=network-online.target
[Service]
Type=simple
WorkingDirectory=/your/infinitude/path
ExecStart=/your/infinitude/path/infinitude daemon -l http://:80
[Install]
WantedBy=multi-user.target
then sudo systemctl enable infinitude
reply to separate email thread here so others may benefit
as for why you can't start infinitude on port 80 as an unprivileged user, that's default unix behavior. ports <1024 are reserved for system users. So you can either run infinitude with sudo on port 80 or run it on a port >1024 (its default port is 3000). The service file above should work to run on port 80(provided you're not already running a webserver) since systemd runs as root
That script was what I was trying to get to work.
I followed your new script and instructions. It still will not startup. When I get the status of the service it shows errors right after boot. After seeing the status of the service I start the service with sudo systemctl start infinitude and it works fine. Even on the correct port. Any idea why it shows errors on boot and doesn't work, but if I start it manually it works fine? I am willing to send you my pi and include a return label if it would help you with anything. I really appreciate all you have done for this project. See below for log:
Connecting to 192.168.3.71 port 22, please wait... login as: pi@192.168.3.71's password: Linux raspberrypi 4.14.79-v7+ #1159 SMP Sun Nov 4 17:50:20 GMT 2018 armv7l
The programs included with the Debian GNU/Linux system are free software; the exact distribution terms for each program are described in the individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law. Last login: Thu Jan 10 15:13:18 2019
pi@raspberrypi:~ $ sudo systemctl status infinitude ● infinitude.service - Infinitude HVAC control Loaded: loaded (/etc/systemd/system/infinitude.service; enabled; vendor prese Active: failed (Result: exit-code) since Thu 2019-01-10 15:13:18 EST; 2min 50 Process: 310 ExecStart=/home/pi/infinitude/infinitude daemon -l http://:80 (co Main PID: 310 (code=exited, status=22)
Jan 10 15:13:11 raspberrypi systemd[1]: Started Infinitude HVAC control. Jan 10 15:13:18 raspberrypi infinitude[310]: Can't find serial device: /dev/ttyU Jan 10 15:13:18 raspberrypi infinitude[310]: Can't create listen socket: Address Jan 10 15:13:18 raspberrypi systemd[1]: infinitude.service: Main process exited, Jan 10 15:13:18 raspberrypi systemd[1]: infinitude.service: Unit entered failed Jan 10 15:13:18 raspberrypi systemd[1]: infinitude.service: Failed with result ' lines 1-12/12 (END)
pi@raspberrypi:~ $ sudo systemctl start infinitude pi@raspberrypi:~ $ sudo systemctl status infinitude ● infinitude.service - Infinitude HVAC control Loaded: loaded (/etc/systemd/system/infinitude.service; enabled; vendor prese Active: active (running) since Thu 2019-01-10 15:16:27 EST; 9s ago Main PID: 1072 (perl) CGroup: /system.slice/infinitude.service └─1072 perl /home/pi/infinitude/infinitude daemon -l http://:80
Jan 10 15:16:27 raspberrypi systemd[1]: Started Infinitude HVAC control. Jan 10 15:16:29 raspberrypi infinitude[1072]: Can't find serial device: /dev/tty Jan 10 15:16:29 raspberrypi infinitude[1072]: [Thu Jan 10 15:16:29 2019] [info] lines 1-10/10 (END)
Do you have any other services which have a web server/bind to port 80? Does Raspbian have a default web interface for instance? The output above is truncated but It looks like Jan 10 15:13:18 raspberrypi infinitude[310]: Can't create listen socket: Address
infinitute can't bind to port 80 because something else already is, or perhaps it doesn't have an ip address yet(though my understanding was that After=network-online.target
would wait for net before attempting to start so that's probably not the problem).
Is there anything wrong with using the default port of 3000?
Port 3000 is fine. I actually removed the -l so it wouldn't use it. I still have the same issue. The error message you saw above was without port 80. I get the errors on startup but if I start the service manually it works fine, even with port 80
interesting. can you paste the entire error message? I'm guessing it will be more clear what the problem is if we can see the whole line.
Good Morning,
I used Putty on my PC. Hopefully this will show the whole line. On this message i rebooted PI, checked the status of infinitude which showed errors and didn't work, then started infinitude and it worked fine with port 3000.
On this log I set it to listen on port 80. Again once rebooted it showed errors and didn't work. When i started it manually it worked fine on port 80.
Thanks again for all of your help! putty4.log
This looks an awful lot like a problem with Raspbian reporting network-online before the network interface is actually up. https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=868650
So a quick and dirty method would probably be to assign a restart interval so than systemd gives startup another shot. For instance this will try to restart infinitude 17 seconds after it fails
[Unit]
Description=Infinitude HVAC control
After=network-online.target
[Service]
Type=simple
WorkingDirectory=/your/infinitude/path
ExecStart=/your/infinitude/path/infinitude daemon -l http://:80
Restart=always
RestartSec=17
[Install]
WantedBy=multi-user.target```
That took care of it! It is starting up shortly after boot now!
Thank you so much for your time and help with this,
CJ
Glad to hear it's working. You could pay it forward by updating the wiki for future travelers.
I will defiantly do that! I will try to do that tomorrow when my brain is working better.
I have another question for you. I am just messing around with controlling the unit.
I am trying to get my zone 4 to go from 65 to 60. I used the following:
http://192.168.55.44:3000/api/4/activity/manual/ ?htsp=60
and
http://192.168.55.44:3000/api/4/activity/manual?htsp=60
Both change the temperature in the xml but after a few minutes it will jump back up to 65.
Thanks once again for your help and time! CJ
From: nebulous notifications@github.com Sent: Friday, January 11, 2019 11:27 AM To: nebulous/infinitude infinitude@noreply.github.com Cc: CJ Hylton cj@cjhylton.com; Author author@noreply.github.com Subject: Re: [nebulous/infinitude] Infinitude startup on PI (#69)
Glad to hear it's working. You could pay it forward by updating the wiki for future travelers.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/nebulous/infinitude/issues/69#issuecomment-453573988, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AsUJmzMvrLz-QTv3LNia5jusRgniuSZkks5vCLtlgaJpZM4Z0oCj.
Hello,
I wanted to see if I could get some assistance on running infinitude on my raspberry pi b+
The software seems to work fine when starting it manually. I copied and paste your startup script. Changed HVAC to pi since that is where it is. When I run the commands to test the script without restarting I can browse everything using the PI IP. When I shut down or restart it does not work.
When I run ps -ef | grep 'infinitude' it shows nothing running. If I run the rc.local restart then it will work.
Any ideas on how I can get it to startup on boot?
Thanks for any help you can provide! I am new at this.
CJ