Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Json file not as expected, Auto start #194

Open
interested1204 opened this issue Oct 23, 2024 · 8 comments
Open

Json file not as expected, Auto start #194

interested1204 opened this issue Oct 23, 2024 · 8 comments

Comments

@interested1204
Copy link

Been using infinitude for quite a while, great piece of software! This time its on its own raspberry pi so I can connect up the RS-485 and get even more data. Issue is, when I go to edit the json file, it only has 1 line, "app_secret" etc, with "pass_reqs" later on.

Additionally I've followed the rest of the directions, but it does not start upon startup. Works a treat if I go in and manually start it!

Rasp Pi B v 1.2, with full Raspbian latest version.

@nebulous
Copy link
Owner

Can you provide any more details? In particular, what directions are you following? Any error messages when it doesn't start? I'm not sure if Raspbian provides docker, but that's the easiest way to run Infinitude.

@interested1204
Copy link
Author

interested1204 commented Oct 25, 2024

Sure thing! I'm following these instructions:
https://github.com/nebulous/infinitude/wiki/Installing-Infinitude-on-Raspberry-PI-(Raspbian)

If I run:
cd ~/infinitude
./infinitude daemon -m production

It fires up great! As I follow through to:

nano ./infinitude/infinitude.json

The file it brings has 1 line:

{"app_secret":"Pogotudinal","pass_reqs":300}

sudo nano /etc/systemd/system/infinitude.service

I have a file that I've modified to the following..

[Unit]
Description=Infinitude HVAC control
After=network-online.target

[Service]
Type=simple
WorkingDirectory=home/carrier/infinitude
ExecStart=home/carrier/infinitude/infinitude daemon -m http://:3000
Restart=always
RestartSec=17

[Install]
WantedBy=multi-user.target

Then I run:
sudo systemctl enable infinitude

Returns no errors

Then:
ps -ef | grep 'infinitude'

to see if its running.

avahi 358 1 0 19:34 ? 00:00:05 avahi-daemon: running [infinitude.local]
carrier 2888 1549 28 20:34 pts/0 00:00:00 grep --color=auto infinitude

My Raspbi that could run docker got destroyed unfortunately so I was trying older hardware to get it running. Hoping its something simple I'm missing.

@nebulous
Copy link
Owner

thanks. Looks like somebody wrote detailed Raspbian instructions. Hooray wikis :)

The one thing that sticks out for me from that service file is a missing slash in the WorkingDirectory.

If infinitude starts from the cli, the issue is most likely something simple like that in the service file. You can check systemd logs with journalctl - I'm doing this from memory but I think you'd want journalctl -u infinitude -f -n128 for the infinitude unit, follow, and last 128 lines respectively. Though I wouldn't be surprised if adding that initial slash did the job.

@interested1204
Copy link
Author

Unfortunately I couldn't ever get it working even with the slash. I reflashed the drive and started completely from scratch. Same results, json file only has the one line, and the systemctl enable shows no errors, but also doesn't run it. I wonder if the instructions are possibly for an older version?

@nebulous
Copy link
Owner

One line in the json file is fine. it starts from the cli afterall. But, just to update docs/help others if they're confused, what are you expecting to see in the json file that seems to be missing?

sounds like the only issue is with systemd config. I would expect the following to work, or at least log errors, provided it's placed into
/etc/systemd/system/infinitude.service and you run sudo systemctl enable infinitude and sudo systemctl daemon-reload This assumes infinitude is located in a folder called /home/carrier/infinitude/ and that it works if you cd into that folder and run ./infinitude

[Unit]
Description=Infinitude HVAC control
After=network-online.target

[Service]
Type=simple
WorkingDirectory=/home/carrier/infinitude
ExecStart=/home/carrier/infinitude/infinitude daemon -m http://:3000
Restart=always
RestartSec=17

[Install]
WantedBy=multi-user.target

@interested1204
Copy link
Author

SUCCESS! I started over from the beginning and this time was able to get it to fire up. I had copied the file the way its listed above, but then when running:
sudo systemctl enable infinitude

Then:

ps -ef | grep 'infinitude'

It wouldn't show running. But then it dawned on me that the first command was telling the system to run it on boot, and the second was seeing if it was running. So I rebooted it, and it fired up. I was missing that it needed the reboot in between the two. Now I just have to figure out how to configure the RS-485 with the json file having only one line. Do I need to configure that in the json, or does the Using the UART category cover it?

@nebulous
Copy link
Owner

nebulous commented Nov 8, 2024

To configure your rs485 adaptor you can either set the SERIAL_TTY environment variable or add serial_tty to the json config(ref).

json doesn't care if it's one or multiple lines. That is to say,

{"foo": "bar", "baz":123}

is the exact same thing as

{ 
   "foo": "bar", 
   "baz":123
}

Copy link

github-actions bot commented Jan 8, 2025

This issue has not been active in a while. It will be automatically closed soon absent further activity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants