Steuerung Klima

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • Steuerung Klima

      Hallo VU-ler,

      ich möchte mir ein Plugin erstellen um meine Klimageräte zu steuern.
      Am Pi benutzte ich pcomfortcloud um über Alexa die Anlage zu steuern, jetzt möchte ich ein PlugIn auf der VU erstellen die mir die aktuellen Werte anzeigen kann und diese
      natürlich auf verstellen sollte.

      mit root@vuultimo4k:~/python-panasonic-comfort-cloud-master# python pcomfortcloud.py Email@Test.de "Passwort" get 1 bekomme ich schon ein paar infos aber wie bekomme ich diese im PlugIn angezeigt und auch verändert.

      Sorry Python ist nicht meine Welt.

      PiT ;(

      Source Code

      1. root@vuultimo4k:~/python-panasonic-comfort-cloud-master# python pcomfortcloud.py Email@Test.de "Passwort" get 1
      2. reading from device 'Timo Schlafzimmer ' (f1910a206c6a20b5e4b8616ec4c246ec12b6711111111111111111111)
      3. id : f1910a206c6a20b5e4b8616ec4c246ec12b6711111111111111111111
      4. parameters
      5. airSwingVertical : UpMid
      6. temperature : 30.0
      7. power : Off
      8. eco : Auto
      9. temperatureInside : 20
      10. temperatureOutside : 8
      11. airSwingHorizontal : Right
      12. mode : Heat
      13. fanSpeed : HighMid
      Display All
    • Hallo VUler,

      habe mit mit Hilfe von hajeku123s Menü Demo was gebaut was sehr gut funktioniert.
      Geht bestimmt besser aber für mich ist das schon ok, mach grade mal 2 Wochen mit pyhton rum. ^^

      Jetzt noch gucken wie ich die ausgelesenen Daten angezeigt bekomme.

      hier noch der Code.

      Python Source Code

      1. #!/usr/bin/env python
      2. # -*- coding: utf-8 -*-
      3. #
      4. # ID 0 = Klima Flur
      5. # ID 1 = Klima Schlafzimmer
      6. # ID 2 = Klima Kinderzimmer
      7. #
      8. from Plugins.Plugin import PluginDescriptor
      9. from Components.config import config,ConfigSubsection,ConfigInteger,ConfigSelection,ConfigYesNo,getConfigListEntry,ConfigText
      10. from Components.ConfigList import ConfigListScreen
      11. from Screens.Screen import Screen
      12. from Components.Sources.StaticText import StaticText
      13. from Components.ActionMap import NumberActionMap,ActionMap
      14. from Screens.MessageBox import MessageBox
      15. import traceback
      16. import sys
      17. import pcomfortcloud
      18. import threading
      19. session = pcomfortcloud.Session('user@Email.de', 'Geheim')
      20. session.login()
      21. #devices = session.get_devices()
      22. config.plugins.xtest = ConfigSubsection()
      23. config.plugins.xtest.onoffFlur = ConfigSelection(default = "On", choices = [("On", _("On")), ("Off", _("Off"))])
      24. config.plugins.xtest.onoffKind = ConfigSelection(default = "On", choices = [("On", _("On")), ("Off", _("Off"))])
      25. config.plugins.xtest.onoffSchlaf = ConfigSelection(default = "On", choices = [("On", _("On")), ("Off", _("Off"))])
      26. config.plugins.xtest.modus = ConfigSelection(default = "Cool", choices = [("Auto", _("Auto")),("Cool", _("Cool")), ("Heat", _("Heat")), ("Dry", _("Dry"))])
      27. config.plugins.xtest.ecoFlur = ConfigSelection(default = "Auto", choices = [("Auto", _("Auto")), ("Quiet", _("Quiet")), ("Powerful", _("Powerful"))])
      28. config.plugins.xtest.ecoKind = ConfigSelection(default = "Auto", choices = [("Auto", _("Auto")), ("Quiet", _("Quiet")), ("Powerful", _("Powerful"))])
      29. config.plugins.xtest.ecoSchlaf = ConfigSelection(default = "Auto", choices = [("Auto", _("Auto")), ("Quiet", _("Quiet")), ("Powerful", _("Powerful"))])
      30. config.plugins.xtest.fanspeedFlur = ConfigSelection(default = "Auto", choices = [("Auto", _("Auto")), ("Low", _("Low")), ("LowMid", _("LowMid")),("Mid", _("Mid")),("HighMid", _("HighMid")),("High", _("High"))])
      31. config.plugins.xtest.fanspeedKind = ConfigSelection(default = "Auto", choices = [("Auto", _("Auto")), ("Low", _("Low")), ("LowMid", _("LowMid")),("Mid", _("Mid")),("HighMid", _("HighMid")),("High", _("High"))])
      32. config.plugins.xtest.fanspeedSchlaf = ConfigSelection(default = "Auto", choices = [("Auto", _("Auto")), ("Low", _("Low")), ("LowMid", _("LowMid")),("Mid", _("Mid")),("HighMid", _("HighMid")),("High", _("High"))])
      33. config.plugins.xtest.e1 = ConfigText(default = "Eintrag 1", fixed_size = False)
      34. config.plugins.xtest.e2 = ConfigText(default = "Eintrag 2", fixed_size = False)
      35. config.plugins.xtest.TempFlur = ConfigInteger(default = 20, limits = (16, 30))
      36. config.plugins.xtest.TempKind = ConfigInteger(default = 20, limits = (16, 30))
      37. config.plugins.xtest.TempSchlaf = ConfigInteger(default = 20, limits = (16, 30))
      38. config.plugins.xtest.AllOff= ConfigYesNo(default = True)
      39. config.plugins.xtest.none = ConfigSelection(default = " ", choices = [(" ", _(" "))])
      40. class xtest_config(ConfigListScreen,Screen):
      41. def __init__(self, session):
      42. try:
      43. print "[XTEST] xtest_config"
      44. Screen.__init__(self, session)
      45. self.session=session
      46. self.skinName = ["XTEST", "Setup"]
      47. self.onChangedEntry = [ ]
      48. self.list = []
      49. self['key_red'] = StaticText(_('Cancel'))
      50. self['key_green'] = StaticText(_('OK'))
      51. self.createsetup()
      52. self['actions'] = NumberActionMap(["ColorActions","SetupActions"],
      53. {'cancel': self.keyCancel,
      54. 'green': self.ok,
      55. 'ok': self.ok
      56. }, -1)
      57. ConfigListScreen.__init__(self, self.list, session = session, on_change = self.changedEntry )
      58. self.onLayoutFinish.append(self.onLayout)
      59. print "[XTEST] /xtest_config"
      60. except:
      61. print "[XTEST] ERROR", sys.exc_info()[0],sys.exc_info()[1]
      62. traceback.print_exc()
      63. def keyCancel(self):
      64. try:
      65. for x in self["config"].list:
      66. if len(x)>1:
      67. x[1].cancel()
      68. self.close()
      69. except:
      70. print "[XTEST] ERROR", sys.exc_info()[0],sys.exc_info()[1]
      71. traceback.print_exc()
      72. def onLayout(self):
      73. try:
      74. self.setTitle("Klima Steuerung")
      75. self["config"].setCurrentIndex(5)
      76. except:
      77. print "[XTEST] ERROR", sys.exc_info()[0],sys.exc_info()[1]
      78. traceback.print_exc()
      79. def createsetup(self):
      80. try:
      81. index=len(self.list)-1
      82. while index>=0:
      83. del self.list[index]
      84. index-=1
      85. self.list.append(getConfigListEntry(_("(Einstellungen)")))
      86. # self.list.append(getConfigListEntry(_(" ")))
      87. self.list.append(getConfigListEntry(_("Modus für alle Geräte"),config.plugins.xtest.modus))
      88. self.list.append(getConfigListEntry(_(" Klima Flur"),config.plugins.xtest.onoffFlur))
      89. if config.plugins.xtest.onoffFlur.value == "On":
      90. self.list.append(getConfigListEntry(_(" Temperatur"),config.plugins.xtest.TempFlur))
      91. self.list.append(getConfigListEntry(_(" ECO-Modus"),config.plugins.xtest.ecoFlur))
      92. self.list.append(getConfigListEntry(_(" Fan-Speed"),config.plugins.xtest.fanspeedFlur))
      93. self.list.append(getConfigListEntry(_(" Klima Flur einschalten"),config.plugins.xtest.none))
      94. self.list.append(getConfigListEntry(_(" Klima Schlafzimmer"),config.plugins.xtest.onoffKind))
      95. if config.plugins.xtest.onoffKind.value == "On":
      96. self.list.append(getConfigListEntry(_(" Temperatur"),config.plugins.xtest.TempKind))
      97. self.list.append(getConfigListEntry(_(" ECO-Modus"),config.plugins.xtest.ecoKind))
      98. self.list.append(getConfigListEntry(_(" Fan-Speed"),config.plugins.xtest.fanspeedKind))
      99. self.list.append(getConfigListEntry(_(" Klima Schlafzimmer einschalten"),config.plugins.xtest.none))
      100. self.list.append(getConfigListEntry(_(" Klima Kinderzimmer"),config.plugins.xtest.onoffSchlaf))
      101. if config.plugins.xtest.onoffSchlaf.value == "On":
      102. self.list.append(getConfigListEntry(_(" Temperatur"),config.plugins.xtest.TempSchlaf))
      103. self.list.append(getConfigListEntry(_(" ECO-Modus"),config.plugins.xtest.ecoSchlaf))
      104. self.list.append(getConfigListEntry(_(" Fan-Speed"),config.plugins.xtest.fanspeedSchlaf))
      105. self.list.append(getConfigListEntry(_(" Klima Kinderzimmer einschalten"),config.plugins.xtest.none))
      106. self.list.append(getConfigListEntry(_("Alle Klimegeräte auschalten"),config.plugins.xtest.none))
      107. self.list.append(getConfigListEntry(_("Alle Klimegeräte einschalten"),config.plugins.xtest.none))
      108. self.list.append(getConfigListEntry(_(" ")))
      109. except:
      110. print "[XTEST] ERROR", sys.exc_info()[0],sys.exc_info()[1]
      111. traceback.print_exc()
      112. def changedEntry(self):
      113. try:
      114. print "[XTEST] changedEntry"
      115. self.createsetup()
      116. cur = self["config"].getCurrent()
      117. self["config"].setList(self.list)
      118. if cur and cur is not None:
      119. self["config"].updateConfigListView(cur)
      120. except:
      121. print "[XTEST] ERROR", sys.exc_info()[0],sys.exc_info()[1]
      122. traceback.print_exc()
      123. def ok(self):
      124. try:
      125. if self['config'].getCurrent()[0] == " Klima Flur einschalten":
      126. devices = session.get_devices()
      127. session.set_device(devices[0]['id'],
      128. power = pcomfortcloud.constants.Power[config.plugins.xtest.onoffFlur.value],
      129. temperature = config.plugins.xtest.TempFlur.value,
      130. fanSpeed = pcomfortcloud.constants.FanSpeed[config.plugins.xtest.fanspeedFlur.value],
      131. eco = pcomfortcloud.constants.EcoMode[config.plugins.xtest.ecoFlur.value],
      132. mode = pcomfortcloud.constants.OperationMode[config.plugins.xtest.modus.value])
      133. self.session.open(MessageBox, _("Klima Flur \nTemperatur " + str(config.plugins.xtest.TempFlur.value) +
      134. "\nFanSpeed " + str(config.plugins.xtest.fanspeedFlur.value) +
      135. "\nEco-Modus " + str(config.plugins.xtest.ecoFlur.value) +
      136. "\nModus " + str(config.plugins.xtest.modus.value)), MessageBox.TYPE_INFO, timeout = 5)
      137. elif self['config'].getCurrent()[0] == " Klima Schlafzimmer einschalten":
      138. devices = session.get_devices()
      139. session.set_device(devices[1]['id'],
      140. power = pcomfortcloud.constants.Power[config.plugins.xtest.onoffSchlaf.value],
      141. temperature = config.plugins.xtest.TempSchlaf.value,
      142. fanSpeed = pcomfortcloud.constants.FanSpeed[config.plugins.xtest.fanspeedSchlaf.value],
      143. eco = pcomfortcloud.constants.EcoMode[config.plugins.xtest.ecoSchlaf.value],
      144. mode = pcomfortcloud.constants.OperationMode[config.plugins.xtest.modus.value])
      145. self.session.open(MessageBox, _("Klima Schlafzimmer \nTemperatur " + str(config.plugins.xtest.TempSchlaf.value) +
      146. "\nFanSpeed " + str(config.plugins.xtest.fanspeedSchlaf.value) +
      147. "\nEco-Modus " + str(config.plugins.xtest.ecoSchlaf.value) +
      148. "\nModus " + str(config.plugins.xtest.modus.value)), MessageBox.TYPE_INFO, timeout = 5)
      149. elif self['config'].getCurrent()[0] == " Klima Kinderzimmer einschalten":
      150. devices = session.get_devices()
      151. session.set_device(devices[2]['id'],
      152. power = pcomfortcloud.constants.Power[config.plugins.xtest.onoffKind.value],
      153. temperature = config.plugins.xtest.TempKind.value,
      154. fanSpeed = pcomfortcloud.constants.FanSpeed[config.plugins.xtest.fanspeedKind.value],
      155. eco = pcomfortcloud.constants.EcoMode[config.plugins.xtest.ecoKind.value],
      156. mode = pcomfortcloud.constants.OperationMode[config.plugins.xtest.modus.value])
      157. self.session.open(MessageBox, _("Klima Kinderzimmer \nTemperatur " + str(config.plugins.xtest.TempKind.value) +
      158. "\nFanSpeed " + str(config.plugins.xtest.fanspeedKind.value) +
      159. "\nEco-Modus " + str(config.plugins.xtest.ecoKind.value) +
      160. "\nModus " + str(config.plugins.xtest.modus.value)), MessageBox.TYPE_INFO, timeout = 5)
      161. elif self['config'].getCurrent()[0] == "Alle Klimegeräte auschalten":
      162. devices = session.get_devices()
      163. my_threadoff0 = threading.Thread(target=klima0_aus)
      164. my_threadoff1 = threading.Thread(target=klima1_aus)
      165. my_threadoff2 = threading.Thread(target=klima2_aus)
      166. my_threadoff0.start()
      167. my_threadoff1.start()
      168. my_threadoff2.start()
      169. elif self['config'].getCurrent()[0] == "Alle Klimegeräte einschalten":
      170. devices = session.get_devices()
      171. my_threadan0 = threading.Thread(target=klima0_an)
      172. my_threadan1 = threading.Thread(target=klima1_an)
      173. my_threadan2 = threading.Thread(target=klima2_an)
      174. my_threadan0.start()
      175. my_threadan1.start()
      176. my_threadan2.start()
      177. else:
      178. for x in self["config"].list:
      179. if len(x)>1:
      180. print "[XTEST] Save: " + str(x[0]) + "=" + str(x[1].value)
      181. x[1].save()
      182. self.close()
      183. except:
      184. print "[XTEST] ERROR", sys.exc_info()[0],sys.exc_info()[1]
      185. traceback.print_exc()
      186. def klima0_aus():
      187. devices = session.get_devices()
      188. session.set_device(devices[0]['id'],
      189. power = pcomfortcloud.constants.Power.Off)
      190. # temperature = config.plugins.xtest.TempFlur.value,
      191. # fanSpeed = pcomfortcloud.constants.FanSpeed[config.plugins.xtest.fanspeedFlur.value],
      192. # eco = pcomfortcloud.constants.EcoMode[config.plugins.xtest.ecoFlur.value],
      193. # mode = pcomfortcloud.constants.OperationMode[config.plugins.xtest.modus.value])
      194. def klima1_aus():
      195. devices = session.get_devices()
      196. session.set_device(devices[1]['id'],
      197. power = pcomfortcloud.constants.Power.Off)
      198. # temperature = config.plugins.xtest.TempKind.value,
      199. # fanSpeed = pcomfortcloud.constants.FanSpeed[config.plugins.xtest.fanspeedKind.value],
      200. # eco = pcomfortcloud.constants.EcoMode[config.plugins.xtest.ecoKind.value],
      201. # mode = pcomfortcloud.constants.OperationMode[config.plugins.xtest.modus.value])
      202. def klima2_aus():
      203. devices = session.get_devices()
      204. session.set_device(devices[2]['id'],
      205. power = pcomfortcloud.constants.Power.Off)
      206. # temperature = config.plugins.xtest.TempSchlaf.value,
      207. # fanSpeed = pcomfortcloud.constants.FanSpeed[config.plugins.xtest.fanspeedSchlaf.value],
      208. # eco = pcomfortcloud.constants.EcoMode[config.plugins.xtest.ecoSchlaf.value],
      209. # mode = pcomfortcloud.constants.OperationMode[config.plugins.xtest.modus.value])
      210. def klima0_an():
      211. devices = session.get_devices()
      212. session.set_device(devices[0]['id'],
      213. power = pcomfortcloud.constants.Power.On,
      214. temperature = config.plugins.xtest.TempFlur.value,
      215. fanSpeed = pcomfortcloud.constants.FanSpeed[config.plugins.xtest.fanspeedFlur.value],
      216. eco = pcomfortcloud.constants.EcoMode[config.plugins.xtest.ecoFlur.value],
      217. mode = pcomfortcloud.constants.OperationMode[config.plugins.xtest.modus.value])
      218. def klima1_an():
      219. devices = session.get_devices()
      220. session.set_device(devices[1]['id'],
      221. power = pcomfortcloud.constants.Power.On,
      222. temperature = config.plugins.xtest.TempKind.value,
      223. fanSpeed = pcomfortcloud.constants.FanSpeed[config.plugins.xtest.fanspeedKind.value],
      224. eco = pcomfortcloud.constants.EcoMode[config.plugins.xtest.ecoKind.value],
      225. mode = pcomfortcloud.constants.OperationMode[config.plugins.xtest.modus.value])
      226. def klima2_an():
      227. devices = session.get_devices()
      228. session.set_device(devices[2]['id'],
      229. power = pcomfortcloud.constants.Power.On,
      230. temperature = config.plugins.xtest.TempSchlaf.value,
      231. fanSpeed = pcomfortcloud.constants.FanSpeed[config.plugins.xtest.fanspeedSchlaf.value],
      232. eco = pcomfortcloud.constants.EcoMode[config.plugins.xtest.ecoSchlaf.value],
      233. mode = pcomfortcloud.constants.OperationMode[config.plugins.xtest.modus.value])
      234. def main(session, **kwargs):
      235. try:
      236. session.open(xtest_config)
      237. except:
      238. print "[XTEST] ERROR", sys.exc_info()[0],sys.exc_info()[1]
      239. traceback.print_exc()
      240. def Plugins(path,**kwargs):
      241. list = []
      242. list.append(PluginDescriptor(name="K l i m a", description=_("Steuerung"), where = PluginDescriptor.WHERE_PLUGINMENU, fnc=main))
      243. return list
      Display All
      Files
      • Unbenannt.png

        (65.94 kB, downloaded 21 times, last: )

      The post was edited 5 times, last by PitderBeste ().