Failing to start

Lights randomly stopped working after no changes to the setup/pi. This seems to randomly happen every 6 months or so and it’s usually fixed with an update of diyhue and the pi, with a reboot. Unfortunately, the service fails to start now:

pi@raspberrypi:/opt/hue-emulator $ sudo ./HueEmulator3.py --debug
Traceback (most recent call last):
File “./HueEmulator3.py”, line 29, in
from functions.entertainment import entertainmentService
File “/opt/hue-emulator/functions/entertainment.py”, line 5, in
from functions.lightRequest import sendLightRequest
File “/opt/hue-emulator/functions/lightRequest.py”, line 5, in
from protocols import protocols
File “/opt/hue-emulator/protocols/init.py”, line 1, in
from protocols import yeelight, tasmota, shelly, mi_box, native_single, native_multi, esphome, mqtt, hyperion, homeassistant_ws, wled
File “/opt/hue-emulator/protocols/homeassistant_ws.py”, line 156
logging.info(f"Found {entity_id}")
^
SyntaxError: invalid syntax
pi@raspberrypi:/opt/hue-emulator $

For the exact formatting:

Tried uninstalling/installing diyhue (even dev build) but still seems to get stuck on this.

You say after no changes to the setup/Pi but then you say this happens after an update to DIYHue or the Pi. An update is a change. Updating DIYHue should only be done if you are trying to implement a new feature. Not all updates are transparent and often require you to start from scratch and rebuild your config file. So, it should not be done without knowing that this exact thing can happen.

Before running in Debug mode did you stop the service first?