Supla<->MQTT - Instalacja

Beku
Posts: 453
Joined: Tue Nov 06, 2018 1:49 pm

Post

Poniżej opisuję instalację i podstawową konfigurację klienta MQTT dla Supli. Przykłady wykorzystania można znaleźć tu: viewtopic.php?f=24&t=3809 oraz tu: viewtopic.php?f=9&t=5462. Oczywiście to tylko nieliczne przykłady zastosowania MQTT, mniej lub bardziej zaawansowani użytkownicy na pewno znajdą inne zastosowanie dla tego klienta.

Klient wymaga zainstalowanego wcześniej brokera MQTT oraz instancji Supli, nie ma znaczenia czy będzie to instancja własna czy ta w chmurze. Sam klient jednak musi być uruchomiony we własnej infrastrukturze np. na RPi (RPi 4 tested & approved ;) ).

Instalacja

Opis instalacji:

https://github.com/SUPLA/supla-core/t ... t-client

Jeśli po zalogowaniu do MQTT Explorer'a nie widać stanów kanałów Supli --> pisz w tym wątku!

Jeśli widać -> instalacja została zakończona.
User avatar
michael
Posts: 1311
Joined: Wed Nov 09, 2016 8:00 am
Location: Wojkowice

Post

A można prosić o skompilowany supla-mqtt-client dla armv7 :?:
Chciałem go wdrożyć na QNAPie, ale kompilacja w jego środowisku pozostawia wiele do życzenia :lol:
:mrgreen: :mrgreen: :mrgreen:
User avatar
pzygmunt
Posts: 19231
Joined: Tue Jan 19, 2016 9:26 am
Location: Paczków

Post

Może jakaś wersja dokerowa ?
Beku
Posts: 453
Joined: Tue Nov 06, 2018 1:49 pm

Post

michael wrote: Fri Dec 06, 2019 11:40 am A można prosić o skompilowany supla-mqtt-client dla armv7 :?:
Chciałem go wdrożyć na QNAPie, ale kompilacja w jego środowisku pozostawia wiele do życzenia :lol:
Wolisz dockera czy wersję skompilowaną?. W przypadku tej drugiej mam RPi 2 to chyba jest na armv7. Ale czy zatrybi ...
User avatar
michael
Posts: 1311
Joined: Wed Nov 09, 2016 8:00 am
Location: Wojkowice

Post

Póki co chcę przetestować rozwiązanie więc szukam jakiegokolwiek działającego ;]
Jak skompilowane dla armv7 to powinno śmigać
:mrgreen: :mrgreen: :mrgreen:
User avatar
pzygmunt
Posts: 19231
Joined: Tue Jan 19, 2016 9:26 am
Location: Paczków

Post

Możesz samodzielnie sobie skompilować.

Code: Select all

git clone https://github.com/SUPLA/supla-core
cd supla-core
git checkout mqtt-experimental
cd supla-mqtt-client/Release
make all
User avatar
michael
Posts: 1311
Joined: Wed Nov 09, 2016 8:00 am
Location: Wojkowice

Post

pzygmunt wrote: Fri Dec 06, 2019 12:38 pm Możesz samodzielnie sobie skompilować.
Chciałem, ale sypie błędami :?
:mrgreen: :mrgreen: :mrgreen:
User avatar
pzygmunt
Posts: 19231
Joined: Tue Jan 19, 2016 9:26 am
Location: Paczków

Post

Jakimi ?
User avatar
michael
Posts: 1311
Joined: Wed Nov 09, 2016 8:00 am
Location: Wojkowice

Post

Na QNAPie:

Code: Select all

../src/supla-client-lib/supla-socket.c:42:10: fatal error: openssl/err.h: No such file or directory
 #include <openssl/err.h>
          ^~~~~~~~~~~~~~~
compilation terminated.
make: *** [src/supla-client-lib/subdir.mk:60: src/supla-client-lib/supla-socket.o] Error 1
Na malinie to już w ogóle wszystko się sypie (ale tutaj raczej problem z systemem, który trochę "kuleje"):

Code: Select all

