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

onemeter


apentua

Question

10 answers to this question

Recommended Posts

  • 0

Hej. Posiadam coś takiego od dwóch tygodni. Na razie działa. Mam fotowoltaikę i na dzień dzisiejszy nie liczy poprawnie rachunków - ma to być poprawione. Nie było jeszcze gościa od spisywania liczników, dlatego trudno mi powiedzieć, jaka będzie jego reakcja na powieszony guzik na ich liczniku. Kupując trzeba zwrócić uwagę na to, czy licznik jest kompatybilny. Do odczytu można użyć telefonu z androidem - albo raz na jakiś czas ściągać dane manualnie, albo zastosować bramkę w pobliżu licznika - może to być telefon, może to być raspberry pi. Ja mam raspberry, kłopot jest z pociągnięciem zasilania do płotu, no i musi być zasięg wifi. Mnie się udało i czyta mi dane co 15 minut, rysuje wykresy, liczy koszty. Alternatywą może być Zamel MEW-01 - działa na innej zasadzie, ale u mnie rozbieżności są pomijalne. Zależy po prostu, czego oczekujesz.

Link to comment
Share on other sites

  • 0
W dniu 14.04.2021 o 00:21, Enriquez napisał:

HC3, śmiga bez problemu.

Czy jesteś w stanie podesłać jakąś instrukcję jak to zintegrować?

Link to comment
Share on other sites

  • 0
-- QUICKAPP Onemeter

function QuickApp:onInit()
    __TAG = "_ONEMETER_"..self.id
    self.http = net.HTTPClient({timeout=3000})
    self:debug("onInit")
 
    IPaddress = self:getVariable("IPaddress")
    Path = self:getVariable("Path")
    powerID = tonumber(self:getVariable("powerID"))
    maxNodeID = tonumber(self:getVariable("maxNodeID"))
    Interval = tonumber(self:getVariable("Interval")) 
 
    -- Check existence of the mandatory variables, if not, create them with default values 
    if IPaddress == "" or IPaddress == nil then 
      IPaddress = "192.168.50.155" -- Default IPaddress 
      self:setVariable("IPaddress", IPaddress)
      self:trace("Added QuickApp variable IPaddress")
    end
    if Path == "" or Path == nil then 
      Path = "" -- Default path
      self:setVariable("Path", Path)
      self:trace("Added QuickApp variable Path")
    end
    if powerID == "" or powerID == nil then 
      powerID = "21" -- ID of the device where you want to capture the 'delta' power, use 0 if you don't want the storage
      self:setVariable("powerID", powerID)
      self:trace("Added QuickApp variable powerID")
      powerID = tonumber(powerID)
    end
    if maxNodeID == "" or maxNodeID == nil then 
      maxNodeID = "350" -- maximum node ID in your z-wave network (uses to summerize power consumption of your devices)
      self:setVariable("maxNodeID", maxNodeID)
      self:trace("Added QuickApp variable maxNodeID")
      maxNodeID = tonumber(maxNodeID)
    end
    if Interval == "" or Interval == nil then
      Interval = "9" -- Default interval in seconds (The P1 meter normally reads every 10 seconds)
      self:setVariable("Interval", Interval)
      self:trace("Added QuickApp variable Interval")
      Interval = tonumber(Interval)
    end
 
    if powerID == 0 or powerID == nil then
      self:warning("No powerID to store netto power consumption")
    end
 
    self:loop("")
end
 
function QuickApp:loop(text)
 
      local url = "tu wpisać klucz "
 
  self:debug("-------------- ONEMETER ---------------")
    
  self.http:request(url, {
    options={
    headers = {Accept = "application/json"}, method = 'GET'},
      success = function(response)
        -- self:debug("response status:", response.status) 
        -- self:debug("headers:", response.headers["Content-Type"]) 
 
local apiResult = response.data
-- self:debug("apiResult",apiResult) -- To see in debug if there is something in apiResult
local jsonTable = json.decode(apiResult) -- Decode the json string from api to lua-table
-- self:debug("jsonTable",jsonTable) -- To see in debug if there is something in jsonTable
        
-- Get the values
local WBanku = jsonTable.energyBankData.bankProfile[2].balance
self:debug("W magazynie: ",WBanku," kWh")
-- local TotalBank = jsonTable.energyBankData.total
-- self:debug("W magazynie: ",TotalBank," kWh")
local Positive = jsonTable.lastReading.OBIS["1_8_1"]
self:debug("Stan licznika (+) : ",Positive," kWh")
local Negative = jsonTable.lastReading.OBIS["2_8_1"]
self:debug("Stan licznika (-) : ",Negative," kWh")
local TMonth = jsonTable.usage.thisMonth
self:debug("Ten miesiąc (+) : ",TMonth," kWh")
local PMonth = jsonTable.usage.previousMonth
self:debug("Poprzedni miesiąc (+) : ",PMonth," kWh")
local TMonthP = jsonTable.production.thisMonth
self:debug("Ten miesiąc (-) : ",TMonthP," kWh")
local PMonthP = jsonTable.production.previousMonth
self:debug("Poprzedni miesiąc (-) : ",PMonthP," kWh"
        --  Debug messages
        --self:debug("Netto consumption: ",netto_consumption .." Watt")
        --self:debug("Actual consumption high: ",act_consumption_high .. " kWh")
        --self:debug("Actual consumption low: ",act_consumption_low .." kWh")
        --self:debug("Total consumption: ",total_consumption .." kW")
        --self:debug("Actual production high: ",act_production_high .." kWh")
        --self:debug("Actual production low: ",act_production_low .." kWh")
        --self:debug("Total production: ",total_production .." kW")
        --self:debug("Actual gas: ",act_gas .." M3")


 
        -- Update the property
        self:updateProperty("log""Bank: kWh")
        self:updateProperty("value", WBanku)
        -- Store netto consumption in unused device
        local i = 0
        local total_devices = 0
        local deviceValue = 0
        local delta_power = 0
        if powerID == 0 or powerID == nil then
          --delta_power = tonumber(netto_consumption) - total_devices -- Measured power usage minus power usage from all devices
          --self:debug("Delta power: ",delta_power .." Watt")
          -- api.put("/devices/"..powerID, {["properties"]={["power"]=TotalBank}}) -- Put delta power into device with powerID
        end
 
        -- Update the labels
        self:updateView("label1""text""W banku jest: " ..WBanku .." kWh")
        self:updateView("label2""text""Stan licznika (+): " ..Positive .." kWh"
        self:updateView("label3""text""Stan licznika (-): " ..Negative .." kWh")
        self:updateView("label4""text""Fibaro pobiera: " ..total_devices .." W")
        self:updateView("label5""text""Pobór aktualny: " ..TMonth .." kW")
        self:updateView("label6""text""Pobór poprzedni: " ..PMonth .." kWh"
        self:updateView("label7""text""Produkcja aktualna: " ..TMonthP .." kWh"
        self:updateView("label8""text""Produkcja poprzedni: " ..PMonthP .." kW")
 
      end,
      error = function(error)
      self:error("error: " ..json.encode(error))
      self:updateProperty("log""error: " ..json.encode(error))
    end
    }) 
    fibaro.setTimeout(Interval*30000function() -- Checks every n seconds for new data
    self:loop(text)
  end)
end 

ten kod jest mocno zaśmiecony, ale działa - powstał na bazie apki Smart Eddiego.

od onemeter musisz uzyskać API key i wpisać go w kodzie

  • Like 1
Link to comment
Share on other sites

  • 0

Dodałem API key, ale nic mi się nie wyświetla. W jaki sposób dodać jakieś kontrolki/statystyki?

Link to comment
Share on other sites

  • 0

Powinna się wyświetlić jedna ikona na dashboardzie na komputerze.

Na telefonie nic się nie wyśiwetla. Jak potrafisz - dodaj ikony. Ja nie umiem i nie chce mi się dalej drążyć tematu.

Link to comment
Share on other sites

  • 0
W dniu 1.06.2021 o 11:16, Enriquez napisał:

Powinna się wyświetlić jedna ikona na dashboardzie na komputerze.

Na telefonie nic się nie wyśiwetla. Jak potrafisz - dodaj ikony. Ja nie umiem i nie chce mi się dalej drążyć tematu.

Wyświetla się ikonka, ale wygląda na to, że nie nawiązuje połączenia: 

Please login or register to see this image.

/monthly_2021_06/image.png.ec97a3d5e26a1464338324c76aa0d990.png" />

Link to comment
Share on other sites

  • 0

najprościej jak sobie odznaczysz pozycje debug i prześledzisz, co mu nie pasuje - w tym polu z logiem wykonania

 

Link to comment
Share on other sites

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...