Home Forum Community Fibaro Home Center 2 integration

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #5691
    Teza
    Participant

    Anyone that have a smarthome system from Fibaro, and have connected their Urad unit to it?

    #5693
    uRADMonitor
    Keymaster

    Sounds really interesting! Please share more on this, and a few pictures if you set it up!

    #5695
    Teza
    Participant

    I have searched the internet for many hours trying to find out how to get the values imported in fibaro, but as I have no knowledge of programming I have not been able to.

    The programming language is LUA, and I think all I need is the LUA code to import the json string into a table.
    I dont think I can install librarys, but dont know if that is correct.

    It is easy to set up a viritual devive in the system, but are strugeling with the lua code to get the values.

    #5714
    uRADMonitor
    Keymaster

    Anyone can help here? Seems like a weekend project.

    #5789
    SveinT
    Participant

    Hi, I am also looking for a way to extract the values and make them accessible for a smart home system that and adjust the rpm on a fan, so that when radon values are getting higher the smart home system can tell the fan to increase suction.

    Is it possible to have for example Z-wave or alike implemented in the uradmonitor itself? That would solve it as there are several smart home systems supporting the Z-wave protocol.

    #5790
    Teza
    Participant

    I don’t think that is the direction of the project.

    I have been trying to implement it in my Fibaro HC2, and have been able to import the json string into the system.
    Tho, my unit have no wifi network atm, so I need to get the unit fixed before I can continue.

    This is the code so far:

    --[[
    -- %% autostart
    %% properties
    %% events
    %% globals
    --]]
    
    MyId = fibaro:getSelfId()
    
    local PI1 = Net.FHttp("192.168.8.106", 80);
    res, status, errorCode = PI1:GET("/j");
    
    fibaro:debug ("status "..status.."; errorCode ".. errorCode.."; res ".. res);
    arrData = json.decode(res);
    
    function dump(o)
       if type(o) == 'table' then
          local s = '{ '
          for k,v in pairs(o) do
             if type(k) ~= 'number' then k = '"'..k..'"' end
             s = s .. '['..k..'] = ' .. dump(v) .. ','
          end
          return s .. '} '
       else
          return tostring(o)
       end
    end
    
    local jstr = '{"data":{ "id":"8200007A","type":"8","detector":"SI29BG","voltage":382,"cpm":14,"temperature":9.45,"humidity":48.29,"pressure":100281,"voc":12800000,"co2":399,"noise":39,"ch2o":0.00,"pm25":3,"uptime": 107787}}'
    local j = json.decode(jstr)
    print(dump(j))
    #5795
    uRADMonitor
    Keymaster

    That’s very cool @domene! Please add some snapshots with it as soon as you get it going! Thanks for this contribution.


    @SveinT
    can you try this too?

    #6103
    Terje Andersen
    Participant

    For those of you that might be looking into the same challenge:

    After a very long time, I have finaly found the solution to import the json string into the Fibaro system.
    Each value need it’s own variable.

    --[[
    %% autostart
    %% properties
    %% events
    %% globals
    124 value
    --]]
    
    MyId = fibaro:getSelfId()
    fibaro:debug(MyId)
    
    local uRad = Net.FHttp("192.168.60.150", 80)
    local res, status, errorCode = uRad:GET("/j")
    fibaro:debug("status "..status.."; errorCode ".. errorCode.."; res ".. res)
    
    local jsonTable = json.decode(res)
    fibaro:debug(jsonTable)
    
    fibaro:setGlobal("uRad_temperature", jsonTable.data.temperature) -- Sensor 1: Temperature
    fibaro:setGlobal("uRad_humidity", jsonTable.data.humidity) -- Sensor 2: Humidity
    fibaro:setGlobal("uRad_pressure", jsonTable.data.pressure) -- Sensor 3: Pressure
    fibaro:setGlobal("uRad_voc", jsonTable.data.voc) -- Sensor 4: VOC (Volatile Organic Compounds)
    fibaro:setGlobal("uRad_pm25", jsonTable.data.pm25) -- Sensor 5: PM2.5 (Particulate matter)
    fibaro:setGlobal("uRad_ch2o", jsonTable.data.ch2o) -- Sensor 6: Formaldehyde
    fibaro:setGlobal("uRad_co2", jsonTable.data.co2) -- Sensor 7: Carbon Dioxide
    fibaro:setGlobal("uRad_cpm", jsonTable.data.cpm) -- Sensor 8: Radiation
    fibaro:setGlobal("uRad_noise", jsonTable.data.noise) -- Sensor 9: Noise
    fibaro:sleep(60*1000)

    Tho, will still need to figure out how to make my virtual device work as intended, but this is the solution to import the json string.

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.