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
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
>
>>
>>
>
>


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

2018-02-12 Thread Jesper

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

>
>
 
Feb 12 13:52:54 raspberrypi kernel: [0.00] Booting Linux on physical 
CPU 0x0
Feb 12 13:52:54 raspberrypi kernel: [0.00] Linux version 4.9.59-v7+ 
(dc4@dc4-XPS13-9333) (gcc version 4.9.3 (crosstool-NG 
crosstool-ng-1.22.0-88-g8460611) ) #1047 SMP Sun Oct 29 12:19:23 GMT 2017
Feb 12 13:52:54 raspberrypi kernel: [0.00] CPU: ARMv7 Processor 
[410fd034] revision 4 (ARMv7), cr=10c5383d
Feb 12 13:52:54 raspberrypi kernel: [0.00] CPU: div instructions 
available: patching division code
Feb 12 13:52:54 raspberrypi kernel: [0.00] CPU: PIPT / VIPT nonaliasing 
data cache, VIPT aliasing instruction cache
Feb 12 13:52:54 raspberrypi kernel: [0.00] OF: fdt:Machine model: 
Raspberry Pi 3 Model B Rev 1.2
Feb 12 13:52:54 raspberrypi kernel: [0.00] cma: Reserved 8 MiB at 
0x3a80
Feb 12 13:52:54 raspberrypi kernel: [0.00] Memory policy: Data cache 
writealloc
Feb 12 13:52:54 raspberrypi kernel: [0.00] On node 0 totalpages: 241664
Feb 12 13:52:54 raspberrypi kernel: [0.00] free_area_init_node: node 0, 
pgdat 80c6f380, node_mem_map b9faa000
Feb 12 13:52:54 raspberrypi kernel: [0.00]   Normal zone: 2124 pages 
used for memmap
Feb 12 13:52:54 raspberrypi kernel: [0.00]   Normal zone: 0 pages 
reserved
Feb 12 13:52:54 raspberrypi kernel: [0.00]   Normal zone: 241664 pages, 
LIFO batch:31
Feb 12 13:52:54 raspberrypi kernel: [0.00] percpu: Embedded 14 
pages/cpu @b9f64000 s25600 r8192 d23552 u57344
Feb 12 13:52:54 raspberrypi kernel: [0.00] pcpu-alloc: s25600 r8192 
d23552 u57344 alloc=14*4096
Feb 12 13:52:54 raspberrypi kernel: [0.00] pcpu-alloc: [0] 0 [0] 1 [0] 
2 [0] 3 
Feb 12 13:52:54 raspberrypi kernel: [0.00] Built 1 zonelists in Zone 
order, mobility grouping on.  Total pages: 239540
Feb 12 13:52:54 raspberrypi kernel: [0.00] Kernel command line: 
8250.nr_uarts=0 bcm2708_fb.fbwidth=1680 bcm2708_fb.fbheight=1050 
bcm2708_fb.fbswap=1 vc_mem.mem_base=0x3dc0 vc_mem.mem_size=0x3f00  
dwc_otg.lpm_enable=0 console=ttyS0,115200 console=tty1 root=/dev/mmcblk0p7 
rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait splash 
plymouth.ignore-serial-consoles
Feb 12 13:52:54 raspberrypi kernel: [0.00] PID hash table entries: 4096 
(order: 2, 16384 bytes)
Feb 12 13:52:54 raspberrypi kernel: [0.00] Dentry cache hash table 
entries: 131072 (order: 7, 524288 bytes)
Feb 12 13:52:54 raspberrypi kernel: [0.00] Inode-cache hash table 
entries: 65536 (order: 6, 262144 bytes)
Feb 12 13:52:54 raspberrypi kernel: [0.00] Memory: 936304K/966656K 
available (7168K kernel code, 486K rwdata, 2012K rodata, 1024K init, 770K bss, 
22160K reserved, 8192K cma-reserved)
Feb 12 13:52:54 raspberrypi kernel: [0.00] Virtual kernel memory layout:
Feb 12 13:52:54 raspberrypi kernel: [0.00] vector  : 0x - 
0x1000   (   4 kB)
Feb 12 13:52:54 raspberrypi kernel: [0.00] fixmap  : 0xffc0 - 
0xfff0   (3072 kB)
Feb 12 13:52:54 raspberrypi kernel: [0.00] vmalloc : 0xbb80 - 
0xff80   (1088 MB)
Feb 12 13:52:54 raspberrypi kernel: [0.00] lowmem  : 0x8000 - 
0xbb00   ( 944 MB)
Feb 12 13:52:54 raspberrypi kernel: [0.00] modules : 0x7f00 - 
0x8000   (  16 MB)
Feb 12 13:52:54 raspberrypi kernel: [0.00]   .text : 0x80008000 - 
0x8080   (8160 kB)
Feb 12 13:52:54 raspberrypi kernel: [0.00]   .init : 0x80b0 - 
0x80c0   (1024 kB)
Feb 12 13:52:54 raspberrypi kernel: [0.00]   .data : 0x80c0 - 
0x80c79834   ( 487 kB)
Feb 12 13:52:54 raspberrypi kernel: [0.00].bss : 0x80c7b000 - 
0x80d3b964   ( 771 kB)
Feb 12 13:52:54 raspberrypi kernel: [0.00] SLUB: HWalign=64, Order=0-3, 
MinObjects=0, CPUs=4, Nodes=1
Feb 12 13:52:54 raspberrypi kernel: [0.00] Hierarchical RCU 
implementation.
Feb 12 13:52:54 raspberrypi kernel: [0.00]  Build-time adjustment 
of leaf fanout to 32.
Feb 12 13:52:54 raspberrypi kernel: [0.00] NR_IRQS:16 nr_irqs:16 16
Feb 12 13:52:54 raspberrypi kernel: [0.00] arm_arch_timer: Architected 
cp15 timer(s) running at 19.20MHz (phys).
Feb 12 13:52:54 raspberrypi kernel: [0.00] clocksource: 
arch_sys_counter: mask: 0xff max_cycles: 0x46d987e47, max_idle_ns: 
440795202767 ns
Feb 12 13:52:54 raspberrypi kernel: [0.07] sched_clock: 56 bits at 
19MHz, resolution