GithubHelp home page GithubHelp logo

siovene / smart-home-control Goto Github PK

View Code? Open in Web Editor NEW
2.0 5.0 3.0 2.29 MB

A simple demo app for the Cordova OCF plugin, that interfaces with a smart home prototype

JavaScript 82.18% HTML 16.56% CSS 1.26%

smart-home-control's Introduction

Build Status

Smart Home Control

A simple app for the Cordova OCF plugin, that interfaces with a smart home prototype.

In short

This app uses the cordova-plugin-ocf and therefore the Iotivity project to control a Smart Home prototype.

Build instructions

You will need:

  • nodejs, v5 or above
  • The Android SDK, version 21 or above
  • And ARM or x86 Android device (the emulator won't do)
sudo npm install -g cordova grunt-cli bower
npm install
bower install
grunt platform:add:android
grunt run

How to discover resources

Please refer to here to learn about detailed steps.

This demo currently supports the following sensors : Button, Buzzer, Mini Fan, Gas(MQ2), Ambient Light, Led, Motion, RGB Led, Solor, Switch(P) and Temperature.

After the discovery process, this demo can read and control the status of the discovered resources.

smart-home-control's People

Contributors

siovene avatar qiuzhong avatar

Stargazers

 avatar Jaroslaw Juda avatar

Watchers

James Cloos avatar Michael McCool avatar  avatar  avatar  avatar

smart-home-control's Issues

The RGB LED sensor can't work well

For smart-home-control v0.7.0, the RGB LED can be found and work sometimes.
However, there are some cases it doesn't work quite well.

Steps:

  1. Launch the RGB LED OCF server and create a RGB LED resource
  2. Launch the smart-home-control app, open "Continuous discovery" in settings, it will discover the RGB LED sensor.
  3. Click the color picker, change the color RGB value
    • In the terminal of OCF server side, sometimes we got invalid RGB value like this:

       RGB_LED 1952: Update received. value:  255,255,NaN
       RGB_LED 1952: Send the response. value:  255,255,NaN
       RGB_LED 1952: Send the response. value:  255,255,NaN
       RGB_LED 1952: Successfully notified observers.
      

      It can be raised by changing the R to 255, G to 255 and keeping the B unchanged.

    • In the terminal of OCF server side, sometimes the response value can be updated, but the LED didn't change color.
      However, not sure this case is related to the smart-home-control.

Test Environements

Nexus 5 Android 5.0.1
Intel Edison board flashed with Ostro image#510 (iotivity-1.1.1)
SmartHome-Demo#c32b699

Demo app page cannot remove sensor items when the resources are removed from the resource server

Test Environments:

Steps to reproduce:

  1. The resource server creates an OIC temperature resource, launch the Smart Home Control app.
    Now the demo app can find the temperature sensor. Everything works fine.
  2. Then at some time, the resource server stops the resource, observe the the app page.
    The temperature sensor item is still present, though the spinner at the up-right corner is running.
  3. Switch pages between the Sensor and About tab of left side, the temperature sensor remains.

But if we push the app to background and resume it or relaunch the demo app, the page can clean up temperature sensor.

Version 0.80 crashes

Hi Salvatore,

I tried using version 0.8 of the app on my Nexus 6P. Unfortunately it crashes as soon as I tap the refresh sensor discovery button. I deployed the latest ocf-server JS files in the Smart Home repository from here in our OCF Smart Home demo environment. Since I updated the sensors I can no longer get your app to work. Can you please take a look? Thanks!

The range and rgbValue properties of Colour RGB resource should be arrays

According to the OCF specification, the range and rgbValue properties of Colour RGB resource should be arrays rather than strings.
The SmartHome-Demo rgb_led.js has complied it since this commit. However, in the smart-home-control , the rgbValue is still treated as a string. See controller.js

        $scope.sensor.data.properties.rgbValue = [
            $scope.color.r,
            $scope.color.g,
            $scope.color.b].join(',');
        OCFService.updateSensor($scope.sensor.data);

In that way, the rgbValue is a string. The adb log also shows the rgbValue is not an array.

01-21 03:17:04.545  5069  5101 D CordovaPluginOCF: Updating resource: {"id":{"deviceId":"coap:\/\/192.168.1.56:45153","resourcePath":"\/a\/rgbled"},"resourceTypes":["oic.r.colour.rgb"],"interfaces":["oic.if.baseline"],"mediaTypes":[],"properties":{"range":"[I@3bec5b1","rgbValue":"95,104,255","id":"rgbled"},"observable":true}

cordova version is too low

In the package.json, the cordova version

"cordova": "~4.2.0",

is too low. The cordova plugins in package.json cordovaPlugins list will not be installed successfully during executing the command:

grunt platform:add:android

It doesn't work to install them by manual. (Command hangs and fails to install successfully)

Smart home control demo could crash easily

The OCF client smart-home-control v0.7.0 is built on cordova-plugin-ocf v0.6.2. It could crash easily when interacting with the OCF server side.
It's not inevitable, but it's quite often to occur.

Steps

(Can't grantee to reproduce it 100%):

  1. Launch some OCF servers to create some resources(Like Buzzer, RGB LED)
  2. Launch the smart-home-control client, open "Continuous discovery" in settings, it will discover the resources
  3. Interact with the OCF resources

The attchment is part of the crash dump.
smart-home-control-crashes.txt

Device:

Nexus5 Android 5.0.1
Intel Edison board flashed with Ostro image#510 (iotivity-1.1.1)
SmartHome-Demo#c32b699

www directory is missing

www directory is missing.

$ grunt platform:add:android
>> Error: Current working directory is not a Cordova-based project
>>

The buzzer sensor could be found but didn't work

The smart-home-control v0.7.0 can find the buzzer sensor but is not able to make it work.
The buzzer doesn't buzz at all.

Steps

  1. Launch the buzzer OCF server and create a buzzer resource
  2. Launch the smart-home-control app and it will discover the buzzer sensor.
  3. Try to toggle on the button for the buzzer sensor

Log

By capturing some log via adb logcat, we found:

D/CordovaPluginOCF( 8872): Updating resource: {"id":{"deviceId":"coap:\/\/192.168.1.49:37752","resourcePath":"\/a\/buzzer"},"resourceTypes":["oic.r.buzzer"],"interfaces":["oic.if.baseline"],"mediaTypes":[],"properties":{"id":"buzzer","value":true},"observable":true}

But at the OCF server side, the terminal didn't update the response, it displayed:

BUZZER 2148: Send the response. value:  false
BUZZER 2148: Send the response. value:  false

Normally, it should update the response value to true to make the buzzer work.

Test Environements

Nexus 5 Android 5.0.1
Intel Edison board flashed with Ostro image#510 (iotivity-1.1.1)
SmartHome-Demo#c32b699

v0.7.0 release notes version issue

For v0.7.0, the release notes are confusing:

* Verson 0.7.1

The title says the release version is v0.7.0

* Upgrade cordova plugin dependency to 0.6.1 (because it has Iotivity 1.1.1)

cordova-plugin-ocf v0.6.1 can't be used for building apks. (see issue#3)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.