Enigma2Events

From JoBaPedia
Revision as of 18:40, 29 November 2023 by Joachim (talk | contribs)
Jump to navigation Jump to search

Enigma2 Events

the VTi images used by vu-uno and vuzero run scripts on the following events:

  • DBTASK_CANCEL
  • DBTASK_FINISH
  • DBTASK_START
  • E2START
  • GUI_REBOOT
  • PVRDESCRAMBLE_START
  • PVRDESCRAMBLE_STOP
  • REBOOT
  • RECORD_REMIND
  • RECORD_START
  • RECORD_STOP
  • RECORD_WAKEUP
  • SERVICE_START
  • SERVICE_STOP
  • SHUTDOWN
  • STANDBY_ENTER
  • STANDBY_LEAVE
  • STBBOOT
  • TASK_CANCEL
  • TASK_FINISH
  • TASK_START

I use them to switch the AV receiver on and off by sending a http request to a tasmota switch. The commands for the different events are in /etc/enigma2/events. E.g. STANDBY_ENTER.sh:

#!/bin/sh

OUT=`wget -O- -q 'http://nous4/cm?cmnd=Power%20Off' 2>&1`
echo "${0##*/}: $OUT" > /dev/udp/192.168.1.4/514

exit 0


see VTi Image 14.x.x Update Infos

MQTT with Python

recently I added the ability to publish mqtt topics:

  • download python module paho mqtt from github as zip (vu-uno python has no pip)
  • copy zip to the vu-uno
cat /home/joachim/Downloads/paho.mqtt.python-master.zip | ssh vu-uno 'cat >/home/joachim/paho.zip'
ssh root@vu-uno
opkg update
opkg install py-compile
cd /home/joachim
unzip paho.zip
cd paho.mqtt.python-master
python setup.py install
  • fix bug about missing pre connect callback (v1.6.1 as of Nov 2023)
    • vi /usr/lib/python2.7/site-packages/paho_mqtt-1.6.1-py2.7.egg/paho/mqtt/client.py
    • search for self._on_disconnect (in class Client)
    • add similar line nearby: self._on_pre_connect = None

Now you can publish mqtt topics with this simple python code:

#!/usr/bin/python
import paho.mqtt.publish as publish
publish.single("some/topic", "some-value", hostname="your-mqtt-broker")