UnboundLocalError: local variable 'reply' referenced before assignment


Everything works fine until error appeard for my 3 Emon bases with only one EmonTH each…
It normally pushs to my custom server a few times and now it is stuck in loop…

2020-06-29 12:01:26,062 INFO     surya-monitoring-server sending:[[1593428485.8013804,10,22.200000000000003,0,36.9,3.2,-69]]&sentat=1593428486
2020-06-29 12:01:36,080 WARNING  surya-monitoring-server surya-monitoring-server couldn't send to server: HTTPConnectionPool(host='', port=80): Max retries exceeded with url: /input/bulk.json?apikey=BLABLABLABLA (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7488bd70>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution'))
2020-06-29 12:01:36,082 WARNING  surya-monitoring-server Exception caught in surya-monitoring-server thread. Traceback (most recent call last):
  File "/opt/openenergymonitor/emonhub/src/", line 32, in wrapper
    return f(*args)
  File "/opt/openenergymonitor/emonhub/src/", line 127, in run
  File "/opt/openenergymonitor/emonhub/src/", line 198, in action
  File "/opt/openenergymonitor/emonhub/src/", line 216, in flush
    if self._process_post(databuffer):
  File "/opt/openenergymonitor/emonhub/src/interfacers/", line 71, in _process_post
    reply = self._send_post(post_url, {'data': data_string, 'sentat': str(sentat)})
  File "/opt/openenergymonitor/emonhub/src/", line 257, in _send_post
    return reply.text

Fir st I though It was a limitation of my custom server which cannot handle some many posted data, but there are really not to many : for each of my base the value sendinterval = 120…

Do you have this kind of experience with emonHub?

I suggest that is your home network or ISP. Try rebooting your router

Can you access from the command line with ping?

1 Like