supla-device na Linux

User avatar
klew
Posts: 9413
Joined: Thu Jun 27, 2019 12:16 pm
Location: Wrocław

Post

kris.gie wrote: Wed Mar 01, 2023 2:07 pm
klew wrote: Wed Mar 01, 2023 1:53 pm
Ale właściwych jednostek (W, kW, kWh) nie uzyskam?
Uzyskasz. W airly jest przykład jak pobierać dane z json, a w readme jest opisane jak konfigurować licznik elektryczny. Trzeba połączyć te dwa opisy :)
Kiedy będzie Supla Offline Party / SOP#2025 ?
kris.gie
Posts: 376
Joined: Thu Apr 28, 2016 4:24 pm
Location: Katowice

Post

No właśnie próbowałem ugryźć ElectricityMeterParsed, bez efektu. Skoro mówisz że da się, to muszę to ogarnąć :D
User avatar
klew
Posts: 9413
Joined: Thu Jun 27, 2019 12:16 pm
Location: Wrocław

Post

kris.gie wrote: Thu Mar 02, 2023 6:37 am No właśnie próbowałem ugryźć ElectricityMeterParsed, bez efektu. Skoro mówisz że da się, to muszę to ogarnąć :D
Tutaj jest przykład użycia ElectricityMeterParsed ze źródłem typu json, ale dla prostej struktury jsona (jeden poziom, bez zagnieżdżeń):
https://github.com/SUPLA/supla-device/b ... ain=1#L311

Tutaj na przykładzie "airly" jest pokazane jak używać "json pointer", aby dobrać się do pola o bardziej złożonej strukturze:
https://github.com/SUPLA/supla-device/b ... e.yaml#L24

Tutaj w readme opisałem najbardziej podstawowe funkcje tego "json pointer":
https://github.com/SUPLA/supla-device/b ... ain=1#L516

Jeśli coś nie będzie działać, to najpierw ustaw logi na verbose i zobacz co się w logach pojawia. Zawsze możesz też wstawić na forum te rzeczy, to pomogę. Tylko daj przykładowy plik json, plik konfiguracyjny yaml (oczywiście bez maila, adresów serwerów itp) oraz załącz log z konsoli.
Kiedy będzie Supla Offline Party / SOP#2025 ?
kris.gie
Posts: 376
Joined: Thu Apr 28, 2016 4:24 pm
Location: Katowice

Post

klew wrote: Thu Mar 02, 2023 8:52 am
Nie ugryzłem tego jednak. Tak wygląda json bez zagnieżdżeń:

Code: Select all

{"inverters":[{"serial":"116173707423","name":"1","data_age":15,"reachable":true,"producing":true,"limit_relative":100,"limit_absolute":1500,"AC":{"0":{"Power":{"v":910.4000244,"u":"W","d":1},"Voltage":{"v":238.3999939,"u":"V","d":1},"Current":{"v":3.819999933,"u":"A","d":2},"Power DC":{"v":958.2999268,"u":"W","d":1},"YieldDay":{"v":2677,"u":"Wh","d":0},"YieldTotal":{"v":1630.845947,"u":"kWh","d":3},"Frequency":{"v":50,"u":"Hz","d":2},"PowerFactor":{"v":1,"u":"","d":3},"ReactivePower":{"v":22.79999924,"u":"var","d":1},"Efficiency":{"v":95.00157166,"u":"%","d":3}}},"DC":{"0":{"name":{"u":""},"Power":{"v":241.1999969,"u":"W","d":1},"Voltage":{"v":41.5,"u":"V","d":1},"Current":{"v":5.820000172,"u":"A","d":2},"YieldDay":{"v":654,"u":"Wh","d":0},"YieldTotal":{"v":405.2160034,"u":"kWh","d":3}},"1":{"name":{"u":""},"Power":{"v":238.8999939,"u":"W","d":1},"Voltage":{"v":41.5,"u":"V","d":1},"Current":{"v":5.760000229,"u":"A","d":2},"YieldDay":{"v":683,"u":"Wh","d":0},"YieldTotal":{"v":411.7680054,"u":"kWh","d":3}},"2":{"name":{"u":""},"Power":{"v":240.6000061,"u":"W","d":1},"Voltage":{"v":41.29999924,"u":"V","d":1},"Current":{"v":5.829999924,"u":"A","d":2},"YieldDay":{"v":657,"u":"Wh","d":0},"YieldTotal":{"v":404.3179932,"u":"kWh","d":3}},"3":{"name":{"u":""},"Power":{"v":237.6000061,"u":"W","d":1},"Voltage":{"v":41.29999924,"u":"V","d":1},"Current":{"v":5.760000229,"u":"A","d":2},"YieldDay":{"v":683,"u":"Wh","d":0},"YieldTotal":{"v":409.5440063,"u":"kWh","d":3}}},"INV":{"0":{"Temperature":{"v":39.20000076,"u":"°C","d":1}}},"events":0},{"serial":"116173708896","name":"2","data_age":9,"reachable":true,"producing":true,"limit_relative":100,"limit_absolute":1500,"AC":{"0":{"Power":{"v":843.5,"u":"W","d":1},"Voltage":{"v":237.6999969,"u":"V","d":1},"Current":{"v":3.549999952,"u":"A","d":2},"Power DC":{"v":888,"u":"W","d":1},"YieldDay":{"v":2369,"u":"Wh","d":0},"YieldTotal":{"v":1507.158936,"u":"kWh","d":3},"Frequency":{"v":49.99000168,"u":"Hz","d":2},"PowerFactor":{"v":1,"u":"","d":3},"ReactivePower":{"v":22.70000076,"u":"var","d":1},"Efficiency":{"v":94.98873901,"u":"%","d":3}}},"DC":{"0":{"name":{"u":""},"Power":{"v":245.5,"u":"W","d":1},"Voltage":{"v":41.79999924,"u":"V","d":1},"Current":{"v":5.880000114,"u":"A","d":2},"YieldDay":{"v":617,"u":"Wh","d":0},"YieldTotal":{"v":416.2319946,"u":"kWh","d":3}},"1":{"name":{"u":""},"Power":{"v":239.6000061,"u":"W","d":1},"Voltage":{"v":41.79999924,"u":"V","d":1},"Current":{"v":5.739999771,"u":"A","d":2},"YieldDay":{"v":670,"u":"Wh","d":0},"YieldTotal":{"v":412.8049927,"u":"kWh","d":3}},"2":{"name":{"u":""},"Power":{"v":230.5,"u":"W","d":1},"Voltage":{"v":38.5,"u":"V","d":1},"Current":{"v":5.989999771,"u":"A","d":2},"YieldDay":{"v":587,"u":"Wh","d":0},"YieldTotal":{"v":387.1740112,"u":"kWh","d":3}},"3":{"name":{"u":""},"Power":{"v":172.3999939,"u":"W","d":1},"Voltage":{"v":38.5,"u":"V","d":1},"Current":{"v":4.489999771,"u":"A","d":2},"YieldDay":{"v":495,"u":"Wh","d":0},"YieldTotal":{"v":290.947998,"u":"kWh","d":3}}},"INV":{"0":{"Temperature":{"v":35.29999924,"u":"°C","d":1}}},"events":15}],"total":{"Power":{"v":1753.900024,"u":"W","d":1},"YieldDay":{"v":5046,"u":"Wh","d":0},"YieldTotal":{"v":3138.004883,"u":"kWh","d":2}},"hints":{"time_sync":false,"radio_problem":false,"default_password":false}}
Yaml:

Code: Select all

# Example supla-device config file for Linux device
# https://github.com/SUPLA/supla-device

name: supla-device
#log_level: debug
log_level: verbose
state_files_path: "/var/lib/supla-device"
security_level: 2 # disable certyficate verification

supla:
  server: svrX.supla.org
  mail: 

channels:

  - type: ThermometerParsed # Temperatura Raspberry
    name: Temperatura Raspberry
    temperature: 0
    multiplier: 1
    parser:
      type: Simple
      refresh_time_ms: 5000
    source:
      name: s1
      type: File
      file: /home/pi/supla-filesensors/raspi-temp.txt
      expiration_time_sec: 900

  - type: ThermometerParsed # karta Raspberry
    name: karta Raspberry
    temperature: 0
    multiplier: 1
    parser:
      type: Simple
      refresh_time_ms: 5000
    source:
      name: s1
      type: File
      file: /home/pi/supla-filesensors/storage.txt
      expiration_time_sec: 900

  - type: ThermHygroMeterParsed
    name: kuchnia
    source:
      type: File
  # use file "temp_humi.txt" from current folder
      file: "/home/pi/MiTemperature2/.txt"
    parser:
      type: Simple
      refresh_time_ms: 5000
  # temperature is read from first line of txt file
    temperature: 0
  # humidity is read from second line of txt file
    humidity: 1
    multiplier_temp: 1
    multiplier_humi: 1
    battery_level: 2

  - type: ThermHygroMeterParsed
    name: łazienka
    source:
      type: File
  # use file "temp_humi.txt" from current folder
      file: "/home/pi/MiTemperature2/.txt"
    parser:
      type: Simple
      refresh_time_ms: 5000
  # temperature is read from first line of txt file
    temperature: 0
  # humidity is read from second line of txt file
    humidity: 1
    multiplier_temp: 1
    multiplier_humi: 1
    battery_level: 2

  - type: ThermHygroMeterParsed
    name: salon
    source:
      type: File
  # use file "temp_humi.txt" from current folder
      file: "/home/pi/MiTemperature2/.txt"
    parser:
      type: Simple
      refresh_time_ms: 5000
  # temperature is read from first line of txt file
    temperature: 0
  # humidity is read from second line of txt file
    humidity: 1
    multiplier_temp: 1
    multiplier_humi: 1
    battery_level: 2

  - type: ThermHygroMeterParsed
    name: sypialnia
    source:
      type: File
  # use file "temp_humi.txt" from current folder
      file: "/home/pi/MiTemperature2/.txt"
    parser:
      type: Simple
      refresh_time_ms: 5000
  # temperature is read from first line of txt file
    temperature: 0
  # humidity is read from second line of txt file
    humidity: 1
    multiplier_temp: 1
    multiplier_humi: 1
    battery_level: 2

  - type: ThermHygroMeterParsed
    name: przedpokój
    source:
      type: File
  # use file "temp_humi.txt" from current folder
      file: "/home/pi/MiTemperature2/.txt"
    parser:
      type: Simple
      refresh_time_ms: 5000
  # temperature is read from first line of txt file
    temperature: 0
  # humidity is read from second line of txt file
    humidity: 1
    multiplier_temp: 1
    multiplier_humi: 1
    battery_level: 2

  - type: ElectricityMeterParsed # hoymiles
    parser:
      type: Json
    source:
      type: File
      file: "/home/pi/supla-filesensors/hoymiles.json"
    phase_1:
      - voltage: x.inverters[0].AC.0.Voltage.v
      - rvr_act_energy: x.total.YieldTotal.v
        multiplier: 1000
      - rvr_power_active: x.total.Power.v
        multiplier: 1000
Z konsoli wychodzi to:

Code: Select all

VERBOSE[1677757005.877745] Source: {"inverters":[{"serial":"116173707423","name":"1","data_age":1,"reachable":true,"producing":false,"limit_relative":100,"limit_absolute":1500,"AC":{"0":{"Power":{"v":0,"u":"W","d":1},"Voltage":{"v":0,"u":"V","d":1},"Current":{"v":0,"u":"A","d":2},"Power DC":{"v":0,"u":"W","d":1},"YieldDay":{"v":0,"u":"Wh","d":0},"YieldTotal":{"v":0,"u":"kWh","d":3},"Frequency":{"v":0,"u":"Hz","d":2},"PowerFactor":{"v":0,"u":"","d":3},"ReactivePower":{"v":0,"u":"var","d":1},"Efficiency":{"v":0,"u":"%","d":3}}},"DC":{"0":{"name":{"u":""},"Power":{"v":0,"u":"W","d":1},"Voltage":{"v":2886.399902,"u":"V","d":1},"Current":{"v":0,"u":"A","d":2},"YieldDay":{"v":0,"u":"Wh","d":0},"YieldTotal":{"v":0,"u":"kWh","d":3}},"1":{"name":{"u":""},"Power":{"v":0,"u":"W","d":1},"Voltage":{"v":2886.399902,"u":"V","d":1},"Current":{"v":0,"u":"A","d":2},"YieldDay":{"v":0,"u":"Wh","d":0},"YieldTotal":{"v":0,"u":"kWh","d":3}},"2":{"name":{"u":""},"Power":{"v":0,"u":"W","d":1},"Voltage":{"v":0,"u":"V","d":1},"Current":{"v":0,"u":"A","d":2},"YieldDay":{"v":0,"u":"Wh","d":0},"YieldTotal":{"v":0,"u":"kWh","d":3}},"3":{"name":{"u":""},"Power":{"v":0,"u":"W","d":1},"Voltage":{"v":0,"u":"V","d":1},"Current":{"v":0,"u":"A","d":2},"YieldDay":{"v":0,"u":"Wh","d":0},"YieldTotal":{"v":0,"u":"kWh","d":3}}},"INV":{"0":{"Temperature":{"v":0,"u":"°C","d":1}}},"events":0},{"serial":"116173708896","name":"2","data_age":8,"reachable":true,"producing":true,"limit_relative":100,"limit_absolute":1500,"AC":{"0":{"Power":{"v":859.4000244,"u":"W","d":1},"Voltage":{"v":237.6999969,"u":"V","d":1},"Current":{"v":3.619999886,"u":"A","d":2},"Power DC":{"v":904.6999512,"u":"W","d":1},"YieldDay":{"v":2541,"u":"Wh","d":0},"YieldTotal":{"v":1507.330933,"u":"kWh","d":3},"Frequency":{"v":50,"u":"Hz","d":2},"PowerFactor":{"v":1,"u":"","d":3},"ReactivePower":{"v":22.70000076,"u":"var","d":1},"Efficiency":{"v":94.99282074,"u":"%","d":3}}},"DC":{"0":{"name":{"u":""},"Power":{"v":250,"u":"W","d":1},"Voltage":{"v":41.5,"u":"V","d":1},"Current":{"v":6.03000021,"u":"A","d":2},"YieldDay":{"v":665,"u":"Wh","d":0},"YieldTotal":{"v":416.2799988,"u":"kWh","d":3}},"1":{"name":{"u":""},"Power":{"v":244,"u":"W","d":1},"Voltage":{"v":41.5,"u":"V","d":1},"Current":{"v":5.889999866,"u":"A","d":2},"YieldDay":{"v":716,"u":"Wh","d":0},"YieldTotal":{"v":412.8510132,"u":"kWh","d":3}},"2":{"name":{"u":""},"Power":{"v":235.6000061,"u":"W","d":1},"Voltage":{"v":38.29999924,"u":"V","d":1},"Current":{"v":6.159999847,"u":"A","d":2},"YieldDay":{"v":632,"u":"Wh","d":0},"YieldTotal":{"v":387.2189941,"u":"kWh","d":3}},"3":{"name":{"u":""},"Power":{"v":175.1000061,"u":"W","d":1},"Voltage":{"v":38.29999924,"u":"V","d":1},"Current":{"v":4.579999924,"u":"A","d":2},"YieldDay":{"v":528,"u":"Wh","d":0},"YieldTotal":{"v":290.9809875,"u":"kWh","d":3}}},"INV":{"0":{"Temperature":{"v":36.59999847,"u":"°C","d":1}}},"events":15}],"total":{"Power":{"v":859.4000244,"u":"W","d":1},"YieldDay":{"v":2541,"u":"Wh","d":0},"YieldTotal":{"v":1507.330933,"u":"kWh","d":2}},"hints":{"time_sync":false,"radio_problem":false,"default_password":false}}

ERR[1677757005.880620] JSON key "x.total.YieldTotal.v" not found
ERR[1677757005.880723] JSON key "x.total.Power.v" not found
ERR[1677757005.880817] JSON key "x.inverters[0].AC.0.Voltage.v" not found
DEBUG[1677757006.235284] Send: [53 55 50 4C 41 10 0A 00 00 00 28 00 00 00 10 00 00 00 4E 8A 00 64 00 00 00 00 D2 96 03 00 00 00 00 00 ]
DEBUG[1677757006.235567] Send: [53 55 50 4C 41 ]
DEBUG[1677757006.317455] Recv: [53 55 50 4C 41 10 03 00 00 00 32 00 00 00 10 00 00 00 4E 8A 00 64 00 00 00 00 3A 80 04 00 00 00 00 00 53 55 50 4C 41 ]
Licznik się dodaje do clouda, ale nic nie pokazuje
User avatar
klew
Posts: 9413
Joined: Thu Jun 27, 2019 12:16 pm
Location: Wrocław

Post

kris.gie wrote: Thu Mar 02, 2023 11:38 am Nie ugryzłem tego jednak. Tak wygląda json bez zagnieżdżeń:
To jest json z "zagnieżdżeniami" :)
kris.gie wrote: Thu Mar 02, 2023 11:38 am

Code: Select all

ERR[1677757005.880620] JSON key "x.total.YieldTotal.v" not found
ERR[1677757005.880723] JSON key "x.total.Power.v" not found
ERR[1677757005.880817] JSON key "x.inverters[0].AC.0.Voltage.v" not found
Licznik się dodaje do clouda, ale nic nie pokazuje
Przepraszam, pomieszałem "json path" z "json pointer" :oops:
Także tamten link do "path finder" jest błędny.

U Ciebie napięcie jest pod:

Code: Select all

voltage: "/inverters/0/AC/0/Voltage/v"
I analogicznie dla pozostałych parametrów.
Kiedy będzie Supla Offline Party / SOP#2025 ?
kris.gie
Posts: 376
Joined: Thu Apr 28, 2016 4:24 pm
Location: Katowice

Post

klew wrote: Thu Mar 02, 2023 1:07 pm
kris.gie wrote: Thu Mar 02, 2023 11:38 am Nie ugryzłem tego jednak. Tak wygląda json bez zagnieżdżeń:
To jest json z "zagnieżdżeniami" :)
Ja jestem cienki w tym temacie ;). Zaczęło coś pokazywać, dzięki!!!. Ale:
Napięcie OK
Energia czynna zwrócona OK
Moc czynna z minusem, bez informacji zwrócona, czy tak ma być?
User avatar
klew
Posts: 9413
Joined: Thu Jun 27, 2019 12:16 pm
Location: Wrocław

Post

kris.gie wrote: Thu Mar 02, 2023 1:45 pm
klew wrote: Thu Mar 02, 2023 1:07 pm
kris.gie wrote: Thu Mar 02, 2023 11:38 am Nie ugryzłem tego jednak. Tak wygląda json bez zagnieżdżeń:
To jest json z "zagnieżdżeniami" :)
Ja jestem cienki w tym temacie ;). Zaczęło coś pokazywać, dzięki!!!. Ale:
Napięcie OK
Energia czynna zwrócona OK
Moc czynna z minusem, bez informacji zwrócona, czy tak ma być?
To zależy od tego jakie dane są w json i jak je chcesz prezentować.

Ja u siebie falownik pokazuję na plusie i jako energią pobraną.
Tutaj niestety ani "pobrana", ani "zwrócona" nie pasuje ;).
Kiedy będzie Supla Offline Party / SOP#2025 ?
kris.gie
Posts: 376
Joined: Thu Apr 28, 2016 4:24 pm
Location: Katowice

Post

klew wrote: Thu Mar 02, 2023 2:13 pm
Wszystko jasne, bardzo dziękuję za pomoc!!! :)
User avatar
shimano73
Posts: 2014
Joined: Sun Feb 28, 2016 12:27 pm
Location: Orzesze

Post

Takie pytanie , mam zainstalowany supla-device for linux na moim wyse i działa super, on zbiera dane ze stacji pogodowej .
Przedwczoraj dane przestały się pokazywać w aplikacji. Sprawdziłem aktualne dane i pliki z których korzysta supla-device były aktualne , Supla-device też działała bo mam ustawiony skrypt {{not state(wyse).connected}} co 10 min daje powiadomienie a nie dawał . Zresetowałem terminal i zaczęło działać poprawnie, dane pojawiły się w aplikacji,
Jak sprawdzić następnym razem w czym problem, które logi sprawdzić. Zauważyłem to że nie działa dopiero gdy przestały się przymykać rolety gdy jest zbyt gorąco na zewnątrz a warunki są powiązane ze stacja pogodową.
W elektronice jak nie wiadomo o co chodzi to zwykle chodzi o zasilanie

Wezmę udział w Supla Offline Party 2024 :)
User avatar
klew
Posts: 9413
Joined: Thu Jun 27, 2019 12:16 pm
Location: Wrocław

Post

shimano73 wrote: Fri Aug 11, 2023 7:08 pm Takie pytanie , mam zainstalowany supla-device for linux na moim wyse i działa super, on zbiera dane ze stacji pogodowej .
Przedwczoraj dane przestały się pokazywać w aplikacji. Sprawdziłem aktualne dane i pliki z których korzysta supla-device były aktualne , Supla-device też działała bo mam ustawiony skrypt {{not state(wyse).connected}} co 10 min daje powiadomienie a nie dawał . Zresetowałem terminal i zaczęło działać poprawnie, dane pojawiły się w aplikacji,
Jak sprawdzić następnym razem w czym problem, które logi sprawdzić. Zauważyłem to że nie działa dopiero gdy przestały się przymykać rolety gdy jest zbyt gorąco na zewnątrz a warunki są powiązane ze stacja pogodową.
Zerknij do /var/log/syslog (lub jakiejś starszej kopii tego pliku).Poszukaj logów z supla-device. Powinieneś tam widzieć gdzieś start aplikacji po tym resecie. Następnie poszukaj kilku ostatnich logów sprzed tego startu.

Jak będzie niewiele, to możesz zmienić poziom logowania ustawiając

Code: Select all

log_level: debug
np. pod "name" urządzenie w yaml - to włączy dodatkowe logi i gdyby coś się ponownie stało, to będzie jakiś ślad.
Kiedy będzie Supla Offline Party / SOP#2025 ?

Return to “supla-dev”