diyhue/diyHue

Hue-emulator service won't start

350d opened this issue · 13 comments

350d commented

Issue does not already exist?

I have searched and found no existing issue

Select Environment

Install Script

Home Assistant related?

No

Description

Hello! I have automatic setup on my RPi finished without any errors (except service not running) and I can run manually HueEmulator.py script and access web UI without any problems but my hue-emulator.service won't start and I don't see any errors in service status, just inactive (dead).
sudo systemctl start hue-emulator.service just hangs and nothing happening...

Errorlog:

sudo journalctl -u hue-emulator.service
-- Journal begins at Sun 2023-07-16 16:17:01 EEST, ends at Wed 2023-11-15 00:07:14 EET. --
-- No entries --

Steps to reproduce

Run install script on my RPi. Its hangs on last step - Start service.

Please enter your operating system details here

Raspbian GNU/Linux 11 (bullseye)

What DiyHue version(branch) are you using?

master (latest)

No errors in syslog? What happens if you execute sudo /opt/hue-emulator/HueEmulator3.py --debug ?

350d commented
image

Can you help me with syslog? How to check it?

It looks like this is working fine if you start it manually. When executed as service it must log in syslog (most likely /var/log/syslog). Check this file with tail -f /var/log/syslog while you start the service from another console (sudo systemctl start hue-emulator)

350d commented

Nothing in tail -f /var/log/syslog while i start the service...

try also sudo journalctl -u hue-emulator.service

350d commented

As I've mentioned in my bug report - there is nothing in sudo journalctl -u hue-emulator.service

350d commented

I've tried to comment out all Thread() lines in HueEmulator.py for test service start - doesn't work anyway. How I can check what's wrong with this service script in other way?

I have no clue why nothing is logged. Have you tried to reinstall the application? Ensure you have the content from here in the systemd service file and do a systemctl daemon-reload to be sure it is applied.

Any exit code specified in the service status?

https://stackoverflow.com/questions/60776373/systemd-service-doesnt-start-silently-how-to-debug

350d commented

I've checked shebang in .py script and I've added absolute path to service file like ExecStart=/usr/bin/python3 /opt/hue-emulator/HueEmulator3.py and tested it before in cli via sudo /usr/bin/python3 /opt/hue-emulator/HueEmulator3.py and still no service start and silent journalctl. How I can add any logger lines like "IM HERE 1111" to the script just for testing?

I guess the Hue Team are closing down this DIY project... I am running the system on older versions... The new versions don't work for me.

They cannot close the project because Hue Essentials will continue to support it and on Android you can install the last apk version that don't require cloud account.

I guess the Hue Team are closing down this DIY project... I am running the system on older versions... The new versions don't work for me.

350d commented

OK, UPDATE:

I've commented out After line in [Unit] section and service can run now without any problems.

[Unit]
Description=Hue Emulator Service
#After=multi-user.target
...

There is an issue with your installation because it never reach runlevel 2. Probable more services are not starting...

https://unix.stackexchange.com/questions/404667/systemd-service-what-is-multi-user-target

Unix & Linux Stack Exchange
I have come across a .service that contains the following:

[Install]
WantedBy=multi-user.target
The original .service file can be found HERE.

I am on Ubuntu 16.04LTS.