../src/yaml/yaml.cpp:1864:36: error: expected ‘;’ before ‘it’
       for (auto it = node.Begin(); it != node.End(); it++) {
                                    ^
../src/yaml/yaml.cpp:1864:36: error: ‘it’ was not declared in this scope
../src/yaml/yaml.cpp:1952:12: warning: ‘auto’ changes meaning in C++11; please remove it [-Wc++0x-compat]
       for (auto it = lines.begin(); it != lines.end(); it++) {
            ^
../src/yaml/yaml.cpp:1952:17: error: ‘it’ does not name a type
       for (auto it = lines.begin(); it != lines.end(); it++) {
                 ^
../src/yaml/yaml.cpp:1952:37: error: expected ‘;’ before ‘it’
       for (auto it = lines.begin(); it != lines.end(); it++) {
                                     ^
../src/yaml/yaml.cpp:1952:37: error: ‘it’ was not declared in this scope
../src/yaml/yaml.cpp: In function ‘std::string Yaml::ExceptionMessage(const string&, Yaml::ReaderLine&)’:
../src/yaml/yaml.cpp:1980:44: error: ‘to_string’ is not a member of ‘std’
   return message + std::string(" Line ") + std::to_string(line.No) +
                                            ^
../src/yaml/yaml.cpp: In function ‘std::string Yaml::ExceptionMessage(const string&, Yaml::ReaderLine&, size_t)’:
../src/yaml/yaml.cpp:1986:44: error: ‘to_string’ is not a member of ‘std’
   return message + std::string(" Line ") + std::to_string(line.No) +
                                            ^
../src/yaml/yaml.cpp:1987:36: error: ‘to_string’ is not a member of ‘std’
          std::string(" column ") + std::to_string(errorPos + 1) +
                                    ^
../src/yaml/yaml.cpp: In function ‘std::string Yaml::ExceptionMessage(const string&, size_t, size_t)’:
../src/yaml/yaml.cpp:1993:44: error: ‘to_string’ is not a member of ‘std’
   return message + std::string(" Line ") + std::to_string(errorLine) +
                                            ^
../src/yaml/yaml.cpp:1994:36: error: ‘to_string’ is not a member of ‘std’
          std::string(" column ") + std::to_string(errorPos);
                                    ^
../src/yaml/yaml.cpp: In function ‘std::string Yaml::ExceptionMessage(const string&, size_t, const string&)’:
../src/yaml/yaml.cpp:1999:44: error: ‘to_string’ is not a member of ‘std’
   return message + std::string(" Line ") + std::to_string(errorLine) +
                                            ^
../src/yaml/yaml.cpp: In function ‘size_t Yaml::FindNotCited(const string&, char, size_t&)’:
../src/yaml/yaml.cpp:2049:39: error: ‘>>’ should be ‘> >’ within a nested template argument list
   std::vector<std::pair<size_t, size_t>> quotes;
                                       ^
../src/yaml/yaml.cpp:2054:22: warning: extended initializer lists only available with -std=c++11 or -std=gnu++11
     quotes.push_back({quoteStart, quoteEnd});
                      ^
../src/yaml/yaml.cpp:2054:44: warning: extended initializer lists only available with -std=c++11 or -std=gnu++11
     quotes.push_back({quoteStart, quoteEnd});
                                            ^
../src/yaml/yaml.cpp:2067:49: error: in C++98 ‘currentQuote’ must be initialized by constructor, not by ‘{...}’
   std::pair<size_t, size_t> currentQuote = {0, 0};
                                                 ^
../src/yaml/yaml.cpp: In function ‘void Yaml::CopyNode(const Yaml::Node&, Yaml::Node&)’:
../src/yaml/yaml.cpp:2157:12: warning: ‘auto’ changes meaning in C++11; please remove it [-Wc++0x-compat]
       for (auto it = from.Begin(); it != from.End(); it++) {
            ^
../src/yaml/yaml.cpp:2157:17: error: ‘it’ does not name a type
       for (auto it = from.Begin(); it != from.End(); it++) {
                 ^
../src/yaml/yaml.cpp:2157:36: error: expected ‘;’ before ‘it’
       for (auto it = from.Begin(); it != from.End(); it++) {
                                    ^
../src/yaml/yaml.cpp:2157:36: error: ‘it’ was not declared in this scope
../src/yaml/yaml.cpp:2164:12: warning: ‘auto’ changes meaning in C++11; please remove it [-Wc++0x-compat]
       for (auto it = from.Begin(); it != from.End(); it++) {
            ^
../src/yaml/yaml.cpp:2164:17: error: ‘it’ does not name a type
       for (auto it = from.Begin(); it != from.End(); it++) {
                 ^
../src/yaml/yaml.cpp:2164:36: error: expected ‘;’ before ‘it’
       for (auto it = from.Begin(); it != from.End(); it++) {
                                    ^
../src/yaml/yaml.cpp:2164:36: error: ‘it’ was not declared in this scope
../src/yaml/yaml.cpp: In function ‘void Yaml::AddEscapeTokens(std::string&, const string&)’:
../src/yaml/yaml.cpp:2183:8: warning: ‘auto’ changes meaning in C++11; please remove it [-Wc++0x-compat]
   for (auto it = tokens.begin(); it != tokens.end(); it++) {
        ^
../src/yaml/yaml.cpp:2183:13: error: ‘it’ does not name a type
   for (auto it = tokens.begin(); it != tokens.end(); it++) {
             ^
../src/yaml/yaml.cpp:2183:34: error: expected ‘;’ before ‘it’
   for (auto it = tokens.begin(); it != tokens.end(); it++) {
                                  ^
../src/yaml/yaml.cpp:2183:34: error: ‘it’ was not declared in this scope
../src/yaml/yaml.cpp: In member function ‘const char* Yaml::Exception::Message() const’:
../src/yaml/yaml.cpp:96:57: warning: control reaches end of non-void function [-Wreturn-type]
 const char *Exception::Message() const { return what(); }
                                                         ^
../src/yaml/yaml.cpp: In member function ‘virtual Yaml::Node* Yaml::ScalarImp::Insert(size_t)’:
../src/yaml/yaml.cpp:276:62: warning: control reaches end of non-void function [-Wreturn-type]
   virtual Node *Insert(const size_t index) { return nullptr; }
                                                              ^
../src/yaml/yaml.cpp: In member function ‘virtual Yaml::Node* Yaml::MapImp::Insert(size_t)’:
../src/yaml/yaml.cpp:239:62: warning: control reaches end of non-void function [-Wreturn-type]
   virtual Node *Insert(const size_t index) { return nullptr; }
                                                              ^
../src/yaml/yaml.cpp: In member function ‘virtual Yaml::Node* Yaml::ScalarImp::PushFront()’:
../src/yaml/yaml.cpp:278:47: warning: control reaches end of non-void function [-Wreturn-type]
   virtual Node *PushFront() { return nullptr; }
                                               ^
../src/yaml/yaml.cpp: In member function ‘virtual Yaml::Node* Yaml::MapImp::PushFront()’:
../src/yaml/yaml.cpp:241:47: warning: control reaches end of non-void function [-Wreturn-type]
   virtual Node *PushFront() { return nullptr; }
                                               ^
../src/yaml/yaml.cpp: In member function ‘virtual Yaml::Node* Yaml::ScalarImp::PushBack()’:
../src/yaml/yaml.cpp:280:46: warning: control reaches end of non-void function [-Wreturn-type]
   virtual Node *PushBack() { return nullptr; }
                                              ^
../src/yaml/yaml.cpp: In member function ‘virtual Yaml::Node* Yaml::MapImp::PushBack()’:
../src/yaml/yaml.cpp:243:46: warning: control reaches end of non-void function [-Wreturn-type]
   virtual Node *PushBack() { return nullptr; }
                                              ^
../src/yaml/yaml.cpp: In member function ‘virtual Yaml::Node* Yaml::ScalarImp::GetNode(size_t)’:
../src/yaml/yaml.cpp:272:63: warning: control reaches end of non-void function [-Wreturn-type]
   virtual Node *GetNode(const size_t index) { return nullptr; }
                                                               ^
../src/yaml/yaml.cpp: In member function ‘virtual Yaml::Node* Yaml::MapImp::GetNode(size_t)’:
../src/yaml/yaml.cpp:227:63: warning: control reaches end of non-void function [-Wreturn-type]
   virtual Node *GetNode(const size_t index) { return nullptr; }
                                                               ^
../src/yaml/yaml.cpp: In member function ‘virtual Yaml::Node* Yaml::SequenceImp::GetNode(size_t)’:
../src/yaml/yaml.cpp:143:3: warning: control reaches end of non-void function [-Wreturn-type]
   }
   ^
../src/yaml/yaml.cpp: In member function ‘virtual Yaml::Node* Yaml::ScalarImp::GetNode(const string&)’:
../src/yaml/yaml.cpp:274:67: warning: control reaches end of non-void function [-Wreturn-type]
   virtual Node *GetNode(const std::string &key) { return nullptr; }
                                                                   ^
../src/yaml/yaml.cpp: In member function ‘virtual Yaml::Node* Yaml::MapImp::GetNode(const string&)’:
../src/yaml/yaml.cpp:237:3: warning: control reaches end of non-void function [-Wreturn-type]
   }
   ^
../src/yaml/yaml.cpp: In member function ‘virtual Yaml::Node* Yaml::SequenceImp::GetNode(const string&)’:
../src/yaml/yaml.cpp:145:67: warning: control reaches end of non-void function [-Wreturn-type]
   virtual Node *GetNode(const std::string &key) { return nullptr; }
                                                                   ^
../src/yaml/yaml.cpp: In function ‘std::string Yaml::ExceptionMessage(const string&, size_t, size_t)’:
../src/yaml/yaml.cpp:1995:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
../src/yaml/yaml.cpp: In function ‘std::string Yaml::ExceptionMessage(const string&, Yaml::ReaderLine&)’:
../src/yaml/yaml.cpp:1982:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
src/yaml/subdir.mk:18: polecenia dla obiektu 'src/yaml/yaml.o' nie powiodły się
make: *** [src/yaml/yaml.o] Błąd 1
:mrgreen: :mrgreen: :mrgreen:
User avatar
pzygmunt
Posts: 19231
Joined: Tue Jan 19, 2016 9:26 am
Location: Paczków

Post

Na pewno apt-get install libssl-dev
ale jeszcze jest jakiś problem

Return to “MQTT”