Help debugging alarm.py

33 views
Skip to first unread message

Brent Phillips

unread,
Feb 13, 2017, 5:04:55 PM2/13/17
to weewx-user
Hi trying to test Alarm.py (version = 3.6.2)

I cannot seem to get this running.. it does not like that the "engine" is set to None on line 209 in alarm.py, how can I get this working?

>engine = None
alarm = MyAlarm(engine, config_dict)

Here is the traceback:

root@raspberrypi_weather:/home/weewx/bin/user# python alarm.py ../../weewx.conf 

Traceback (most recent call last):

  File "alarm.py", line 210, in <module>

    alarm = MyAlarm(engine, config_dict)

  File "alarm.py", line 93, in __init__

    self.bind(weewx.NEW_ARCHIVE_RECORD, self.newArchiveRecord)    # NOTE 1

  File "/home/weewx/bin/weewx/engine.py", line 279, in bind

    self.engine.bind(event_type, callback)

AttributeError: 'NoneType' object has no attribute 'bind'

Thomas Keffer

unread,
Feb 13, 2017, 9:25:20 PM2/13/17
to weewx-user
The "alarm" example is intended to be run as a service within weewx. The assignment to "None" only happens if you try to run alarm as a standalone program.

Follow the instructions at the top of the file alarm.py. It will cause weewx to load it and run it as a service.

-tk

--
You received this message because you are subscribed to the Google Groups "weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to weewx-user+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Brent Phillips

unread,
Feb 13, 2017, 9:35:38 PM2/13/17
to weewx...@googlegroups.com
Thanks… it’s running ok as a service, but would like to do a bit more debugging… It seemed near the bottom of the module there are some instructions on running stand alone for testing.  But if not possible, then will ignore that bit.  

if __name__ == '__main__':
    """This section is used for testing the code. “”"



You received this message because you are subscribed to a topic in the Google Groups "weewx-user" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/weewx-user/ABc64bFdxh0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to weewx-user+...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages