[ANSWERED]: POPP Z-Weather

Posted on
Mon Aug 15, 2016 3:05 pm
kw123 offline
User avatar
Posts: 8366
Joined: May 12, 2013
Location: Dallas, TX

Re: [ANSWERED]: POPP Z-Weather

Code: Select all
Z-Wave received "Weather Station" sensor update to 21%
Z-Wave received "Weather Station" sensor update to 88%

the lines are identical. There is no way to separate them besides sequence.
(and by the way battery also has a %)

and
if re.search(searchLine + ".*%", logevent):
only looks for anything+% and it takes the first (= last occurrence in the log file)

if the sequence is always the same we could do something, if not I don't know how to solve this.

to find the first and last one with %:
Code: Select all
found = False
for logevent in reversed(log):
     if logevent.find(searchLine) > -1:
         if logevent.find("%") > -1:
             if not found
                 found = True
                 luftfuktighet = logevent.split(" ")[7]   # [69:72]
                 indigo.server.log("  Weather Station Luftfuktighet found in eventLog: ["+luftfuktighet+"]")
                 indigo.variable.updateValue(386320416, value=luftfuktighet ) # "WSluftfuktighet"
              else:
                 otherValue = logevent.split(" ")[7]   # [69:72]
                 indigo.server.log("  otehr line found : ["+otherValue+"]")
                 indigo.variable.updateValue(123123123, value=otherValue ) # "otherValue"
                 break


this will do 2 lines with %
first = humidity and 2. with a % for your other variable

if I understand this correctly

Karl

Posted on
Tue Aug 16, 2016 2:03 am
mortenkols offline
Posts: 198
Joined: Oct 29, 2014
Location: Norway

Re: [ANSWERED]: POPP Z-Weather

kw123 wrote:
Code: Select all
Z-Wave received "Weather Station" sensor update to 21%
Z-Wave received "Weather Station" sensor update to 88%

the lines are identical. There is no way to separate them besides sequence.
(and by the way battery also has a %)

and
if re.search(searchLine + ".*%", logevent):
only looks for anything+% and it takes the first (= last occurrence in the log file)

if the sequence is always the same we could do something, if not I don't know how to solve this.

to find the first and last one with %:
Code: Select all
found = False
for logevent in reversed(log):
     if logevent.find(searchLine) > -1:
         if logevent.find("%") > -1:
             if not found
                 found = True
                 luftfuktighet = logevent.split(" ")[7]   # [69:72]
                 indigo.server.log("  Weather Station Luftfuktighet found in eventLog: ["+luftfuktighet+"]")
                 indigo.variable.updateValue(386320416, value=luftfuktighet ) # "WSluftfuktighet"
              else:
                 otherValue = logevent.split(" ")[7]   # [69:72]
                 indigo.server.log("  otehr line found : ["+otherValue+"]")
                 indigo.variable.updateValue(123123123, value=otherValue ) # "otherValue"
                 break


this will do 2 lines with %
first = humidity and 2. with a % for your other variable

if I understand this correctly

Karl
im gonna test it after work

Posted on
Tue Aug 16, 2016 5:03 am
mortenkols offline
Posts: 198
Joined: Oct 29, 2014
Location: Norway

Re: [ANSWERED]: POPP Z-Weather

the sequence is always the same.

2015-12-15 14:10:19.685 Z-Wave received "Weather Station" sensor update to 21% - Lux
2015-12-15 14:10:19.827 Z-Wave received "Weather Station" sensor update to 98% - Humidity

I tried the code, but comes an error

Code: Select all
found = False
for logevent in reversed(log):
     if logevent.find(searchLine) > -1:
         if logevent.find("%") > -1:
             if not found
                 found = True
                 luftfuktighet = logevent.split(" ")[7]   # [69:72]
                 indigo.server.log("  Weather Station Luftfuktighet found in eventLog: ["+luftfuktighet+"]")
                 indigo.variable.updateValue(386320416, value=luftfuktighet ) # "WSluftfuktighet"
              else:
                 lux = logevent.split(" ")[7]   # [69:72]
                 indigo.server.log("  Weather Station Lux found in eventlog : ["+lux+"]")
                 indigo.variable.updateValue(1506914814, value=lux ) # "WSlux"
                 break



Script Error embedded script: invalid syntax
Script Error around line 84 - "if not found"

Posted on
Tue Aug 16, 2016 7:53 am
kw123 offline
User avatar
Posts: 8366
Joined: May 12, 2013
Location: Dallas, TX

Re: [ANSWERED]: POPP Z-Weather

add a : at the end of line
if not found:

Posted on
Tue Aug 16, 2016 12:19 pm
mortenkols offline
Posts: 198
Joined: Oct 29, 2014
Location: Norway

Re: [ANSWERED]: POPP Z-Weather

Still some errors :D
Attachments
Skjermbilde 2016-08-16 kl. 20.18.51.png
Skjermbilde 2016-08-16 kl. 20.18.51.png (11.23 KiB) Viewed 3962 times
Skjermbilde 2016-08-16 kl. 20.18.22.png
Skjermbilde 2016-08-16 kl. 20.18.22.png (61.94 KiB) Viewed 3962 times

Posted on
Tue Aug 16, 2016 2:01 pm
kw123 offline
User avatar
Posts: 8366
Joined: May 12, 2013
Location: Dallas, TX

Re: [ANSWERED]: POPP Z-Weather

the else has to at the same position as the if

and make sure that you don't have a mix of space and tabs

Posted on
Tue Aug 16, 2016 2:23 pm
mortenkols offline
Posts: 198
Joined: Oct 29, 2014
Location: Norway

Re: [ANSWERED]: POPP Z-Weather

Oki, wtf, is that important.

the script is working, but the current lux level is 21%, but the script set 100%.
Attachments
Skjermbilde 2016-08-16 kl. 22.20.27.png
Skjermbilde 2016-08-16 kl. 22.20.27.png (8.4 KiB) Viewed 3915 times
Skjermbilde 2016-08-16 kl. 22.17.56.png
Skjermbilde 2016-08-16 kl. 22.17.56.png (51.34 KiB) Viewed 3915 times
Skjermbilde 2016-08-16 kl. 22.18.17.png
Skjermbilde 2016-08-16 kl. 22.18.17.png (42.8 KiB) Viewed 3915 times

Posted on
Tue Aug 16, 2016 2:44 pm
mortenkols offline
Posts: 198
Joined: Oct 29, 2014
Location: Norway

Re: [ANSWERED]: POPP Z-Weather

works now. i had forgotten; break
..at the end of the script.

Posted on
Wed Aug 31, 2016 3:53 am
mortenkols offline
Posts: 198
Joined: Oct 29, 2014
Location: Norway

Re: [ANSWERED]: POPP Z-Weather

Image why cant i se what you have poster matt?

Posted on
Wed Aug 31, 2016 6:46 am
matt (support) offline
Site Admin
User avatar
Posts: 21418
Joined: Jan 27, 2003
Location: Texas

Re: [ANSWERED]: POPP Z-Weather

I was wondering if anyone would catch my mistake there. I guess you could call this a very unintentional #indigo7sneak.

Image

Posted on
Wed Aug 31, 2016 10:48 am
howartp offline
Posts: 4559
Joined: Jan 09, 2014
Location: West Yorkshire, UK

Re: [ANSWERED]: POPP Z-Weather

:-)


Sent from my iPhone using Tapatalk

Posted on
Wed Aug 31, 2016 1:49 pm
durosity offline
User avatar
Posts: 4320
Joined: May 10, 2012
Location: Newcastle Upon Tyne, Ye Ol' England.

Re: [ANSWERED]: POPP Z-Weather

*cough*

Computer says no.

Posted on
Mon Sep 05, 2016 12:30 pm
mortenkols offline
Posts: 198
Joined: Oct 29, 2014
Location: Norway

Re: [ANSWERED]: POPP Z-Weather

Hello karl.
My mac mini restarted on its own, after the restart the script dosent update the variables..

If i run the script manually, nothing appear in the log..

5. sep. 2016, 19.28.56
Z-Wave received "Ute - Weather Station" sensor update to 0 m/s
Z-Wave received "Ute - Weather Station" sensor update to 8.3 °C
Z-Wave received "Ute - Weather Station" sensor update to 100%
Z-Wave received "Ute - Weather Station" sensor update to 72%
Z-Wave received "Ute - Weather Station" sensor update to 100.0 kPa
Z-Wave received "Ute - Weather Station" sensor update to 3.6 mm/h
Z-Wave received "002 - Ute - Weather Station" status update battery level 100%

5. sep. 2016, 19.29.17
Embedded script executor host started

Posted on
Mon Sep 05, 2016 7:41 pm
kw123 offline
User avatar
Posts: 8366
Joined: May 12, 2013
Location: Dallas, TX

Re: [ANSWERED]: POPP Z-Weather

it is looking for :
received "Weather Station" sensor update to '

thats not in this string:
Z-Wave received "Ute - Weather Station" sensor update to 0 m/s

This is extra Ute -

solution: change
searchLine = '"Weather Station" sensor update to'

Karl

Posted on
Tue Sep 06, 2016 6:17 am
mortenkols offline
Posts: 198
Joined: Oct 29, 2014
Location: Norway

Re: [ANSWERED]: POPP Z-Weather

ah, the device name has been changed to an older name. its working now. thanks :)

Can i hide what the scripts found from the log?

6. sep. 2016, 13.58.54
Script Weather station Vind found in eventLog: [1m/s]
Script Weather Station Luftfuktighet found in eventLog: [97%]
Script Weather Station Temperatur found in eventLog: [9.4C]
Script Weather Station Trykk found in eventLog: [98.9kPa]
Script Weather Station Dugg found in eventLog: [8.8mm/h]
Script Weather Station Luftfuktighet found in eventLog: [97%]
Script Weather Station Lux found in eventlog : [100%]
Script Weather Station Batteri found in eventLog: [100]


I dont won't this in the log

Who is online

Users browsing this forum: No registered users and 11 guests