HDMI CEC Av Receiver anschalten / Homematic CCU2

    Diese Seite verwendet Cookies. Durch die Nutzung unserer Seite erklären Sie sich damit einverstanden, dass wir Cookies setzen. Weitere Informationen

    • HDMI CEC Av Receiver anschalten / Homematic CCU2

      Hallo,

      ich möchte gerne das der Receiver Solo 2 einen befehl ausführt.

      Dieser soll über HDMI CEC dein Einschaltvorgang des Av Receivers durchführen.

      Ich habe mich schon ein bisschen damit ausseinander gesetzt.

      Der Befehl geht von der CCU2 aus.

      AVR ON

      dom.GetObject("CUxD.CUX2801002:1.CMD_EXEC").State("LD_LIBRARY_PATH=/usr/local/addons/cuxd /usr/local/addons/cuxd/curl formiPhoneAppDirect.xml?PWON");

      Dies funktioniert auch wunderbar.
      Aber auch nur wenn der AV Receiver durchgehend zuvor im Stanby war.
      Was meiner aber nicht ist.
      Leider kann ich den Einschaltbefehl erst ca 90 Sekunden später senden. Da anscheinend ab diesem Zeitpunkt die Netwzerkkarte bereit ist für Steuerbefehle anzunehmen.

      Merkwürdiger weiße nimmt der Av Receiver aber die von der Solo2 kommenden HDMI CEC befehle bereits nach einer Sekunde.

      Deshalb würde ich gerne das die CCU2 einen Befehel an den Solo2 Receiver sendet zum Ausführen der HDM CEC "Receiver anschalten"

      Leider weiß ich noch nicht einmal den Pfad wo sich das ganze HDMI CEC abspielt.
    • Pfad habe ich gefunden:

      /usr/lib/enigma2/python/Plugins/SystemPlugins/HDMICEC/HdmiCec.py

      In dieser Datei ist enthalten:


      Python-Quellcode: HdmiCec.py

      1. # -*- coding: utf-8 -*-
      2. # maintainer: <plnick@vuplus-support.org>
      3. #This plugin is free software, you are allowed to
      4. #modify it (if you keep the license),
      5. #but you are not allowed to distribute/publish
      6. #it without source code (this version and your modifications).
      7. #This means you also have to distribute
      8. #source code of your modifications.
      9. import struct
      10. from enigma import eHdmiCEC, eTimer
      11. from Components.config import config, ConfigSelection, ConfigYesNo, ConfigSubsection, ConfigText
      12. from Tools.HardwareInfoVu import HardwareInfoVu
      13. from Screens.Standby import inStandby
      14. import Screens.Standby
      15. from Tools import Notifications
      16. from Tools.DreamboxHardware import getFPWasTimerWakeup
      17. from Tools.Directories import fileExists
      18. import time
      19. from os import system
      20. from __init__ import _
      21. class HdmiCec:
      22. def __init__(self):
      23. config.hdmicec = ConfigSubsection()
      24. config.hdmicec.enabled = ConfigYesNo(default = False)
      25. config.hdmicec.logenabledserial = ConfigYesNo(default = False)
      26. config.hdmicec.logenabledfile = ConfigYesNo(default = False)
      27. config.hdmicec.tvstandby = ConfigYesNo(default = False)
      28. config.hdmicec.tvwakeup = ConfigYesNo(default = False)
      29. config.hdmicec.boxstandby = ConfigYesNo(default = False)
      30. config.hdmicec.enabletvrc = ConfigYesNo(default = True)
      31. config.hdmicec.active_source_reply = ConfigYesNo(default = True)
      32. config.hdmicec.avvolumecontrol = ConfigYesNo(default = False)
      33. config.hdmicec.disabletimerwakeup = ConfigYesNo(default = False)
      34. config.hdmicec.device_name = ConfigText(default = self.getDeviceName(), visible_width = 50, fixed_size = False)
      35. config.hdmicec.standby_message = ConfigSelection(default = "standby,inactive",
      36. choices = [
      37. ("standby,inactive", _("TV standby")),
      38. ("standby,avpwroff,inactive,", _("TV + A/V standby")),
      39. ("inactive", _("Source inactive")),
      40. ("nothing", _("Nothing"))])
      41. config.hdmicec.deepstandby_message = ConfigSelection(default = "standby,inactive",
      42. choices = [
      43. ("standby,inactive", _("TV standby")),
      44. ("standby,avdeeppwroff,inactive", _("TV + A/V standby")),
      45. ("inactive", _("Source inactive")),
      46. ("nothing", _("Nothing"))])
      47. config.hdmicec.wakeupstandby_message = ConfigSelection(default = "wakeup,active,activevu",
      48. choices = [
      49. ("wakeup,active,activevu", _("TV wakeup")),
      50. ("wakeup,active,activevu,avpwron", _("TV + A/V wakeup")),
      51. ("avpwron,wakeup,active,activevu", _("A/V + TV wakeup")),
      52. ("active", _("Source active")),
      53. ("nothing", _("Nothing"))])
      54. config.hdmicec.wakeupdeepstandby_message = ConfigSelection(default = "wakeup,active,activevu",
      55. choices = [
      56. ("wakeup,active,activevu", _("TV wakeup")),
      57. ("wakeup,active,activevu,avpwron", _("TV + A/V wakeup")),
      58. ("avpwron,wakeup,active,activevu", _("A/V + TV wakeup")),
      59. ("active", _("Source active")),
      60. ("nothing", _("Nothing"))])
      61. config.hdmicec.vustandby_message = ConfigSelection(default = "vustandby",
      62. choices = [
      63. ("vustandby", _("VU+ standby")),
      64. ("vudeepstandby", _("VU+ DeepStandby")),
      65. ("vunothing", _("Nothing"))])
      66. config.hdmicec.vuwakeup_message = ConfigSelection(default = "vuwakeup",
      67. choices = [
      68. ("vuwakeup", _("VU+ wakeup")),
      69. ("vunothing", _("Nothing"))])
      70. config.hdmicec.tvinput = ConfigSelection(default = "1",
      71. choices = [
      72. ("1", "HDMI 1"),
      73. ("2", "HDMI 2"),
      74. ("3", "HDMI 3"),
      75. ("4", "HDMI 4"),
      76. ("5", "HDMI 5"),
      77. ("6", "HDMI 6"),
      78. ("7", "HDMI 7")])
      79. config.hdmicec.avinput = ConfigSelection(default ="0",
      80. choices = [
      81. ("0", _("no A/V Receiver")),
      82. ("1", "HDMI 1"),
      83. ("2", "HDMI 2"),
      84. ("3", "HDMI 3"),
      85. ("4", "HDMI 4"),
      86. ("5", "HDMI 5"),
      87. ("6", "HDMI 6"),
      88. ("7", "HDMI 7")])
      89. config.hdmicec.message_delay = ConfigSelection(default = "10",
      90. choices = [
      91. ("1", "0.1 sec"),
      92. ("5", "0.5 sec"),
      93. ("10", "1 sec"),
      94. ("20", "2 sec"),
      95. ("30", "3 sec"),
      96. ("50", "5 sec")])
      97. config.misc.standbyCounter.addNotifier(self.enterStandby, initial_call = False)
      98. config.misc.DeepStandbyOn.addNotifier(self.enterDeepStandby, initial_call = False)
      99. self.activateSourceTimer()
      100. self.leaveDeepStandby()
      101. def getDeviceName(self):
      102. deviceList = {
      103. "duo": "Vu+ Duo",
      104. "solo": "Vu+ Solo",
      105. "uno": "Vu+ Uno",
      106. "ultimo": "Vu+ Ultimo",
      107. "solo2": "Vu+ Solo2",
      108. "duo2": "Vu+ Duo2",
      109. "zero": "Vu+ zero",
      110. "solose": "Vu+ SoloSE",
      111. }
      112. vumodel = HardwareInfoVu().get_device_name()
      113. return deviceList.setdefault(vumodel, "VU+")
      114. def sendMessages(self, messages):
      115. messagedelay = float(config.hdmicec.message_delay.value)/10.0
      116. for message in messages.split(','):
      117. cmd = None
      118. logcmd = None
      119. addressvaluebroadcast = int("0F",16)
      120. addressvalue = int("0",16)
      121. addressvalueav = int("5",16)
      122. wakeupmessage = int("04",16)
      123. standbymessage=int("36",16)
      124. activesourcemessage=int("82",16)
      125. inactivesourcemessage=int("9D",16)
      126. sendkeymessage = int("44",16)
      127. sendkeypwronmessage = int("6D",16)
      128. sendkeypwroffmessage = int("6C",16)
      129. activevumessage=int("85",16)
      130. physaddress1 = int("0x" + str(config.hdmicec.tvinput.value) + str(config.hdmicec.avinput.value),16)
      131. physaddress2 = int("0x00",16)
      132. if message == "wakeup":
      133. cmd = struct.pack('B', wakeupmessage)
      134. logcmd = "[VTI HDMI-CEC] ** WakeUpMessage ** send message: %x to address %x" % (wakeupmessage, addressvalue)
      135. elif message == "active":
      136. addressvalue = addressvaluebroadcast
      137. cmd = struct.pack('BBB', activesourcemessage,physaddress1,physaddress2)
      138. logcmd = "[VTI HDMI-CEC] ** ActiveSourceMessage ** send message: %x:%x:%x to address %x" % (activesourcemessage,physaddress1,physaddress2,addressvalue)
      139. self.delayed_Message_Timer = eTimer()
      140. self.delayed_Message_Timer.start(20000, True)
      141. self.delayed_Message_Timer.callback.append(self.delayedActiveSourceMessage)
      142. elif message == "standby":
      143. cmd = struct.pack('B', standbymessage)
      144. logcmd = "[VTI HDMI-CEC] ** StandByMessage ** send message: %x to address %x" % (standbymessage, addressvalue)
      145. elif message == "inactive":
      146. addressvalue = addressvaluebroadcast
      147. cmd = struct.pack('BBB', inactivesourcemessage,physaddress1,physaddress2)
      148. logcmd = "[VTI HDMI-CEC] ** InActiveSourceMessage ** send message: %x:%x:%x to address %x" % (inactivesourcemessage,physaddress1,physaddress2,addressvalue)
      149. elif message == "avpwron":
      150. cmd = struct.pack('BB', sendkeymessage,sendkeypwronmessage)
      151. addressvalue = addressvalueav
      152. logcmd = "[VTI HDMI-CEC] ** Power on A/V ** send message: %x:%x to address %x" % (sendkeymessage, sendkeypwronmessage, addressvalue)
      153. elif message == "avdeeppwroff":
      154. cmd = struct.pack('BB',sendkeymessage,sendkeypwroffmessage)
      155. addressvalue = addressvalueav
      156. logcmd = "[VTI HDMI-CEC] ** Standby A/V (Deepstandby)** send message: %x:%x to address %x" % (sendkeymessage,sendkeypwroffmessage, addressvalue)
      157. elif message == "avpwroff":
      158. addressvalue = addressvalueav
      159. cmd = struct.pack('BB',sendkeymessage,sendkeypwroffmessage)
      160. logcmd = "[VTI HDMI-CEC] ** Standby A/V ** send message: %x:%x to address %x" % (sendkeymessage,sendkeypwroffmessage, addressvalue)
      161. elif message == "activevu":
      162. addressvalue = addressvaluebroadcast
      163. cmd = struct.pack('B', activevumessage)
      164. logcmd = "[VTI HDMI-CEC] ** Active VU Message ** send message: %x to address %x" % (activevumessage,addressvalue)
      165. if cmd and logcmd:
      166. self.sendCECMessage(cmd, addressvalue, logcmd, messagedelay)
      167. def sendCECMessage(self, cmd, addressvalue, logcmd, delay = 0):
      168. eHdmiCEC.getInstance().sendMessage(addressvalue, len(cmd), str(cmd))
      169. if config.hdmicec.logenabledserial.value:
      170. print logcmd
      171. if config.hdmicec.logenabledfile.value:
      172. filelog = "echo %s >> /tmp/hdmicec.log" % (logcmd)
      173. system(filelog)
      174. time.sleep(delay)
      175. def delayedActiveSourceMessage(self):
      176. messagedelay = float(config.hdmicec.message_delay.value)/10.0
      177. addressvaluebroadcast = int("0F",16)
      178. activesourcemessage=int("82",16)
      179. activevumessage=int("85",16)
      180. addressvalue = int("0",16)
      181. physaddress1 = int("0x" + str(config.hdmicec.tvinput.value) + str(config.hdmicec.avinput.value),16)
      182. physaddress2 = int("0x00",16)
      183. addressvalue = addressvaluebroadcast
      184. cmd_active = struct.pack('BBB', activesourcemessage,physaddress1,physaddress2)
      185. logcmd_active = "[VTI HDMI-CEC] ** ActiveSourceMessage ** send message: %x:%x:%x to address %x" % (activesourcemessage,physaddress1,physaddress2,addressvalue)
      186. self.sendCECMessage(cmd_active, addressvalue, logcmd_active, messagedelay)
      187. cmd_vu_is_active = struct.pack('B', activevumessage)
      188. logcmd_vu_is_active = "[VTI HDMI-CEC] ** Active VU Message ** send message: %x to address %x" % (activevumessage,addressvalue)
      189. self.sendCECMessage(cmd_vu_is_active, addressvalue, logcmd_vu_is_active, messagedelay)
      190. def leaveStandby(self):
      191. if config.hdmicec.enabled.value:
      192. self.activateSourceTimer()
      193. self.sendMessages(config.hdmicec.wakeupstandby_message.value)
      194. def enterStandby(self, configElement):
      195. from Screens.Standby import inStandby
      196. inStandby.onClose.append(self.leaveStandby)
      197. if config.hdmicec.enabled.value:
      198. self.sendMessages(config.hdmicec.standby_message.value)
      199. if inStandby != None:
      200. self.sendMessages("inactive")
      201. def enterDeepStandby(self,configElement):
      202. if config.hdmicec.enabled.value:
      203. self.sendMessages(config.hdmicec.deepstandby_message.value)
      204. def leaveDeepStandby(self):
      205. if config.hdmicec.enabled.value:
      206. if not getFPWasTimerWakeup():
      207. self.sendMessages(config.hdmicec.wakeupdeepstandby_message.value)
      208. else:
      209. if config.hdmicec.disabletimerwakeup.value:
      210. print "[VTI HDMI-CEC] timer wakeup => do not power on TV / A/V receiver"
      211. else:
      212. self.sendMessages(config.hdmicec.wakeupdeepstandby_message.value)
      213. def activateSourceTimer(self):
      214. self.initial_active_source_call = True
      215. if config.hdmicec.active_source_reply.value == False:
      216. self.activeSourceTimer = eTimer()
      217. self.activeSourceTimer.start(60000, True)
      218. self.activeSourceTimer.callback.append(self.setActiveSourceCall)
      219. def setActiveSourceCall(self):
      220. self.initial_active_source_call = False
      221. ## not used
      222. def activeSource(self):
      223. if config.hdmicec.enabled.value:
      224. physadress1 = "0x" + str(config.hdmicec.tvinput.value) + str(config.hdmicec.avinput.value)
      225. physadress2 = "0x00"
      226. cecmessage = int('0x82',16)
      227. address = int('0x0F',16)
      228. valuethree = int(physadress1,16)
      229. valuefour = int(physadress2,16)
      230. cmd = struct.pack('BBB',cecmessage,valuethree,valuefour)
      231. eHdmiCEC.getInstance().sendMessage(address, len(cmd), str(cmd))
      232. if config.hdmicec.enabletvrc.value:
      233. cecmessage = int('0x8E',16)
      234. address = int('0',16)
      235. valuethree = int('0',16)
      236. cmd = struct.pack('BB',cecmessage,valuethree)
      237. eHdmiCEC.getInstance().sendMessage(address, len(cmd), str(cmd))
      Alles anzeigen

      Für mich ist Spalte 59 -65 interessant

      Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von lexnared ()