Integracja OneMeter...
 
Powiadomienia
Wyczyść wszystko

UWAGAStrona oraz Forum Smart'ny Dom nie będzie dostępne 23 Grudnia 2024 ze względu na przenoszenie serwisu na mocniejszą maszynę.

W tym czasie polecam poświęcenie swojego czasu na pomoc partnerowi w przygotowaniu udanych Świąt 😉

Za niedogodności z góry przepraszam, admin

Kontakt

Pytanie Integracja OneMeter z OH2

10 Wpisów
2 Użytkownicy
0 Reactions
751 Wyświetleń
(@leszekb)
Wpisów: 43
Kontrybutor Donator 2K20
Autor tematu
 

Mam zainstalowany onemeter z bramką z telefonu, działa stabilnie. Chcę zintegrowac to z OH2.

Reguła, która co 15 min uruchamia polecenie curl nie nadpisuje pliku wynikowego (/etc/openhab2/html/onemeter/onemeter-device-data.json). Skrypt uruchamiany z terminala uruchamia sie poprawnie, reguła też nie wyrzuca błędów ale pliku nie odświeża. Co może być nie tak?

----------------

rule "Run onemeter data"
when
 Time cron "0 2/1 * ? * * *"
 then
 executeCommandLine("/etc/openhab2/scripts/onemeter.sh")
 end
-------------------------------
Skrypt onemeter.sh
#!/bin/bash
curl -s -X GET --header 'Authorization:usunięto' 'https://cloud.onemeter.com/api/devices/usunięto' -o /etc/openhab2/html/onemeter/onemeter-device-data.json

-------------------------------

Dodatkowo zastanawiam sie jak skonfigurowac Things, czy wystarczy tylko plik konfiguracyjny w etc/openhab2/things czy cos jeszcze w UI?
 
Dodane : 15/10/2022 11:55 pm
adrian
(@adrian)
Wpisów: 4038
Szefu Admin Zasłużony dla Forum, Patron Strony
 
  • /var/openhab2/log/openhab.log  -   co pokazuje podczas uruchamiania tej reguły?
  • czy użytkownik openhab z linuxie ma uprawnienia do uruchamiania skryptu

Things wystarczy, żeby mieć zrobioną integrację OneMeter - OH no a później w zależności z czego tam korzystasz. Jeśli używasz jakiś BasicUI, czy habPanel to potrzebne będą item's

pzdr.a

 
Dodane : 16/10/2022 8:42 am
(@leszekb)
Wpisów: 43
Kontrybutor Donator 2K20
Autor tematu
 

Cześć,

- Nie ma żadnych błędów podczas uruchomienia reguły

2022-10-16 10:10:49.910 [INFO ] [el.core.internal.ModelRepositoryImpl] - Refreshing model '1meter.rules'
2022-10-16 10:17:00.083 [INFO ] [lipse.smarthome.io.net.exec.ExecUtil] - executed commandLine '/etc/openhab2/scripts/onemeter.sh'

- prawa nadałem ja niżej: chmod +x onemeter.sh

-rwxrwxr-x 1 openhabian openhabian 274 Oct 16 00:36 onemeter.sh

Sprawdziłem też uprawnienia katalogu /etc/openhab2/html/onemeter do którego jest zapisywany plik z chmury (wygląda ok). Sam plik ma prawa tylko do odczytu ale to chyba ok.

drwxrwxr-x+ 2 openhabian openhabian 4096 Oct 14 17:05 onemeter

Things: czy ontegracja oneMeter - OH to prawidłowy plik konfiguracyjny .things i tyle?

 
Dodane : 16/10/2022 9:35 am
adrian
(@adrian)
Wpisów: 4038
Szefu Admin Zasłużony dla Forum, Patron Strony
 

Jeśli ten plik z danymi ma tylko odczyt to nie można go nadpisać, nadaj mu jeszcze uprawnienie zapisu dla użytkownika linux, który go uruchamia.

