SwitchKing + EventGhost + Rasberry + OneWire
-
- 3 stars
- Posts: 136
- Joined: Tue 09 Nov 2010, 21:51
Re: SwitchKing + EventGhost + Rasberry + OneWire
Nu har jag kommit så långt att det kommer in värden i EG varje minut (har samma ljussensor som du). Nu ska bara värdena in i SK...Får följane fel Error compling script, Traceback (most reason call last), SyntaxError: invalid syntax (1 line 11) och inga värden kommer in i SK. Copierade scriptet som du visade ändrade datakällor till det som dom heter i Sk
-
- 4 stars
- Posts: 336
- Joined: Thu 19 Jul 2012, 19:41
Re: SwitchKing + EventGhost + Rasberry + OneWire
nånting är troligen fel på rad 10 eller 11 i ditt script
-
- 3 stars
- Posts: 136
- Joined: Tue 09 Nov 2010, 21:51
Re: SwitchKing + EventGhost + Rasberry + OneWire
Ok när du gör en datakälla i SK använder du att den ska skapas via rest?
-
- 3 stars
- Posts: 136
- Joined: Tue 09 Nov 2010, 21:51
Re: SwitchKing + EventGhost + Rasberry + OneWire
Så här ser det ut
def eventHandler(base, pload):
try:
if str(base).find('Measurements:') > -1 :
m = pload
m = m.strip('[]')
m = m.replace(',', '')
m = m.split()
print m
eg.plugins.SwitchkingTellStick.DSSet(u'', u'Sunone', str(m[2], 0)
eg.plugins.SwitchkingTellStick.DSSet(u'', u'Suntwice', str(m[1], 0)
eg.plugins.SwitchkingTellStick.DSSet(u'', u'Tempvest', str(float(m[0])), 0)
except:
pass
eg.event.suffix_copy = eg.event.suffix
eg.event.payload_copy = eg.event.payload
eventHandler(eg.event.suffix_copy, eg.event.payload_copy)
def eventHandler(base, pload):
try:
if str(base).find('Measurements:') > -1 :
m = pload
m = m.strip('[]')
m = m.replace(',', '')
m = m.split()
print m
eg.plugins.SwitchkingTellStick.DSSet(u'', u'Sunone', str(m[2], 0)
eg.plugins.SwitchkingTellStick.DSSet(u'', u'Suntwice', str(m[1], 0)
eg.plugins.SwitchkingTellStick.DSSet(u'', u'Tempvest', str(float(m[0])), 0)
except:
pass
eg.event.suffix_copy = eg.event.suffix
eg.event.payload_copy = eg.event.payload
eventHandler(eg.event.suffix_copy, eg.event.payload_copy)
-
- 4 stars
- Posts: 336
- Joined: Thu 19 Jul 2012, 19:41
Re: SwitchKing + EventGhost + Rasberry + OneWire
Python's syntax är väldigt känslig, tex skall indents alltid vara 4 stycken space, tab är ej tillåtet. Använd en bra text editor (även om notepad funkar, jag använder ultraedit, andra notepad+).
I ditt fall har vi ett enkelt fel, du har bara missat 2styck högerparenteser
skall vara
I ditt fall har vi ett enkelt fel, du har bara missat 2styck högerparenteser
Code: Select all
eg.plugins.SwitchkingTellStick.DSSet(u'', u'Sunone', str(m[2], 0)
eg.plugins.SwitchkingTellStick.DSSet(u'', u'Suntwice', str(m[1], 0)
Code: Select all
eg.plugins.SwitchkingTellStick.DSSet(u'', u'Sunone', str(m[2]), 0)
eg.plugins.SwitchkingTellStick.DSSet(u'', u'Suntwice', str(m[1]), 0)
-
- 4 stars
- Posts: 336
- Joined: Thu 19 Jul 2012, 19:41
Re: SwitchKing + EventGhost + Rasberry + OneWire
Beträffande datakällorna så definierade jag dom manuellt i SK i förväg
-
- 3 stars
- Posts: 136
- Joined: Tue 09 Nov 2010, 21:51
Re: SwitchKing + EventGhost + Rasberry + OneWire
Nu får jag fel på rad 13 (tempvest)
def eventHandler(base, pload):
try:
if str(base).find('Measurements:') > -1 :
m = pload
m = m.strip('[]')
m = m.replace(',', '')
m = m.split()
print m
eg.plugins.SwitchkingTellStick.DSSet(u'', u'Sunone', str(m[2]), 0)
eg.plugins.SwitchkingTellStick.DSSet(u'', u'Suntwice', str(m[1]), 0
eg.plugins.SwitchkingTellStick.DSSet(u'', u'Tempvest', str(float(m[0]), 0
except:
pass
eg.event.suffix_copy = eg.event.suffix
eg.event.payload_copy = eg.event.payload
eventHandler(eg.event.suffix_copy, eg.event.payload_copy)
def eventHandler(base, pload):
try:
if str(base).find('Measurements:') > -1 :
m = pload
m = m.strip('[]')
m = m.replace(',', '')
m = m.split()
print m
eg.plugins.SwitchkingTellStick.DSSet(u'', u'Sunone', str(m[2]), 0)
eg.plugins.SwitchkingTellStick.DSSet(u'', u'Suntwice', str(m[1]), 0
eg.plugins.SwitchkingTellStick.DSSet(u'', u'Tempvest', str(float(m[0]), 0
except:
pass
eg.event.suffix_copy = eg.event.suffix
eg.event.payload_copy = eg.event.payload
eventHandler(eg.event.suffix_copy, eg.event.payload_copy)
-
- 3 stars
- Posts: 136
- Joined: Tue 09 Nov 2010, 21:51
Re: SwitchKing + EventGhost + Rasberry + OneWire
Har ändrat enligt nedan får nu fel på rad 16 (Except:)
def eventHandler(base, pload):
try:
if str(base).find('Measurements:') > -1 :
m = pload
m = m.strip('[]')
m = m.replace(',', '')
m = m.split()
print m
eg.plugins.SwitchkingTellStick.DSSet(u'', u'Sunone', str(m[2]), 0)
eg.plugins.SwitchkingTellStick.DSSet(u'', u'Suntwice', str(m[1]), 0)
eg.plugins.SwitchkingTellStick.DSSet(u'', u'Tempvest', str(float(m[0]), 0)
except:
pass
eg.event.suffix_copy = eg.event.suffix
eg.event.payload_copy = eg.event.payload
eventHandler(eg.event.suffix_copy, eg.event.payload_copy)
def eventHandler(base, pload):
try:
if str(base).find('Measurements:') > -1 :
m = pload
m = m.strip('[]')
m = m.replace(',', '')
m = m.split()
print m
eg.plugins.SwitchkingTellStick.DSSet(u'', u'Sunone', str(m[2]), 0)
eg.plugins.SwitchkingTellStick.DSSet(u'', u'Suntwice', str(m[1]), 0)
eg.plugins.SwitchkingTellStick.DSSet(u'', u'Tempvest', str(float(m[0]), 0)
except:
pass
eg.event.suffix_copy = eg.event.suffix
eg.event.payload_copy = eg.event.payload
eventHandler(eg.event.suffix_copy, eg.event.payload_copy)
-
- 3 stars
- Posts: 136
- Joined: Tue 09 Nov 2010, 21:51
Re: SwitchKing + EventGhost + Rasberry + OneWire
Bifogar en kopia från Notepad++
You do not have the required permissions to view the files attached to this post.
-
- 3 stars
- Posts: 136
- Joined: Tue 09 Nov 2010, 21:51
Re: SwitchKing + EventGhost + Rasberry + OneWire
Så här ser det ut i EG
You do not have the required permissions to view the files attached to this post.
Who is online
Users browsing this forum: No registered users and 9 guests