connections habe ich rausgeworfen, fehler ist weg.
Nun bekomme ich
da hilft auskommentieren nicht weiter...
... aaah, ich hatte irgendwann vergessen am anfang
mitzunehmen. Das noch ergänzt durch import threading - bin stolz auf mich! 
Weiter gehts:
- alles klar, noch import logger rein, allmählich kapiere ich es ein wenig.
Aber jetzt bin ich an einem Punkt, wo ich wieder nachfragen muss:
Hier ist die aktuelle Datei:
Nun bekomme ich
Code:
ParadigmaSystaComfort Method ParadigmaSystaComfort exception: 'ParadigmaSystaComfort' object has no attribute '_lock' -- scheduler.py:_task:348 Traceback (most recent call last): File "/usr/local/smarthome/lib/scheduler.py", line 344, in _task obj() File "/usr/local/smarthome/plugins/paradigma/__init__.py", line 41, in _refresh self._lock.acquire() AttributeError: 'ParadigmaSystaComfort' object has no attribute '_lock'
... aaah, ich hatte irgendwann vergessen am anfang
Code:
import subprocess import json

Weiter gehts:
Code:
problem creating: global name 'logger' is not defined
Aber jetzt bin ich an einem Punkt, wo ich wieder nachfragen muss:
Code:
2015-01-06 20:11:57,262 ERROR Main Item HaustechnikTechnik.Paradigma.Kollektor_TSA: problem creating: global name 'logger' is not defined -- item.py:__init__:221 2015-01-06 20:11:57,293 INFO Main Start Plugins -- plugin.py:start:65 2015-01-06 20:11:57,311 INFO Main Start Logics -- logic.py:__init__:33 2015-01-06 20:11:57,411 ERROR ParadigmaSystaComfort Method ParadigmaSystaComfort exception: Command '['/usr/bin/curl', 'http://paradigma.remoteportal.de/ajax.php', '-H Host: paradigma.remoteportal.de', '-H User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:34.0) Gecko/20100101 Firefox/34.0', '-H Accept: application/json, text/javascript, */*; q=0.01', '-H Accept-Language: de,en-US;q=0.7,en;q=0.3', '-H Accept-Encoding: gzip, deflate', '-H DNT: 1 -H Content-Type: application/x-www-form-urlencoded; charset=UTF-8', '-H X-Requested-With: XMLHttpRequest', '-H Referer: http://paradigma.remoteportal.de/index.php?pto[area]=-controller', '-H Cookie: ibb=xxx', '-H Connection: keep-alive', '-H Pragma: no-cache', '-H Cache-Control: no-cache', '--data call=controller.status¶m[controllerId]=12720¶m[mode]=text']' returned non-zero exit status 2 -- scheduler.py:_task:348 Traceback (most recent call last): File "/usr/local/smarthome/lib/scheduler.py", line 344, in _task obj() File "/usr/local/smarthome/plugins/paradigma/__init__.py", line 61, in _refresh '--data call=controller.status¶m[controllerId]=%s¶m[mode]=text' % self._id]) File "/usr/lib/python3.2/subprocess.py", line 522, in check_output raise CalledProcessError(retcode, cmd, output=output) subprocess.CalledProcessError: Command '['/usr/bin/curl', 'http://paradigma.remoteportal.de/ajax.php', '-H Host: paradigma.remoteportal.de', '-H User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:34.0) Gecko/20100101 Firefox/34.0', '-H Accept: application/json, text/javascript, */*; q=0.01', '-H Accept-Language: de,en-US;q=0.7,en;q=0.3', '-H Accept-Encoding: gzip, deflate', '-H DNT: 1 -H Content-Type: application/x-www-form-urlencoded; charset=UTF-8', '-H X-Requested-With: XMLHttpRequest', '-H Referer: http://paradigma.remoteportal.de/index.php?pto[area]=-controller', '-H Cookie: ibb=xxx', '-H Connection: keep-alive', '-H Pragma: no-cache', '-H Cache-Control: no-cache', '--data call=controller.status¶m[controllerId]=12720¶m[mode]=text']' returned non-zero exit status 2
Code:
import subprocess import json import threading import logging class ParadigmaSystaComfort: _sensors = {} alive = True def __init__(self, smarthome, cycle=120, cookie='XXX', id='YYY'): self._sh = smarthome self._cycle = int(cycle) self._cookie = cookie self._id = id self._lock = threading.Lock() # smarthome.connections.monitor(self) def _refresh(self): self._lock.acquire() jsontext = subprocess.check_output(['/usr/bin/curl', 'http://paradigma.remoteportal.de/ajax.php', \ '-H Host: paradigma.remoteportal.de', \ '-H User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:34.0) Gecko/20100101 Firefox/34.0', \ '-H Accept: application/json, text/javascript, */*; q=0.01', \ '-H Accept-Language: de,en-US;q=0.7,en;q=0.3', \ '-H Accept-Encoding: gzip, deflate', \ '-H DNT: 1 -H Content-Type: application/x-www-form-urlencoded; charset=UTF-8', \ '-H X-Requested-With: XMLHttpRequest', \ '-H Referer: http://paradigma.remoteportal.de/index.php?pto[area]=-controller', \ '-H Cookie: ibb=%s' % self._cookie, \ '-H Connection: keep-alive', \ '-H Pragma: no-cache', \ '-H Cache-Control: no-cache', \ '--data call=controller.status¶m[controllerId]=%s¶m[mode]=text' % self._id]) table = {} table["245534"] = json_text["values"]["245534"] #Kollektor -TSA- table["245542"] = json_text["values"]["245542"] #Kollektor Maximum table["245543"] = json_text["values"]["245543"] #Solare Leistung table["245544"] = json_text["values"]["245544"] #Tagesgewinn table["245545"] = json_text["values"]["245545"] #Solargewinn table["245538"] = json_text["values"]["245538"] #Aussentemperatur -TAM- table["245535"] = json_text["values"]["245535"] #Solarruecklauf -TSE- table["245536"] = json_text["values"]["245536"] #Solarvorlauf -TSV- table["245537"] = json_text["values"]["245537"] #Speicher Oben -TW- table["245540"] = json_text["values"]["245540"] #Volumenstrom table["245541"] = json_text["values"]["245541"] #Speicher Oben -TW2- table["245546"] = json_text["values"]["245546"] #Kollektor 1 -TSA 1- table["245548"] = json_text["values"]["245548"] #Laufzeit Pumpe table["245549"] = json_text["values"]["245549"] #Zeit TSA MAX table["245564"] = json_text["values"]["245564"] #Puffer Sollwert table["245565"] = json_text["values"]["245565"] #Puffer oben -TPO- table["245566"] = json_text["values"]["245566"] #Betriebsstunden table["245567"] = json_text["values"]["245567"] #Kesselvorlauf -TV- for addr in self._sensors: if addr not in table: logger.debug("paradigmaSystaComfort: {0} not in sensors".format(addr)) else: value = table[addr] item = self._sensors[addr] item(value, 'paradigmaSystaComfort') self._lock.release() def run(self): self.alive = True self._sh.scheduler.add('ParadigmaSystaComfort', self._refresh, cycle=self._cycle, prio=5, offset=0) def stop(self): self.alive = False def parse_item(self, item): if 'paradigmaSystaComfort_ID' not in item.conf: return addr = item.conf['paradigmaSystaComfort_ID'] self._sensors[addr] = item logger.info("paradigmaSystaComfort: Sensor {0} added.".format(addr))
Kommentar