Integracja: nie wiem trochę jaką masz koncepcję i co potrzebujesz, ale generalnie, z tego co napisałeś

  • masz skrypt co ściąga dane z chmury oneMeter
  • jeśli masz things, który otwiera ten ściągnięty plik i parsuje tego json'a wrzucając wartości w channel (ale nie wiem co tam masz)

to masz zrobioną integrację z OH tzn dane są odczytywane i lądują w kanałach od rzeczy i pewnie jeśli masz PaperUI można podejrzeć ich wartości.

 

 

 
Dodane : 16/10/2022 1:57 pm
(@leszekb)
Wpisów: 43
Kontrybutor Donator 2K20
Autor tematu
 

Super, temat nadpisywania pliku rozwiązany, wielkie dzięki - brakowało uprawnień do zapisu.

Temat things: koncepcje mam jak w Twoim opisie.

Things i items uproszczone poniżej. Widac w logu, że ładują się poprawnie.

2022-10-16 19:07:56.009 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'OneMeter.things'

2022-10-16 19:08:56.019 [INFO ] [el.core.internal.ModelRepositoryImpl] - Refreshing model 'onemeter.items'

2022-10-16 19:08:56.057 [.ItemChannelLinkAddedEvent] - Link 'onemeter_voltage-http:url:onemeter:battery_voltage' has been added.

 onemeter.items

 
Group onemeter "OneMeter" <heating>

/* Beacon */
Number onemeter_voltage "Bateria: napięcie: [%f V]" <voltage> (onemeter){channel="http:url:onemeter:battery_voltage" }
 
OneMeter.Things

