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

QuickApp - Radiation Monitor ​☢️​


SmartHomeEddy

Question

The Radiation Monitor collects radiation levels from all available stations around the world and shows 5 nearest stations to your location and one station with highest current readings and one station with the highest 24 hour average readings. The QuickApp uses the location (latitude and ongitude) of your Homecenter to measure the distance to the stations and to get the nearest stations. The bearings in degrees from your location to the stations is shown. Next to the measurements, the five nearest reactors are shown. The languages English, French, Polish and Duth are supported. 

 

Thanks to @Sankotronic for his work for his HC2 Virtual Device version and ideas. 

 

Please login or register to see this attachment.

 

The main device shows the nearest measurement μSv/h. There are Child Devices for:

  • Nearest sensor 24h average μSv/h
  • 2nd, 3rd, 4th, 5th nearest sensor measurement with the 24 average in the log text
  • Nearest maximum measurement
  • Nearest maximum 24h average measurement

 

The nearest five reactors are retrieved once at startup of the QuickApp or at the next interval if you click on the button. 

Radioactive@Home is a Polish science project using the distributed computing capabilities of the BOINC platform. The main goal of the project is to create a free and continuously updated map of radiation levels available for everyone, by gathering information about gamma radiation using sensors connected to the computers of volunteers willing to participate in the project. Project is completely non-commercial, participating will be free of charge (excluding cost of detector) and the software will be licensed under the GNU General Public License (GPL).

 

μSv/h: The sievert (symbol: Sv) is a unit in the International System of Units (SI) intended to represent the stochastic health risk of ionizing radiation.

 

In land navigation, a 'bearing' is ordinarily calculated in a clockwise direction starting from a reference direction of 0° and increasing to 359.9 degrees. Measured in this way, a bearing is referred to as an azimuth by the US Army but not by armies in other English speaking nations, which use the term bearing.

 

The human population is continuously exposed to ionizing radiation from several natural sources (cosmic and terrestrial contributions). For most individuals, exposure to natural sources exceeds that from all man-made (artificial) sources combined. The man-made sources arise from peaceful (e.g. medical use, energy generation, and associated fuel cycle facilities, radioisotope production, waste management) and military purposes (nuclear tests and their fallout or radioactive release, nuclear explosions).

 

Radiation levels: 
Green: Radiation up to 0.3 μSv/h
Yellow: Radiation between 0.3 and 0.8 μSv/h 
Red: Radiation above 0.8 μSv/h

 

1.14 µSv/h - Shelter population
5.7 µSv/h - Evacuation of population
11.4 µSv/h - Issue Iodine tablets
0.114 µSv/h - Max daily dose == 1 mSv/year

 

Reverse Geocoding by Nominatim
Reverse geocoding generates an address from a latitude and longitude. The reverse geocoding API does not exactly compute the address for the coordinate it receives. It works by finding the closest suitable OSM object and returning its address information. This may occasionally lead to unexpected results. 

 

Please login or register to see this attachment.

Please login or register to see this attachment.

Please login or register to see this image.

/monthly_2022_11/radiation-monitor-1c.png.762783dcc152d2602bb666ee45869ef9.png" />

 

QuickApp code logics:

  • onInit() Initialise the QuickApp
  • getQuickAppVariables() Get all Quickapp Variables or create them
  • createVariables() Setup the global variables
  • setupChildDevices() -- Setup all child devices
  • loadMap() Get the webpage from

    Please login or register to see this link.

    (This is the main loop of the QuickApp)
  • extractData() Extract the data from the webpage source-code
  • geoDistance() Calculate the distance from the HC3 (QuickApp variables) lat/lon to the sensors lat/lon
  • geoBearing() Calculate the bearing from the HC3 (QuickApp variables) lat/lon to the sensors lat/lon
  • Check for the values to give the right dot colours for the sample and average measurements
  • Store the values of all sensors in a table and sort the table on distance
  • Run through the table to get the maximum sample and maximum average measurements. If there are more than one, get the one that is the nearest-by
  • updateIcon() Set the icon (colour) based on the sensor measurement
  • getCity() Get the cities and countries for the seven selected sensors from

    Please login or register to see this link.

    and store them in a table
  • updateLabels() Update the labels
  • updateProperties() Update the properties
  • updateChildDevices() Update the Child Devices
  • Return to the main loop loadMap()

 

Links:

  • Radioactive@Home Map:

    Please login or register to see this link.

  • Status servers:

    Please login or register to see this link.

  • Reverse geocoding:

    Please login or register to see this link.

    licence:Data © OpenStreetMap contributors, ODbL 1.0.

    Please login or register to see this link.

  • Nominatim Usage Policy (aka Geocoding Policy):

    Please login or register to see this link.


Variables (mandatory and created automatically): 

  • latitude = Latitude of your location (Default is the latitude of your HC3)
  • longitude = Longitude of your location (Default is the longitude of your HC3)
  • language = Preferred language (default = en) (supported languages are English (en), French (fr), Polish (pl), Croatian (hr) and Dutch (nl))
  • interval = Interval in seconds to get the data from the Radioactive@Home website
  • debugLevel = Number (1=some, 2=few, 3=most, 4=all) (default = 1, debugLevel 4 is only recommended for solving difficult issues)
  • icon_refresh = User defined icon number for refresh status
  • icon_green = User defined icon number for values less than 0.3 μSv/h
  • icon_yellow = User defined icon number for values between 0.3 and 0.8 μSv/h 
  • icon_red = User defined icon number for values greater than 0.8 μSv/h
  • icon_error = User defined icon number in case of an error gettng the data

 

 

Version 1.4 (6th February 2024)

  • Added extra check for an empty response in the address from Geocity (thanks to @Sankotronic from the Fibaro forum)

Version 1.3 (17th July 2023)

  • Added extra check for the right response from Geocity (in case of response {"error":"Unable to geocode"})

Version 1.2 (11th January 2023)

  • Added support for Croatian language thanks to @Sankotronic

Version 1.1 (9th January 2023)

  • Changed handling of negative values for dots and icons: if tonumber(num) >= 0 and tonumber(num) <= 0.3 then 
  • Added a better translation for French (thanks to @fredokl)

Version 1.0 (5th November 2022)

  • Added the nearest five reactors to the labels with distance and bearing
  • Added a button to refresh the list of (five nearest) reactors
  • Added a warning at startup if the latitude or longitude differs from the setup of your HC3
  • Replaced the creation of the dots 🟢🟡🔴 to the labels, so no longer for all sensors
  • Added some extra notifications to the labels in case the website is down
  • Extended the http timeout a bit, to give the reverse geocoding some more time to respond
  • Added translations for new functions

Version 0.5 (29th October 2022)

  • Added translation to the Reverse API geocoding response (city and country)
  • Changed calculation of the bearings only for the 7 selected sensors, not all sensors
  • Optimized the code and added more structure by using multi file code (main, childs and i18n)

Version 0.4 (22nd October 2022)

  • Added six Child devices for the nearest sensor 24h average, 2nd, 3rd, 4th, 5th nearest sensor sample, the nearest sensor maximum sample and the nearest sensor maximum 24h average
  • Added icons based on sensor measurements to all Child Devices
  • Added translations for the labels and properties from English to French, Polish and Dutch. (Thanks to @ppeterr and @fredokl for help with the translation)
  • Limited the details of the response of the Reverse Geocoding with zoom=10 (address detail = city)

Version 0.3 (16th October 2022)

  • Added the City and Country also for worst sample and worst average sensors
  • Added all debug information and set the debug levels
  • Optimised the code

Version 0.2 (15th October 2022)

  • Added the City and Country for all 5 sensors, not only the first one

Version 0.1 (15th October 2022)

  • Initial version

 

Download the QuickApp here (download the file and un-zip):

Please login or register to see this link.

or from the Fibaro Marketplace:

Please login or register to see this link.


How to install: 

  1. Open the Configuration Interface
  2. Go to Settings > Devices
  3. Click  +
  4. Choose Other Device
  5. Choose Upload File
  6. Choose file from your computer with .fqa

 

Icons thanks to @Sankotronic

image.png.69f69625580adda6e16fa2a12cf0b851.pngimage.png.34c11c6855da86a0ab686982678aea0c.pngimage.png.6170fc1e918407462f60261d0ef3ebc9.pngimage.png.b02b02f067cca39ea6e1971795241863.pngimage.png.61ed78e363bbafd8d3447f5308223746.png

 

 

Edited by SmartHomeEddy
  • Like 5
  • Thanks 1
Link to comment
Share on other sites

Recommended Posts

  • 0
  • Inquirer
  • 8 hours ago, fredokl said:

    I suggest small changes if it's not too late.

     

    Thanks!

     

    Definitely not too late, I (Google Translate) only tried to give it a shot in the right direction. 

     

     

     

    Edited by SmartHomeEddy
    • Thanks 1
    Link to comment
    Share on other sites

    • 0
    39 minutes ago, SmartHomeEddy said:

    Anyone good into Polish?

     

    Please login or register to see this code.

     

     

    Sure one moment :)

     

     

    I had it checked by a Polish colleague, and she says it is correct.

     

    "site" would that be industrial site ? or location ? "witryna" would be oke for location.

     

    Edited by ppeterr
    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • 22 hours ago, ppeterr said:

    "site" would that be industrial site ? or location ? "witryna" would be oke for location.

     

    "Nearest maximum sample and average site"

     

    Site in this context is more the place where the sensor is located. So "location" (witryna) would be the right definition. Maybe I should replace in the English version site with location. 

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • This is how the labels will look like in EN, FR, PL and NL:

     

    Please login or register to see this image.

    /monthly_2022_10/radiation-monitor-EN.png.1b9297c50dfe5f99a6eafe0e4141ab04.png" />  


    radiation-monitor-FR.png.dcd5ac77009a9a1fbd3e7c65081d3a7f.png  

     

    radiation-monitor-PL.png.5d4758cab9d0126a35394c36304f3ea2.png  

     

    radiation-monitor-NL.png.65072a85f1932e8a1c6a22a8f6b8176a.png

     

     

    Edited by SmartHomeEddy
    • Like 1
    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • The new version is available for download, see the first post for all details and download link.

     

    It has lots of new features. 

     

    Please login or register to see this attachment.

     

    Version 0.4 (22nd October 2022)

    • Added six Child devices for the nearest sensor 24h average, 2nd, 3rd, 4th, 5th nearest sensor sample, the nearest sensor maximum sample and the nearest sensor maximum 24h average
    • Added icons based on sensor measurements to all Child Devices
    • Added translations for the labels and properties from English to French, Polish and Dutch (Thanks to @ppeterr and @fredokl for help with the translation)
    • Limited the details of the response of the Reverse Geocoding with zoom=10 (address detail = city)

    Download the new version from GitHub and install: 

    1. Open the Configuration Interface
    2. Go to Settings > Devices
    3. Click  +
    4. Choose Other Device
    5. Choose Upload File
    6. Choose file from your computer with .fqax

     

     

    • Thanks 1
    Link to comment
    Share on other sites

    • 0

    Hello. Thank you for your reply. I understand better how QA works. On the other hand I have a small bug which appeared today with the name of a sensor. The characters look like Chinese. Here is a screenshot. If not, are you going to make the code available for those who want to make personal modifications? Thanks.

    Please login or register to see this attachment.

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • The name of the cities is in de language of the country. That is what the reverse geocoding returns. In this case the maximum measurement is in South Korea (not China ?). 

    Link to comment
    Share on other sites

    • 0

    Ok, but as far as I'm concerned, I live more than 9000km from Korea?. So I don't understand what this is doing on my dashboard.

     

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • It still is the maximum “nearby” ? measurement. The maximum measurement and maximum average is “for your information”. If the maximum measurement is close to your location you need to worry if it is a high value. In this case the maximum is only 0.21 and far away. That is like a feel good movie. 
     

     

    Edited by SmartHomeEddy
    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • 33 minutes ago, SmartHomeEddy said:

    The name of the cities is in de language of the country.

    Btw I will have a look if I can force the response to a different language. 
     

     

    Edited by SmartHomeEddy
    • Thanks 1
    Link to comment
    Share on other sites

    • 0

    Thank you for the clarification. I use Google Translate, I had a little trouble understanding. Sometimes the translation is a little perfectible! I understand better now.

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • 11 minutes ago, fredokl said:

    Sometimes the translation is a little perfectible! I understand better now.

     

    I know, I use translation for the French forum

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • I think I found a way

     

    {"place_id":298463958,"licence":"Data © OpenStreetMap contributors, ODbL 1.0. https://osm.org/copyright","osm_type":"relation","osm_id":2297418,"lat":"37.5666791","lon":"126.9782914","place_rank":8,"category":"boundary","type":"administrative","importance":0.6297939847554467,"addresstype":"city","name":"Séoul","display_name":"Séoul, Corée du Sud","address":{"city":"Séoul","ISO3166-2-lvl4":"KR-11","country":"Corée du Sud","country_code":"kr"},"boundingbox":["37.4285424","37.7013911","126.7644328","127.1837702"]}

     

    versus

     

    {"place_id":298463958,"licence":"Data © OpenStreetMap contributors, ODbL 1.0.

    Please login or register to see this link.

    대한민국","address":{"city":"서울","ISO3166-2-lvl4":"KR-11","country":"대한민국","country_code":"kr"},"boundingbox":["37.4285424","37.7013911","126.7644328","127.1837702"]}

     

    • Like 1
    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • Thanks

     

    Solved the language in the Reverse API geocoding. Now (in French) it looks like:

     

    Please login or register to see this image.

    /monthly_2022_10/image.png.b48facf17e3262c28ae23880aada967c.png" />

     

     

    It is a nice API by the way. 

    Please login or register to see this link.

     

    It can be tweaked a bit with parameter, also the language. 

     

    How it works

    Please login or register to see this spoiler.

     

    • Thanks 1
    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • 18 hours ago, fredokl said:

    If not, are you going to make the code available for those who want to make personal modifications?

     

    In the first place I want to experiment with QuickApp and without the source-code. Let's see what kind of discussion that brings. The source-code protection is new, maybe it brings new opportunities for other parties to make their QuickApps available. In second place I want to deliver a QuickApp which doesn't need personal modification, just works as it already is. It should work plug-and-play and (hopefully) should meet the expectations. 

     

    The source-code itself, there is nothing secret about it. This is how it logically works:

    • onInit() Initialise the QuickApp
    • getQuickAppVariables() Get all Quickapp Variables or create them
    • createVariables() Setup the global variables
    • setupChildDevices() -- Setup all child devices
    • loadMap() Get the webpage from 

      Please login or register to see this link.

       (This is the main loop of the QuickApp)
    • extractData() Extract the data from the webpage source-code
    • geoDistance() Calculate the distance from the HC3 (QuickApp variables) lat/lon to the sensors lat/lon
    • geoBearing() Calculate the bearing from the HC3 (QuickApp variables) lat/lon to the sensors lat/lon
    • Check for the values to give the right dot colours for the sample and average measurements
    • Store the values of all sensors in a table and sort the table on distance
    • Run through the table to get the maximum sample and maximum average measurements. If there are more than one, get the one that is the nearest-by
    • updateIcon() Set the icon (colour) based on the sensor measurement
    • getCity() Get the cities and countries for the seven selected sensors from 

      Please login or register to see this link.

       and store them in a table
    • updateLabels() Update the labels
    • updateProperties() Update the properties
    • updateChildDevices() Update the Child Devices
    • Return to the main loop loadMap()

    There are some differences compared to the other QuickApps I have build. I used the multi file function for the main, child devices, translation and supporting functions. The second difference is the way I get the information. Because there is no nice API for the measurements, I use some data scraping. I get the data from the html response. The third difference is, next to the data from radioactive@home I use the Nominatim API for the reverse geocoding. For the 7 sensors I get the cities and countries based on the latitude/longitude, so there are 1+7 http requests per loop. 

    That's all.  

     

     

    • Thanks 1
    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...