XBeeInternetGateway / XIG

XBee Internet Gateway for the Digi ConnectPort and Digi XBee
11 stars 12 forks source link

IO Sample not sending GET requests #48

Open opauwels opened 7 years ago

opauwels commented 7 years ago

Hi,

We have a temperature sensor hooked up / linked to a wifi gateway. In the gateway's python logs i can see the XIG plugin working as it should, it detects IO samples as you'll see in the log printout below, however, it does not seem to be triggering any HTTP GET requests.

Our xig_config.py `class XigConfig(object):

## Session Types

# Enable/disable session types; disable sessions by commenting
# them out.  Disabling sessions may be advantageous if you
# find you are running out of memory on your ConnectPort.
#
# The "xig" session is always available.  It is required by
# the system.
#
session_types = [
    "http",               # HTTP (fetch web pages)
    "idigi_data",         # iDigi Data support (upload XBee data->iDigi)
    "idigi_rci",          # iDigi RCI (send data from iDigi to an XBee)
    #"udp",               # UDP URL destination support
    "io_sample",          # XBee I/O Samples to HTTP
    #"osc",               # Send data to Open Sound Control server
]

## HTTP

# No configuration options at this time.

## iDigi Data
idigi_data_max_rate_sec = 30    # maximum upload rate to iDigi in seconds
idigi_data_max_q_len = 512      # maximum number of samples to save before uploading
idigi_data_no_errors = False    # maximum number of samples to save before uploading

## iDigi RCI

# No configuration options at this time.

## UDP URL destination support

# No configuration options at this time

## XBee I/O Sample HTTP Indications

# When an I/O sample is received for an XBee address below,
# An HTTP GET will be called on the given URL with the
# following string added to the end:
#
# ?addr=[00:13:A2:00:4F:38:1B:7E]!&AD0=710&AD1=1...
io_sample_destination_url = "http://192.168.1.215/oka.php"
#
# You can also set io_sample_destination_url to a dictionary.  If you
# use a dictionary there must be a key-value pair with a key named
# "default" and a default.  The other keys may be XBee 64-bit hardware
# addresses in the ConnectPort format "[00:11:22:33:44:55:66:77]!"
# mapping to specific URLs.
#
# io_sample_destination_url = {
#     "default": "http://xbee-data.appspot.com/io_sample",
#     "[00:13:a2:00:40:30:ff:07]!": "http://my.home.com/rx_io_data",
#     "[00:13:a2:00:40:4a:b9:e5]!": "http//some.otherplace.com/xbee_receive",
# }

## Open Sound Control

# A list of server strings of the form "server:port" for all OSC data
# to be send to:
osc_targets = [
    # "10.1.1.1:21234
]

## Global Configuration Variables

# You shouldn't need to change anything in this section unless
# you know what you've been doing or you've been instructed to
# do so.

# Should we send the helpfile for all unknown commands or
# simply ignore them?
global_always_send_help = True

# Controls how long must buffers in the system may reach before
# they are trimmed.  This setting also happens to control the
# maximum length of a URL or XIG command.
global_max_buf_size = 1024

# Controls how many sessions are allowed to queue up for a
# single XBee destination.  Normally XBees only request a single
# session at a time but automatic services may queue up several
# session requests, such as the I/O service.
global_max_dest_session_q_len = 8

# How often (in seconds) to call the garbage collector:
global_gc_interval = 60

# Log-levels for various sub systems:
log_level_global = "debug"
log_level_io_kernel = "debug"

# Controls which UDP port number to receive requests
xbee_udp_port = 5649

`

As you can see we've uncommented the IO_Sample session and have set up a io_sample_destination_url (which currently points to a raspberry pi running an apache2 webserver, this url works perfectly fine when visited manually with a webbrowser). However in the apache access logs i don't see any requests coming in from the gateway.

Heres a cutout section from our pyhton.log on the wifi gateway:

Oct 21 21:56:43 local7.info pylog: xig.io_kernel - RECV: 47 bytes from ('[00:13:A2:00:40:F5:F3:DF]!', 232, 49413, 17, 0, 0) ('Time:7928404 Temperature:22.7C Humidity:44.8%\r\n') Oct 21 21:56:43 local7.info pylog: xig.xmit - X-API ZigBee TX Status (id = 170) Oct 21 21:56:43 local7.info pylog: xig.xmit - GOOD: tx_status (id = 170) Oct 21 21:56:43 local7.info pylog: xig.xmit - SEND: to ('[00:13:A2:00:40:F5:F3:DF]!', 232, 49413, 17) (id = 171) Oct 21 21:56:43 local7.info pylog: xig.xmit - X-API ZigBee TX Status (id = 171) Oct 21 21:56:43 local7.info pylog: xig.xmit - GOOD: tx_status (id = 171) Oct 21 21:56:43 local7.info pylog: xig.xmit - SEND: to ('[00:13:A2:00:40:F5:F3:DF]!', 232, 49413, 17) (id = 172) Oct 21 21:56:43 local7.info pylog: xig.xmit - X-API ZigBee TX Status (id = 172) Oct 21 21:56:43 local7.info pylog: xig.xmit - GOOD: tx_status (id = 172) Oct 21 21:56:43 local7.info pylog: xig.xmit - SEND: to ('[00:13:A2:00:40:F5:F3:DF]!', 232, 49413, 17) (id = 173) Oct 21 21:56:43 local7.info pylog: xig.xmit - X-API ZigBee TX Status (id = 173) Oct 21 21:56:43 local7.info pylog: xig.xmit - GOOD: tx_status (id = 173) Oct 21 21:56:43 local7.info pylog: xig.xmit - SEND: to ('[00:13:A2:00:40:F5:F3:DF]!', 232, 49413, 17) (id = 174) Oct 21 21:56:43 local7.info pylog: xig.xmit - X-API ZigBee TX Status (id = 174) Oct 21 21:56:43 local7.info pylog: xig.xmit - GOOD: tx_status (id = 174) Oct 21 21:56:43 local7.info pylog: xig.xmit - SEND: to ('[00:13:A2:00:40:F5:F3:DF]!', 232, 49413, 17) (id = 175) Oct 21 21:56:43 local7.info pylog: xig.xmit - X-API ZigBee TX Status (id = 175) Oct 21 21:56:43 local7.info pylog: xig.xmit - GOOD: tx_status (id = 175) Oct 21 21:56:43 local7.info pylog: xig.xmit - SEND: to ('[00:13:A2:00:40:F5:F3:DF]!', 232, 49413, 17) (id = 176) Oct 21 21:56:44 local7.info pylog: xig.xmit - X-API ZigBee TX Status (id = 176) Oct 21 21:56:44 local7.info pylog: xig.xmit - GOOD: tx_status (id = 176) Oct 21 21:56:44 local7.info pylog: xig.xmit - SEND: to ('[00:13:A2:00:40:F5:F3:DF]!', 232, 49413, 17) (id = 177)

So the xig.io_kernel seems to be receiving the temp. data just fine, it's just not automatically sending any http trigger requests.

Any ideas what this could be?

Thanks

Avocadodude commented 7 years ago

What hardware are you running this (XIG) on? What do your sensor nodes consist of (xbee version and AT, API, Sensor)?

opauwels commented 7 years ago

Hi @Avocadodude , we've got this setup: AT mode, Temperature & Pressure sensor via an arduino with an xbee explorer. (Edit: And of course a DIGI WiFi gateway).

Avocadodude commented 7 years ago

I'll try to reproduce it. I gave up on the IO sample and send the whole string from my sensors (not efficient, but works). I've been meaning to go back and test IO again. I have a Connect port X2 and a xbee gateway I can try it on. Both run Xig fine.

opauwels commented 6 years ago

@Avocadodude Hi, any chance you've had the time to look at the io sampling yet? I'm still not getting any GET requests, as in the logs above, I am getting RECV, X-API, GOOD and SEND logs, but no GET requests are being sent... I've also tried setting the io sample URL as the "device cloud" server URL under the device cloud configuration settings, which actually generates some traffic, however the (web)access logs show the following:

192.168.0.103 - - [26/Nov/2017:15:55:46 +0000] "\x16\x03\x01\x01\"\x01" 400 0 "-" "-"

Instead of something like: 192.168.0.100 - - [26/Nov/2017:15:54:30 +0000] "GET /index.php HTTP/1.1" 200 1831 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_1) AppleWebKit/604.3.5 (KHTML, like Gecko) Version/11.0.1 Safari/604.3.5"

Could this mean I just need to setup an SSL certificate for this traffic to work?