Hello, and thank you again for your quick reply.
In the meantime I have tried out your suggestion(s):
The good news: I do not get an error message with
root@volumio-1:/home/volumio# systemctl enable python-remote.service
or this:
root@volumio-1:/home/volumio# systemctl start python-remote.service
later works great.
but
root@volumio-1:/home/volumio# systemctl enable python-remote.service
gives no error
but does not do anything upon reboot.
When I look at the status of systemd with:
root@volumio-1:/home/volumio# systemctl status
I get this output:
● python-remote.service - Python Remote
Loaded: loaded (/etc/systemd/system/python-remote.service; enabled)
Active: active (running) since Thu 2019-12-19 19:29:07 UTC; 28s ago
Main PID: 8051 (python3)
CGroup: /system.slice/python-remote.service
└─8051 python3 /root/rl_vol_RC_v1.py
I tried:
- ExecStart=/bin/bash /root/rl_start.sh
and
- ExecStart=/usr/bin/env python /root/myscript.py
No difference in outcome. Works when manually started - does not work upon reboot
What else can I try? Please find below error messages and python script
Thank you very much
Output of dmesg with:
root@volumio-1:/home/volumio# dmesg |grep systemd
[ 10.002756] random: systemd: uninitialized urandom read (16 bytes read)
[ 10.011486] systemd[1]: systemd 215 running in system mode. (+PAM +AUDIT +SELINUX +IMA +SYS VINIT +LIBCRYPTSETUP +GCRYPT +ACL +XZ -SECCOMP -APPARMOR)
[ 10.011996] systemd[1]: Detected architecture ‘arm’.
[ 10.192051] systemd[1]: Inserted module ‘ipv6’
[ 10.194996] systemd[1]: Set hostname to .
[ 10.353581] random: systemd-sysv-ge: uninitialized urandom read (16 bytes read)
[ 10.478640] random: systemd: uninitialized urandom read (16 bytes read)
[ 10.589607] systemd[1]: [/lib/systemd/system/mpd.service:18] Unknown lvalue ‘ProtectKernelT unables’ in section ‘Service’
[ 10.589699] systemd[1]: [/lib/systemd/system/mpd.service:19] Unknown lvalue ‘ProtectControl Groups’ in section ‘Service’
[ 10.589776] systemd[1]: [/lib/systemd/system/mpd.service:20] Unknown lvalue ‘ProtectKernelM odules’ in section ‘Service’
[ 10.589877] systemd[1]: [/lib/systemd/system/mpd.service:23] Unknown lvalue ‘RestrictNamespaces’ in section ‘Service’
[ 10.685316] systemd[1]: Cannot add dependency job for unit display-manager.service, ignoring: Unit display-manager.service failed to load: No such file or directory.
[ 10.690237] systemd[1]: Starting Forward Password Requests to Wall Directory Watch.
[ 11.107094] systemd-udevd[177]: starting version 215
[ 13.733916] systemd-journald[170]: Received request to flush runtime journal from PID 1
root@volumio-1:/home/volumio#
=====================================================================================================================
my python code:
import paho.mqtt.client as mqtt #import the client1
import time as t
import keyboard # keyboard lib assumes to have kbd -> dumpkeys installed
#=========== MQTT stuff =========================================
broker_address=“192.168.1.xx”
#=========== Topic ==============================================
topic_Volume = “volumio-1/volume” # messages: [lauter,leiser]
topic_Play = “volumio-1/play”
topic_List = “volumio-1/list”
client = mqtt.Client(“P3”) #create new instance, RL: do not use key twice
client.connect(broker_address) #connect to broker
client.loop_start()
def on_log(client, userdata, level, buf):
print("log: ",buf)
client.on_log=on_log
#======== RL functions =============================================
def rl_publish(topic,volume):
print(topic)
print(volume)
client.publish(topic,volume)#publish
try:
while(True):
key=keyboard.read_key()
print(key)
if key == “help” :
mqtt_code= “lauter” # zuweisung f r Node-Red via mqtt
print(mqtt_code)
rl_publish(topic_Volume,mqtt_code)
if key == “f14” :
mqtt_code= “leiser”
print(topic_Volume,mqtt_code)
rl_publish(topic_Volume,mqtt_code)
if key == “right” :
mqtt_code= “play”
print(mqtt_code)
rl_publish(topic_Play,mqtt_code)
if key == “left” :
mqtt_code= “stop”
print(topic_Play,mqtt_code)
rl_publish(topic_Play,mqtt_code)
if key == “esc” :
mqtt_code= “next”
print(topic_Play,mqtt_code)
rl_publish(topic_Play,mqtt_code)
if key == “enter” :
mqtt_code= “radio”
print(topic_List,mqtt_code)
rl_publish(topic_List,mqtt_code)
if key == “up” :
mqtt_code= “br-1”
print(topic_List,mqtt_code)
rl_publish(topic_List,mqtt_code)
if key == “down” :
mqtt_code= “Canada”
print(topic_List,mqtt_code)
rl_publish(topic_List,mqtt_code)
t.sleep(0.3)
except KeyboardInterrupt:
print(“finished”)
===============================================================================================================