Re: [weewx-development] Re: Instaling alarm.py from examples

2018-04-06 Thread Thomas Keffer
You should use the version of alarm.py that comes with weeWX. It's in the
directory 'examples'. It can also be downloaded here
.

-tk

On Fri, Apr 6, 2018 at 11:34 AM, Jesper  wrote:

>
>
> Den mandag den 12. februar 2018 kl. 22.17.53 UTC+1 skrev Jesper:
>
>>
>>
>> Den mandag den 12. februar 2018 kl. 22.11.02 UTC+1 skrev Jesper:
>>>
>>> Yes to the includet code line.
>>
>>
>> I have used Python interactive with a few line of code and tested that
>> login work.
>>
>> Jesper
>>
>>
>
> I have moved weeWX from Raspberry Pi 3 to a Lenovo Thinkpad T60 with
> Debian 9.3 installed to get more CPU power.
>
> The Alarm.py module are still giving me troubles. I use the version
> which Tom Keffer uploaded to this page. First time the expression is
> evaluated true I get this exception.
>
> Exception in thread Thread-2:
>
> Traceback (most recent call last):
>
>   File "/usr/lib/python2.7/threading.py", line 801, in
> __bootdtrap_inner
>
> self.run()
>
>   File "/usr/lib/python2.7/threading.py", line 754, in run
>
> self.__target(*self.__args, **self.__kwags)
>
>   File "/home/weewx/bin/user/alarm.py”, line 177, in soundTheAlarm
>
> syslog.syslog/syslog.LOG_ERR, "alarm: Got exception while
> sounding the alarm: %s" (e,))
>
> TypeError:  'str' object is not callable
>
>
>
> Can someone give me a hint?
>
>




Re: [weewx-development] Re: Instaling alarm.py from examples

2018-02-12 Thread Jesper


Den mandag den 12. februar 2018 kl. 22.11.02 UTC+1 skrev Jesper:
>
> Yes to the includet code line.


I have used Python interactive with a few line of code and tested that 
login work.

Jesper


>>>
>>>  
>>>
>>
>>

Re: [weewx-development] Re: Instaling alarm.py from examples

2018-02-12 Thread Jesper
Yes
>
>
>>
>>  
>>
>
>

Re: [weewx-development] Re: Instaling alarm.py from examples

2018-02-12 Thread Thomas Keffer
I am not following you when you say "a new syslog message just 2 code lines
after the evaluated True messages." Does that mean you have something like
this:

# Log it
syslog.syslog(syslog.LOG_INFO, "alarm: Alarm expression \"%s\"
evaluated True at %s" % (self.expression, t_str))

# Form the message text:
msg_text = "Alarm expression \"%s\" evaluated True at
%s\nRecord:\n%s" % (self.expression, t_str, str(rec))
# Convert to MIME:
msg = MIMEText(msg_text)

syslog.syslog(syslog.LOG_INFO, "New logging message")

# Fill in MIME headers:
msg['Subject'] = self.SUBJECT
msg['From']= self.FROM
msg['To']  = ','.join(self.TO)


If so, and you got the expected email message, then I am totally mystified
as to why the other log messages did not appear.

-tk

On Mon, Feb 12, 2018 at 7:30 AM, Jesper  wrote:

>
> Thanks for the new version of alarm.py. Unfortunately it didn't change the
> function. Syslog file is attached. I have tried to include a new syslog
> message just 2 code lines after the evaluated True messages. Result nothing
> in the syslog. After that the email facility in Python was test with a
> positive result. The expected email was received.
>
> I have also tried to change the time_wait constant, but realized that
> alarm is only reported when archive records are generated.
>
> Jesper
>
>>
>>
>
>