Ecowitt API returning Error

Discussion in 'C-Bus Automation Controllers' started by Ks04, Apr 27, 2024.

  1. Ks04

    Ks04

    Joined:
    Dec 28, 2019
    Messages:
    110
    Likes Received:
    9
    Hi There,

    Bashing my head against this one - I'm trying to get my weather station data from their API endpoint. When doing a GET in the browser I get a response as expected, but through SHAC I'm getting 'Try again'. Can anyone see what is going wrong here?

    API Endpoint: https://api.ecowitt.net/api/v3/device/real_time

    SHAC Code:
    Code:
    -- Get data from the specified endpoint
    function Get()
      local http = require 'ssl.https'
        local json = require('json')
        local ltn12 = require("ltn12")
     
        local result,content,header = http.request {
        url = 'https://api.ecowitt.net/api/v3/device/real_time',
        method = 'GET',
        redirect = true
        }
      log("Result: ".. tostring(result) .. "Content: " .. tostring(content) .."Header: " .. tostring(header))
      return result
    end
     
    Ks04, Apr 27, 2024
    #1
  2. Ks04

    Benla

    Joined:
    Dec 19, 2023
    Messages:
    8
    Likes Received:
    0
    Location:
    nz
    Benla, Apr 27, 2024
    #2
  3. Ks04

    Ks04

    Joined:
    Dec 28, 2019
    Messages:
    110
    Likes Received:
    9
    Ks04, Apr 28, 2024
    #3
  4. Ks04

    Benla

    Joined:
    Dec 19, 2023
    Messages:
    8
    Likes Received:
    0
    Location:
    nz
    Your Code works for me, See attached, Maybe ther is some limit on how many requests can be made?
    upload_2024-4-29_13-5-49.jpeg
     
    Benla, Apr 29, 2024
    #4
  5. Ks04

    Ks04

    Joined:
    Dec 28, 2019
    Messages:
    110
    Likes Received:
    9
    Hmm interesting. Appears my SHAC can't access the internet at all - but local network is fine. Thanks - at least that helped narrow down the issue
     
    Ks04, Apr 29, 2024
    #5
  6. Ks04

    Benla

    Joined:
    Dec 19, 2023
    Messages:
    8
    Likes Received:
    0
    Location:
    nz
    one possible thing to check is the DNS settings, under utilities, system, network etc etc
    If that’s not set then that would do it…
     
    Benla, Apr 29, 2024
    #6
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.