- This topic has 7 replies, 4 voices, and was last updated 6 years, 6 months ago by
Terje Andersen.
-
AuthorPosts
-
March 26, 2018 at 6:55 pm #5693
Radu
KeymasterSounds really interesting! Please share more on this, and a few pictures if you set it up!
March 26, 2018 at 9:31 pm #5695Teza
ParticipantI 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.
April 10, 2018 at 5:54 pm #5714Radu
KeymasterAnyone can help here? Seems like a weekend project.
May 29, 2018 at 11:00 am #5789SveinT
ParticipantHi, 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.
May 29, 2018 at 11:42 pm #5790Teza
ParticipantI 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))
May 31, 2018 at 12:02 pm #5795Radu
KeymasterOctober 5, 2018 at 9:44 am #6103Terje Andersen
ParticipantFor 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.
-
AuthorPosts
- You must be logged in to reply to this topic.