Thing http:url:onemeter "OneMeter" [baseURL="http://192.168.2.106:8080/static/onemeter/onemeter-device-data.json", refresh=60] {
   Channels:
        Type number    : battery_voltage                       "Battery Voltage"                       [ stateTransformation="JSONPATH:$.lastReading.OBIS['S_1_1_2']" ]
}
 
 
I kawałek pliku z onemeter
"uiConfig":{"displayProjections":false,"usedTariff":"polish"},"meterPhase":"threePhase"},"lastReading":{"date":"2022-10-16T17:15:00.000Z","OBIS":{"0_2_2":"G11","0_9_1":68422,"0_9_2":"2022-09-30T00:00:00.000Z","1_8_0":26203.29,"1_8_1":26203.29,"1_8_2":0,"2_8_0":14297.44,"2_8_1":14297.44,"2_8_2":0,"5_8_0":224.82,"6_8_0":114.15,"7_8_0":1818.36,"8_8_0":6114.88,"C_1_0":"72410685","S_1_1_6":1565,"S_1_1_7":[3,0],"S_1_1_16":[],"S_1_1_2":2.9469,"S_1_1_9":21,"S_1_1_8":[3,9600],"S_1_1_14":[57,20,209,214],"S_1_1_4":"2022-10-16T17:15:00.000Z","S_1_1_10":"2022-09-30T17:00:00.000Z"},"source":"tcp","BATTERY_VOLTAGE":2.9469,"BATTERY_STATUS":3,"BATTERY_PC":63,"UUID"
Coś jeszcze mozna sprawdzic co może być nie tak?
 
Dodane : 16/10/2022 6:24 pm
adrian
(@adrian)
Wpisów: 4038
Szefu Admin Zasłużony dla Forum, Patron Strony
 

Ten kawałek JSON nie zostanie sparsowany przez Things - chyba, że go jakoś dziwnie pokroiłeś

reszta wygląda ok

 

 
Dodane : 16/10/2022 6:51 pm
(@leszekb)
Wpisów: 43
Kontrybutor Donator 2K20
Autor tematu
 

Załączam pełny plik, usuwam tylko ID i SN bo bedzie dostepny publicznie.

{"_id":"usunieto","SN":"usunieto","MAC":"E4:79:BD:9E:73:DD","firmware":{"currentVersion":"0.21.1","versions":["0.21.1"]},"info":{"name":"Hipolitow ","manufacturer":"APA","protocol":"IEC","GPSCoords":{"latitude":52.2226005,"longitude":21.3417774},"location":{"city":"","country":"","postal":"","street":""}},"meteringPoint":{"meterID":"APA72410685"},"config":{"multiplier":1,"usageKeys":{"activeEnergy":"1_8_0","reactiveEnergy":"5_8_0"},"idNumber":"72410685","idKey":"C_1_0","contract":{"billingPeriod":{"dayOfMonthStart":30,"length":6,"monthOfStart":11,"unit":"month"},"distributionTariff":{"_id":"5d4ab14be48b36fafe644c7d","group":"G","name":"G11","distributionNetworkOperator":"PGE","operationalRegions":["Białystok","Lublin","Łódź-Obszar-2","Rzeszów","Skarżysko-Kamienna","Warszawa","Zamość"],"updatedAt":"2022-04-07T14:30:27.343Z","prices":{"qualityComponent":{"unit":"zł/kWh","value":0.0095},"renewableEnergyCharge":{"unit":"zł/kWh","value":0},"cogenerationCharge":{"unit":"zł/kWh","value":0.00406},"constantPriceComponent":{"onePhase":{"unit":"zł/m","value":3.39},"threePhase":{"unit":"zł/m","value":6.56}},"interimComponent":{"type":"usageOverYear","usageOverYear":[{"over":0,"price":{"unit":"zł/m","value":0.02}},{"over":500,"price":{"unit":"zł/m","value":0.1}},{"over":1200,"price":{"unit":"zł/m","value":0.33}}]},"standingCharge":{"type":"billingBased","billingBased":[{"unit":"month","perBalancing":1,"perBillingPeriod":1,"price":{"unit":"zł/m","value":4.5},"remote":false},{"unit":"month","perBalancing":2,"perBillingPeriod":2,"price":{"unit":"zł/m","value":2.25},"remote":false},{"unit":"month","perBalancing":6,"perBillingPeriod":6,"price":{"unit":"zł/m","value":0.75},"remote":false}]}},"multipliers":{"reactiveEnergyFee":1},"zones":[{"name":"Cała doba","price":{"type":"static","static":{"unit":"zł/kWh","value":0.2223}},"periods":[{"bounds":[{"from":{"hour":0,"minute":0},"to":{"hour":24,"minute":0}}],"inEffect":{"months":[0,1,2,3,4,5,6,7,8,9,10,11],"weekdays":[0,1,2,3,4,5,6],"holidays":true,"nonholidays":true}}]}]},"region":"Warszawa","price":{"unit":"zł"},"retail":{"prices":{"tradingFee":0},"zones":[{"name":"Cała doba","price":0}]},"pv":{"energyBank":{"initializationDate":"2022-10-01T00:00:00.000Z","initialState":0,"initialActiveEnergy":0,"initialNegativeEnergy":0,"multiplier":0.7},"install":{"peakPower":10,"area":20,"loss":0.2,"angle":45,"aspect":13}}},"uiConfig":{"displayProjections":false,"usedTariff":"polish"},"meterPhase":"threePhase"},"lastReading":{"date":"2022-10-16T18:00:00.000Z","OBIS":{"0_2_2":"G11","0_9_1":68422,"0_9_2":"2022-09-30T00:00:00.000Z","1_8_0":26204.16,"1_8_1":26204.16,"1_8_2":0,"2_8_0":14297.44,"2_8_1":14297.44,"2_8_2":0,"5_8_0":224.82,"6_8_0":114.15,"7_8_0":1818.36,"8_8_0":6115.05,"C_1_0":"72410685","S_1_1_6":1568,"S_1_1_7":[3,0],"S_1_1_16":[],"S_1_1_2":2.9469,"S_1_1_9":20,"S_1_1_8":[3,9600],"S_1_1_14":[57,20,209,214],"S_1_1_4":"2022-10-16T18:00:00.000Z","S_1_1_10":"2022-09-30T17:00:00.000Z"},"source":"tcp","BATTERY_VOLTAGE":2.9469,"BATTERY_STATUS":3,"BATTERY_PC":63,"UUID":"e19a58c6-9840-4821-beb5-0c222366d59f","count":5204,"encryption":"aead","meterID":"APA72410685","updatedAt":{"1_8_0":"2022-10-16T18:00:00.000Z","2_8_0":"2022-10-16T18:00:00.000Z","5_8_0":"2022-10-16T18:00:00.000Z","6_8_0":"2022-10-16T18:00:00.000Z","7_8_0":"2022-10-16T18:00:00.000Z","8_8_0":"2022-10-16T18:00:00.000Z","1_8_1":"2022-10-16T18:00:00.000Z","2_8_1":"2022-10-16T18:00:00.000Z","S_1_1_4":"2022-10-16T18:00:00.000Z","0_9_1":"2022-09-30T17:00:00.000Z","0_9_2":"2022-09-30T17:00:00.000Z","1_8_2":"2022-09-30T17:00:00.000Z","2_8_2":"2022-09-30T17:00:00.000Z","C_1_0":"2022-09-30T17:00:00.000Z","S_1_1_10":"2022-09-30T17:00:00.000Z","S_1_1_14":"2022-10-16T18:00:00.000Z","S_1_1_16":"2022-10-16T18:00:00.000Z","S_1_1_2":"2022-10-16T18:00:00.000Z","S_1_1_6":"2022-10-16T18:00:00.000Z","S_1_1_7":"2022-10-16T18:00:00.000Z","S_1_1_8":"2022-10-16T18:00:00.000Z","S_1_1_9":"2022-10-16T18:00:00.000Z"},"syncDate":"2022-09-30T17:11:18.345Z"},"initialReading":{"date":"2022-09-30T09:56:58.000Z","OBIS":{"0_2_2":"G11","0_9_1":43040,"0_9_2":"2022-09-30T00:00:00.000Z","1_8_0":25926.54,"1_8_1":25926.54,"1_8_2":0,"2_8_0":14084.63,"2_8_1":14084.63,"2_8_2":0,"5_8_0":221.78,"6_8_0":113.7,"7_8_0":1770.34,"8_8_0":6031.68,"C_1_0":"72410685","S_1_1_6":0,"S_1_1_7":[0,0],"S_1_1_16":[],"S_1_1_2":3.0456,"S_1_1_9":13,"S_1_1_8":[15,9600],"S_1_1_14":[29,40,216,226]},"source":"init","BATTERY_VOLTAGE":3.0456,"BATTERY_STATUS":3,"BATTERY_PC":69},"timezone":{"name":"Europe/Warsaw"},"hardware":{"version":"4.7"},"type":"home-pv","firstReading":{"_id":"20be3663e19a58c6","OBIS":{"1_8_0":25926.54,"2_8_0":14084.66,"5_8_0":221.78,"6_8_0":113.7,"7_8_0":1770.37,"8_8_0":6031.68,"1_8_1":25926.54,"2_8_1":14084.66},"UUID":"e19a58c6-9840-4821-beb5-0c222366d59f","date":"2022-09-30T10:00:00.000Z","source":"sync","syncDate":"2022-09-30T17:11:38.600Z"},"disabled":false,"usage":{"thisMonth":268.84000000000015,"previousMonth":8.779999999998836,"fullTime":277.619999999999,"lastHour":null,"projection":527.0678947368424,"projectionFillRatio":0.5100671140939598},"production":{"thisMonth":209.9300000000003,"previousMonth":2.850000000000364,"fullTime":212.8100000000013,"lastHour":null,"projection":411.5732894736847,"projectionFillRatio":0.5100671140939598},"meta":{"0_2_2":{"key":"TARIFF","constant":false,"category":"meter","subcategory":"identification","unit":"","description":{"short":"Taryfa","long":"Aktualna taryfa"},"shortcode":"1"},"0_9_1":{"key":"TIME","constant":false,"category":"meter","subcategory":"identification","unit":"","description":{"short":"Czas","long":"Czas na liczniku"},"shortcode":"2"},"0_9_2":{"key":"DATE","constant":false,"category":"meter","subcategory":"identification","unit":"","description":{"short":"Data","long":"Data na liczniku"},"shortcode":"3"},"1_8_0":{"key":"POSITIVE_ACTIVE_ENERGY_TOTAL","constant":false,"category":"energy","subcategory":"active","unit":"kWh","description":{"short":"Energia A+ (suma)","long":"Energia czynna pobrana A+ (suma)"},"shortcode":"12"},"1_8_1":{"key":"POSITIVE_ACTIVE_ENERGY_T1","constant":false,"category":"energy","subcategory":"active","unit":"kWh","description":{"short":"Energia A+ (1 strefa)","long":"Energia czynna pobrana A+ (1 strefa)"},"shortcode":"13"},"1_8_2":{"key":"POSITIVE_ACTIVE_ENERGY_T2","constant":false,"category":"energy","subcategory":"active","unit":"kWh","description":{"short":"Energia A+ (2 strefa)","long":"Energia czynna pobrana A+ (2 strefa)"},"shortcode":"14"},"2_8_0":{"key":"NEGATIVE_ACTIVE_ENERGY_TOTAL","constant":false,"category":"energy","subcategory":"active","unit":"kWh","description":{"short":"Energia A- (suma)","long":"Energia czynna oddana A- (suma)"},"shortcode":"17"},"2_8_1":{"key":"NEGATIVE_ACTIVE_ENERGY_T1","constant":false,"category":"energy","subcategory":"active","unit":"kWh","description":{"short":"Energia A- (1 strefa)","long":"Energia czynna oddana A- (1 strefa)"},"shortcode":"18"},"2_8_2":{"key":"NEGATIVE_ACTIVE_ENERGY_T2","constant":false,"category":"energy","subcategory":"active","unit":"kWh","description":{"short":"Energia A- (2 strefa)","long":"Energia czynna oddana A- (2 strefa)"},"shortcode":"19"},"5_8_0":{"key":"R1_REACTIVE_ENERGY_TOTAL","constant":false,"category":"energy","subcategory":"reactive","unit":"kvarh","description":{"short":"Energia R1 (suma)","long":"Energia bierna R1 (suma)"},"shortcode":"32"},"6_8_0":{"key":"R2_REACTIVE_ENERGY_TOTAL","constant":false,"category":"energy","subcategory":"reactive","unit":"kvarh","description":{"short":"Energia R2 (suma)","long":"Energia bierna R2 (suma)"},"shortcode":"37"},"7_8_0":{"key":"R3_REACTIVE_ENERGY_TOTAL","constant":false,"category":"energy","subcategory":"reactive","unit":"kvarh","description":{"short":"Energia R3 (suma)","long":"Energia bierna R3 (suma)"},"shortcode":"42"},"8_8_0":{"key":"R4_REACTIVE_ENERGY_TOTAL","constant":false,"category":"energy","subcategory":"reactive","unit":"kvarh","description":{"short":"Energia R4 (suma)","long":"Energia bierna R4 (suma)"},"shortcode":"47"},"C_1_0":{"key":"METER_SERIAL_NUMBER","constant":true,"category":"meter","subcategory":"identification","unit":"","description":{"short":"Nr seryjny licznika","long":"Numer seryjny licznika"},"shortcode":"62"},"S_1_1_6":{"key":"READOUT_SUCCEEDED_CNT","constant":false,"category":"non-obis","subcategory":"beacon-info","unit":"","description":{"short":"Liczba udanych odczytów","long":"Liczba udanych odczytów"},"shortcode":"79"},"S_1_1_7":{"key":"READOUT_FAILED_CNT","constant":false,"category":"non-obis","subcategory":"beacon-info","unit":"","description":{"short":"Liczba nieudanych odczytów","long":"Liczba nieudanych odczytów na pierwszej / drugiej wiadomości"},"shortcode":"80"},"S_1_1_16":{"key":"ONEMETER_DEVICE_STATUS","constant":false,"category":"non-obis","subcategory":"beacon-info","unit":"","description":{"short":"Flagi","long":"Flagi stanu urządzenia"}},"S_1_1_2":{"key":"BATTERY_VOLTAGE","constant":true,"category":"non-obis","subcategory":"beacon-info","unit":"V","description":{"short":"Napięcie baterii","long":"Napięcie baterii"},"shortcode":"75"},"S_1_1_9":{"key":"TEMPERATURE","constant":false,"category":"non-obis","subcategory":"beacon-info","unit":"°C","description":{"short":"Temperatura","long":"Temperatura zmierzona przez OneMeter"},"shortcode":"83"},"S_1_1_8":{"key":"UART_PARAMETERS","constant":false,"category":"non-obis","subcategory":"beacon-info","unit":"","description":{"short":"Parametry komunikacji UART","long":"Siła świecenie diody TX / prędkość transmisji UART"},"shortcode":"82"},"S_1_1_14":{"key":"TESTS","constant":false,"category":"non-obis","subcategory":"beacon-info","unit":"","description":{"short":"tests","long":"internal tests"},"shortcode":"87"},"S_1_1_4":{"key":"READOUT_TIME_SECONDS","constant":false,"category":"non-obis","subcategory":"beacon-info","unit":"","description":{"short":"Rzeczywisty czas odczytu","long":"Rzeczywisty czas odczytu licznika"},"shortcode":"77"},"S_1_1_10":{"key":"ONEMETER_LAST_CORRECT_READOUT_TIMESTAMP","constant":false,"category":"non-obis","subcategory":"meter-info","unit":"","description":{"short":"","long":""},"shortcode":"85"}},"negativeEnergyExists":true,"metadata":{"billingPeriods":[{"started":"2022-06-29T22:00:00.000Z","date":"2022-12-29T23:00:00.000Z","usages":[],"activeEnergy":null,"activeEnergy_1":null,"activeEnergy_2":null,"negativeEnergy":null,"reactiveEnergy":null,"averagedCount":0,"readoutCount":0,"deltaMax":null}]},"own":true,"users":[],"owner":{"name":"Leszek Bulanow","email":"leszek.bulanow@gmail.com"},"energyBankData":{"bankProfile":[{"date":"2022-12-29T23:00:00.000Z","positive":268.0514285714271,"negative":146.9220000000001,"balance":-121.12942857142698,"deltaMax":{"date":"2022-10-01T00:00:00.000Z","activeEnergy":0.15771428571315482,"negativeEnergy":0.0058000000002721205,"delta":-0.1519142857128827}}],"nextLoss":{"date":"2023-12-29T23:00:00.000Z","value":0},"allTimeMax":0,"initialBankState":0,"totalTrickleback":146.9220000000001,"totalDrained":268.0514285714271,"total":-121.12942857142698}}
 
Dodane : 16/10/2022 7:22 pm
adrian
(@adrian)
Wpisów: 4038
Szefu Admin Zasłużony dla Forum, Patron Strony
 

@leszekb możesz w przeglądarce odczytać to

 http://192.168.2.106:8080/static/onemeter/onemeter-device-data.json 

z tego co widziałem masz OH v2

masz zainstalowany http binding - nie pamiętam, jak to się nazywało w OH2

Nie masz niczego w log co te 60sek jak odświeża tego thing

reboot OH robiłeś?

 
Dodane : 16/10/2022 8:12 pm
(@leszekb)
Wpisów: 43
Kontrybutor Donator 2K20
Autor tematu
 

Mam http binding ale moze to jest jakis trop bo chciałem go odinstalowac i zainstalowac ponownie i sie nie da. 

Reboot robiłem kilka razy.

Powalczę z tym http binding i dam znac czy cos ruszyłem z tematem.

Things ładuje sie tylko raz a potem nie widac nic co by go odświeżało.

 
Dodane : 16/10/2022 8:29 pm
(@leszekb)
Wpisów: 43
Kontrybutor Donator 2K20
Autor tematu
 

Witam, problem rozwiązany poprzez migrację do OH3, w poprzedniej wersji nie byłem w stanie przeinstalować http binding.

Dziękuję za pomoc.

 
Dodane : 23/01/2023 4:26 pm
Udostępnij: