Jump to content

Welcome to Smart Home Forum by FIBARO

Dear Guest,

 

as you can notice parts of Smart Home Forum by FIBARO is not available for you. You have to register in order to view all content and post in our community. Don't worry! Registration is a simple free process that requires minimal information for you to sign up. Become a part of of Smart Home Forum by FIBARO by creating an account.

 

As a member you can:

  •     Start new topics and reply to others
  •     Follow topics and users to get email updates
  •     Get your own profile page and make new friends
  •     Send personal messages
  •     ... and learn a lot about our system!

 

Regards,

Smart Home Forum by FIBARO Team


  • 0

VD reading json data Link bezpośredni w VD


Question

Posted

Posiadam miernik energii firmy ZAMEL z zainstalowaną Supla. Przy wykorzystaniu linku bezpośredniego: 

Please login or register to see this link.

 otrzymuję odpowiedź w formacie HTML z informacją żeby odczytać w formacie JSON trzeba dodać odpowiedni nagłówek. 

Please login or register to see this attachment.

 

 

Kiedy wpisuję jako scenę poniższy skrypt:

 

--[[
%% properties
%% events
%% globals
--]]


local http = net.HTTPClient()
    local url="https://svr24.supla.org/direct/642/VUNZmkZTGJD/read"

    http:request(url, { 
        options = {
          method='GET'
        },
           success =  function (response) fibaro:debug (response.data)  end,
           error  =  function (err) fibaro: debug ("Error:"  .. err)  end
      });

 

otrzymuję niezrozumiały DEBUG:

 

[DEBUG] 15:02:15:
[DEBUG] 15:02:15:
[DEBUG] 15:02:15:
[DEBUG] 15:02:15:
[DEBUG] 15:02:15:
[DEBUG] 15:02:15:
[DEBUG] 15:02:15: content="width=device-width, initial-scale=1">
[DEBUG] 15:02:15:
[DEBUG] 15:02:15: content="#00732C">
[DEBUG] 15:02:15:
[DEBUG] 15:02:15:
[DEBUG] 15:02:15: href="/assets/img/icons/favicon.ico"
[DEBUG] 15:02:15: type="image/x-icon"/>
[DEBUG] 15:02:15:
[DEBUG] 15:02:15: href="/assets/img/icons/favicon.ico"
[DEBUG] 15:02:15: type="image/x-icon"/>
[DEBUG] 15:02:15:
[DEBUG] 15:02:15: type="image/png"
[DEBUG] 15:02:15: href="/assets/img/icons/supla16.png"
[DEBUG] 15:02:15: sizes="16x16">
[DEBUG] 15:02:15:
[DEBUG] 15:02:15: type="image/png"
[DEBUG] 15:02:15: href="/assets/img/icons/supla32.png"
[DEBUG] 15:02:15: sizes="32x32">
[DEBUG] 15:02:15:
[DEBUG] 15:02:15: type="image/png"
[DEBUG] 15:02:15: href="/assets/img/icons/supla96.png"
[DEBUG] 15:02:15: sizes="96x96">
[DEBUG] 15:02:15:
[DEBUG] 15:02:15: type="image/png"
[DEBUG] 15:02:15: href="/assets/img/icons/supla160.png"
[DEBUG] 15:02:15: sizes="160x160">
[DEBUG] 15:02:15:
[DEBUG] 15:02:15: type="image/png"
[DEBUG] 15:02:15: href="/assets/img/icons/supla196.png"
[DEBUG] 15:02:15: sizes="196x196">
[DEBUG] 15:02:15:
[DEBUG] 15:02:15: sizes="57x57"
[DEBUG] 15:02:15: href="/assets/img/icons/supla57.png">
[DEBUG] 15:02:15:
[DEBUG] 15:02:15: sizes="60x60"
[DEBUG] 15:02:15: href="/assets/img/icons/supla60.png">
[DEBUG] 15:02:15:
[DEBUG] 15:02:15: sizes="72x72"
[DEBUG] 15:02:15: href="/assets/img/icons/supla72.png">
[DEBUG] 15:02:15:
[DEBUG] 15:02:15: sizes="76x76"
[DEBUG] 15:02:15: href="/assets/img/icons/supla76.png">
[DEBUG] 15:02:15:
[DEBUG] 15:02:15: sizes="114x114"
[DEBUG] 15:02:15: href="/assets/img/icons/supla114.png">
[DEBUG] 15:02:15:
[DEBUG] 15:02:15: sizes="120x120"
[DEBUG] 15:02:15: href="/assets/img/icons/supla120.png">
[DEBUG] 15:02:15:
[DEBUG] 15:02:15: sizes="144x144"
[DEBUG] 15:02:15: href="/assets/img/icons/supla144.png">
[DEBUG] 15:02:15:
[DEBUG] 15:02:15: sizes="152x152"
[DEBUG] 15:02:15: href="/assets/img/icons/supla152.png">
[DEBUG] 15:02:15:
[DEBUG] 15:02:15:
[DEBUG] 15:02:15:
[DEBUG] 15:02:15:
[DEBUG] 15:02:15:

[DEBUG] 15:02:15:

[DEBUG] 15:02:15:
[DEBUG] 15:02:15:

[DEBUG] 15:02:15:
[DEBUG] 15:02:15:

[DEBUG] 15:02:15:

[DEBUG] 15:02:15: 
[DEBUG] 15:02:15:
[DEBUG] 15:02:15:

[DEBUG] 15:02:15: if it takes too long, check if the JS scripts are loaded correctly
[DEBUG] 15:02:15:


[DEBUG] 15:02:15:

[DEBUG] 15:02:15:
[DEBUG] 15:02:15:
[DEBUG] 15:02:15:
[DEBUG] 15:02:15:
[DEBUG] 15:02:15:
[DEBUG] 15:02:15:

 

Wysyłając ten sam link z aplikacji ARC otrzymuję właściwe dane nawet bez odpowiedniego nagłówka.

 

Please login or register to see this attachment.

 

 

Może ktoś pomoże dodać odpowiedni nagłówek tak żeby otrzymać odpowiednie dane?

 

 

10 answers to this question

Recommended Posts

  • 0
Posted

Please login or register to see this code.

 

 

  • 0
  • Inquirer
  • Posted

    Dzięki, działa. Już mi zwraca w formacie json. 

    • 0
    Posted

    Czy można prosić o całośc kodu do pobrania danych z MEW-01 do fibaro ?

    • 0
    Posted

    witam , ktoś już ogarnął ten miernik MEW-01 w odczycie json w HC2 ?

     

    • 0
    Posted (edited)

    MEW-01 i Home Center 3

     

    Taki kod działa u mnie. Jest to rzecz jasna przykład.

    Jako początkujący szukam informacji w jaki sposób dodać więcej "kafelków" do jednego QA do Dashboardu. Jakieś pomysły? Coś mi się kojarzy "child devices", ale być może ktoś z Was ma gotowy przepis, lub link gdzie o tym poczytać.

     

     

    Please login or register to see this code.

     

    Edited by Enriquez
    • 0
  • Inquirer
  • Posted (edited)

    Dodałem etykiety do Twojego kodu i zmienną do wpisania linku bezpośredniego z SUPLA i wszystkie parametry są widoczne.

     

     

     

    Please login or register to see this attachment.

    Edited by ptekien
    • 0
    Posted

    Witam,

     

    Mam jeden problem. 

     

    Powyższy kod działa bardzo fajnie tylko pytanie dlaczego jeśli urządzenie podłączone do licznika pobiera 4.13958 W Czyli nieco ponad 4W a fibaro zaciąga to jako ponad 4kW. Co trzeba zmienić w kodzie aby fibaro zaciągało prawidłowo.

     

    Pozdrawiam

    • 0
    Posted

    cześć,

    czy mogę prosić o cały kod na HC2?

    • 0
    Posted

    Czy ktoś rozgryzł powód wyświetlania kW zamiast W  w panelu energii HC-3.

    • 0
    Posted

    Cześć, mam pytanie dotyczące odświeżania danych z Supla na HC3, zainstalowałem kod jak powyżej ale u mnie nie działa  automatyczne odświeżanie danych, ktoś wie dlaczego? 

    Join the conversation

    You can post now and register later. If you have an account, sign in now to post with your account.

    Guest
    Answer this question...

    ×   Pasted as rich text.   Paste as plain text instead

      Only 75 emoji are allowed.

    ×   Your link has been automatically embedded.   Display as a link instead

    ×   Your previous content has been restored.   Clear editor

    ×   You cannot paste images directly. Upload or insert images from URL.

    ×
    ×
    • Create New...