Share My Creation atHome - App for Domoticz Home Automation

Discussion in 'Share Your Creations' started by rwblinn, Sep 27, 2018.

  1. rwblinn

    rwblinn Well-Known Member Licensed User

    atHomeApp

    upload_2018-10-7_14-48-27.png
    Note: in the meantime added more devices.

    Objectives
    To create a flexible Home Automation Android App to view & control devices atHome.
    • atHome is a private project building a Home Automation Solution
    • based on Domoticz Home Automation System v4, running on a Raspberry Pi 3B+ Stretch
    • atHomeApp is created with B4A v8.50
    • Open Source GNU Lesser General Public License
    • first private showcase learning Mobile Development B4A + XUI
    • Make the app as generic as possible, means the data of the Domoticz server should be used as is without making dedicated changes in the app
    • Keep the App SIMPLE – not overcomplicating - fast access to view & control is key
    Functionality
    • View & control devices which are added to the Domoticz Dashboard ("favorites")
    • Devices are grouped and displayed in tabs (TabStripViewPager Custom View)
    • Own device grouping used (not Domoticz menus) to build the tabs: Weather, Lights, Information
    • Tabs containing xCustomListView (except Tab Settings) to view or control devices
    • xCustomListView items are build at runtime using Domoticz Favorite Devices data
    • Domoticz Favorite Devices data is requested via HTTP (okhttputils2) and the JSON response is parsed to get the relevant data
    • Data refreshed is triggered manually via menu item (Tab Settings shows time refreshed)
    • If Domoticz favorite devices are changed (added/removed/updated), these are reflected on the next manual updated (no changes required in the App, full flexible to handle change)
    • Clicking on xCustomListView item shows short toastmessage with additional information
    • Tab Lights enabled to control Hue Lights ON/OFF (ToggleSwitch) or dim (SeekBar). When dimming, a short toastmessage shows the dim level
    • Tab Information enables to send a message to the Alert Message device using its idx.
    • Settings are managed via Tab Settings and stored using map file (in file internal)
    • At App resume, data is refreshed
    • Menus added to refresh the data as mentioned, jump to tabs (pages)
    Outline next version
    • Extend parsing device Types & Subtypes as not all Domotict types are supported yet
    • Handle devices thresholds, i.e. change data color depending level
    • Consider to update real time or use a timer to autorefresh - but will cause high network traffic
    • Consider selective devices from all devices data - needs customizing (=effort to maintain, non standard), high data volume
    Development Hints
    • To get started with xCustomListViews, view the very good video tutorial first - could not build the solution without the video!
    • Android.jar: ensure(!) to set minimum android-28\android.jar (else error unable to find attribute android:fontVariationSettings) - it was a surprise after updating the SDK - but solved with help from the forum
    • Use the Domoticz JSON/API reference for building URL requests
    • Use browser first to test and learn the properties of the URL requests & response from the Domoticz server
    • Screenshots made with the Android device monitor (folder tools, monitor.bat)
    • All constants defined in code module Constants, Tabs text & icons defined in a map with maps
    • Development effort: 2 days (30% Conceptual Design on Paper, 40% Exploring How To Solutions, 30% Coding & Testing)
    Source Code
    Attached without the libraries used
     

    Attached Files:

    Last edited: Oct 8, 2018
    OGmac, Laurent95, johndb and 7 others like this.
  2. rwblinn

    rwblinn Well-Known Member Licensed User

    Update v0.93 (Build 20181007) (see Post #1)

    * NEW: Device recognize and mapping to tab defined in a JSON structure file stored in assets.
    * UPD: Added more devices. More to add over time.
    * NEW: Replaced option to send a message by using InputDialog when pressing/clicking on Art Device Item (Index defined in the settings).
    * NEW: Tab Lights: Accept switch ON/OFF device
    * NEW: Each device holds it full property list. Easier to access device information/state.
    * NEW: Tested the app on a Raspberry Pi running emteria.OS - looks great on a 21" LED screen.
    * NEW: Icon created.
    * NEW: Developed B4J version with almost same code - only specific objects changed, add classes for InputDialog & ToastMessageShow.
     
    Last edited: Oct 7, 2018
    Johan Hormaza, Erel and inakigarm like this.
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice