Giter Site home page Giter Site logo

Comments (37)

JorisM avatar JorisM commented on May 27, 2024

Thanks for your feedback.

Did you try to set the url in the settings page? The icon is on the top right and please note that if your heimcontrol instance is running on something else than port 80, you need to specifiy the port in the url, for example: http://heimcontrol:8080/

from heimdroid.

beniroquai avatar beniroquai commented on May 27, 2024

Yep! I've tried the DynDns URL as well as the local network URL. Same URL and credentials are working over the browser though..
It's in the form http://mydomain.dyndns.org:8080/, then [email protected] and a password which contains signs like ?!ยง$).. Icannot see any errors in the adb console. The Error is comming in the same moment, when pressing the button connect. I think its not even checking, that the server is availiable..

The adb logs are pointing to something like
01-24 11:13:54.164: D/alsa_ucm(859): Setting mixer control: RX3 MIX1 INP2, value: ZERO
01-24 11:13:54.164: D/alsa_ucm(859): Setting mixer control: LINEOUT1 Volume, value: 0
01-24 11:13:54.164: D/alsa_ucm(859): Setting mixer control: SLIM TX3 MUX, value: ZERO
01-24 11:13:54.174: D/alsa_ucm(859): Setting mixer control: SLIM TX5 MUX, value: ZERO
....

Thanks

from heimdroid.

JorisM avatar JorisM commented on May 27, 2024

Do you have the newest version of heimcontroljs? We only just recently added the API support, so if you have an older version there won't be an api endpoint.

from heimdroid.

beniroquai avatar beniroquai commented on May 27, 2024

Installed the app and heimcontrol.js just yesterday. How could I update?

from heimdroid.

JorisM avatar JorisM commented on May 27, 2024

If you pulled from github then you will have the newest version ๐Ÿ‘

Can you try to make a post request in the terminal like:
curl -d '{"email":"[email protected]","password":"your_password"}' http://yoururl/api/login --header "Content-Type:application/json"

and tell me what you get back?
The answer should look similar to this:
{ "token": "your_token_is_here" }

from heimdroid.

beniroquai avatar beniroquai commented on May 27, 2024

Thank you for this excellent support. Maybe wrong version which is installed? Getting this code:

SyntaxError: Unexpected token }
at Object.parse (native)
at /home/pi/heimcontrol.js/node_modules/connect/lib/middleware/json.js:75:25
at IncomingMessage.onEnd (/home/pi/heimcontrol.js/node_modules/connect/node_modules/raw-body/index.js:109:7)
at IncomingMessage.g (events.js:175:14)
at IncomingMessage.EventEmitter.emit (events.js:92:17)
at _stream_readable.js:883:14
at process._tickCallback (node.js:415:13)curl: (6) Couldn't resolve host 'api'

from heimdroid.

JorisM avatar JorisM commented on May 27, 2024

Check whether in the heimcontrol.js file (in your local heimcontrol js repo) around line 147 you find this route:
app.post('/api/login', Routes.createAuthToken);

If you don't have this route you have a wrong version of heimcontroljs.

from heimdroid.

beniroquai avatar beniroquai commented on May 27, 2024

Thank you ver much again! I checked and decided to reinstall heimcontrol.js.. I'll get back. By the way. Is there a chance to push a http-request directly to the Pi? I opened an issue for this. I would like to switch a rc-socket by an url or so. Do you know if this is possible?

from heimdroid.

JorisM avatar JorisM commented on May 27, 2024

I don't think heimcontrol supports this yet, although I think one could pretty easily add that. I don't have an rc socket that I could try it out with, but I might have some time next week to look into it (if you can wait that long ;)). If you feel like you could do it on your own, I could give you some tips to point you in the right direction on how to implement it. Once it's implemented in heimcontrol, I think I could pretty easily add the functionality to the heimdroid app.

from heimdroid.

beniroquai avatar beniroquai commented on May 27, 2024

I would love to try, but I'm not the kind of programmer. More consumer ;)..

Checked the file:
sudo nano ~/heimcontrol.js

Around Line 147
app.post('/api/login', Routes.createAuthToken);

Seems to be correct!

Another Issue:
After a post somewhere in a forum I added this: (or else I will get the error: "events.js:2817: Uncaught Error: Cannot open /dev/")โ€จ
sudo nano ~/heimcontrol.js/node_modules/duino/lib/board.js
search around line 75 for 'ls /dev | grep ACM' or similar and change it to:โ€จ'ls /dev | grep -e usb -e USB -e ACM'

Same again, Browser is working, App not. Seems API is missing. Wonder why?!

from heimdroid.

JorisM avatar JorisM commented on May 27, 2024

Alright, did you check for this line app.post('/api/login', Routes.createAuthToken); though in heimcontrol.js? Try the curl request again

I will look into the rx socket feature when I have some spare time.

from heimdroid.

beniroquai avatar beniroquai commented on May 27, 2024

Hm. I'm getting a Token now. So thats alright. But App..Still not working.
I did the following:
1.)Settings-> URL: http://myname.dyndns.org:8080/ (also tried without /)
2.)Login: [email protected]
3.)Password: MyPW

Still Error 0 :D.. Sorry dude..

I think there is no connection to the network..although my phone is connected to it. How can I check it?

from heimdroid.

JorisM avatar JorisM commented on May 27, 2024

Alright, getting a token is a good sign:)
If you can access heimcontrol through your browser on your phone the app should work as well.

from heimdroid.

beniroquai avatar beniroquai commented on May 27, 2024

I'm sorry. I tried everything. Token is there, browser access works, but the app still doesnt sign in. Is there a problem in Android 4.3 or so? Server Adress is 100 % correct, Credentials as well. Reinstalled the app, still no success. Is there a permission missing?

from heimdroid.

JorisM avatar JorisM commented on May 27, 2024

I actually run 4.3 myself, and I have tried it on 4.2 and 4.4 on other phones as well, it seems to work fine, although I've never tried it with dynds but a direct ip instead and always connected to the wifi on the same network. I think you might be running into some problem with your router firewall or the firewall of the host you are running heimcontrol on. Are you running heimcontrol on a raspberry? What linux distribution?

from heimdroid.

beniroquai avatar beniroquai commented on May 27, 2024

Hi. I really tried everything. Even enterring a random URL. The Error comes in the exact same moment. I will attache some screenshots of my nexus 7 which runs on cyanogen (perhaps thats the issue here?)

screenshot_2014-01-25-11-09-58
screenshot_2014-01-25-11-10-49
screenshot_2014-01-25-11-12-01
screenshot_2014-01-25-11-12-08

Sorry, I think it's a problem with my devices. Bummer ;)

from heimdroid.

JorisM avatar JorisM commented on May 27, 2024

Thanks for the screenshots, they help. I assume you tried to add a / at the end of the url, so ...8080/.

In the terminal window where you started heimconroljs with node, what does it print out the moment you hit the button?

Lastly, one thing you could try to do is change your heimcontrol instance to port 80 and try again without a port.

Bear with me, i still hope to figure out where the problem is.

from heimdroid.

JorisM avatar JorisM commented on May 27, 2024

Ps: i run the pacman mod myself, so the mod shouldnt be a problem

from heimdroid.

beniroquai avatar beniroquai commented on May 27, 2024

Well, actually I don't know how to change the port. I'm also running a small apache websever on port 80.. NATTING the port in the router doesnt help? I hope Apache, doesn't interfer with the API? Yes, I tried with and witout the :8080/

What do you mean by printing out when hitting the button? The Login-button in the App? Terminal-Windows stays the same. Can I get a logfile from the app? In Logcat I can't see any errors..
When I type the curl .. then the Terminal-Windows says "POST /api/login 200 139ms - 81b" so API is working.

from heimdroid.

JorisM avatar JorisM commented on May 27, 2024

You started heimcontrol with node heimcontrol.js. Afther you saw a screen where it gave you the /dev/ access denied error. That terminal session will log any requests going into heimcontroljs. If you hit the log in button, or go onto the heimcontrol webpage you should see every request being made (and errors if there are any).

from heimdroid.

beniroquai avatar beniroquai commented on May 27, 2024

I tried the Terminal-thing, but as I described whithout any success. When I log in via the browser and via the "curl", that it gives me a feedback, but when I try to login with the app, there is nothing, no GET/POST message from the APP

I also tried another port (80), but there is no server-ping I guess..Hm. Well. Anyway. Never mind! ;)

from heimdroid.

JorisM avatar JorisM commented on May 27, 2024

I'm going to close this for now, I'll let you know when I figure out what the problem might be.

from heimdroid.

beniroquai avatar beniroquai commented on May 27, 2024

Hi. Just wanted to get back. I completely reinstalled everything, but still doesn't work ;)..
In Addition: I had the idea to get a http-request to control a state. Like https://blalba/switch1_on.php or something. Right now it's not secure, because it's just a php-exec which calls duino. Do you have any clue how to do this with the API? Together with email and password though? I'm using tasker for this. So, when I'm entering my flat. Music is already running :D

from heimdroid.

JorisM avatar JorisM commented on May 27, 2024

With the token you get, you can send a socket event called gpio-toggle to the server to changes the toggle state. Use the token from the api as the auth token and find a socket library to make the request. Check out the heimcontrol docs to figure out which fields to pass (I think it's value (1 or 0 depending whether you want to turn it on or off) and id for which toggle you want to trigger).

from heimdroid.

beniroquai avatar beniroquai commented on May 27, 2024

Oh. Man you're fast ;).. I looked it up as you said. But honestly I don't really know how to start this (I've hardly knowledge of Javascript or Node.js). If you have some spare time, could you feed me with the right keywords I've to search for on google?

Do I need to write a script and place it on the webserver or can I call the heimcontrol.js app directly with an URL which contains the information of the token and GPIO on/off?

The passage you told me says the following:

/**

  • Parse GPIO the ports that are used as input and send the result to the client websocket
    *
  • @method parse
    */
    Gpio.prototype.parse = function() {
    var that = this;
    if (that.app.get('clients').length > 0) {
    that.app.get('db').collection(this.collection, function(err, collection) {
    collection.find({
    direction: 'input'
    }).toArray(function(err, result) {
    result.forEach(function(item) {
    gpio.setDirection(parseInt(item.pin), "input", function(err) {
    gpio.read(parseInt(item.pin), function(err, value) {
    if (!err) {
    that.values[item._id] = value;
    that.app.get('sockets').emit('gpio-input', {
    id: item._id,
    value: value
    });
    }
    });
    });
    });
    });
    });
    }
    };

/**

  • Manipulate the items array before render
    *
  • @method beforeRender
  • @param {Array} items An array containing the items to be rendered
  • @param {Function} callback The callback method to execute after manipulation
  • @param {String} callback.err null if no error occured, otherwise the error
  • @param {Object} callback.result The manipulated items
    */
    Gpio.prototype.beforeRender = function(items, callback) {
    var that = this;
    items.forEach(function(item) {
    item.value = that.values[item._id] ? that.values[item._id] : 0;
    });
    return callback(null, items);
    };

/**

  • API functions of the GPIO Plugin
    *
  • @method api
  • @param {Object} req The request
  • @param {Object} res The response
    */

Gpio.prototype.api = function(req, res, next) {
/*

  • GET
    */
    if (req.method == 'GET') {
    this.app.get('db').collection(this.collection, function(err, collection) {
    collection.find({}).toArray(function(err, items) {
    if (!err) {
    res.send(200, items);
    } else {
    res.send(500, '[]');
    }
    });
    });
    } else {
    next();
    }
    };

var exports = Gpio;

return exports;

});

found here: http://ni-c.github.io/heimcontrol.js/api/files/plugins_gpio_index.js.html#l114

Thank you very much! :)

from heimdroid.

JorisM avatar JorisM commented on May 27, 2024

I think it would be much easier to get the app working than try to implement something yourself with socket. Sockets can be somewhat tricky to work with. I've been kind of busy with work, but I will try a dyndns setup as soon as possible to figure out what your problem might have to do with. I'm guessing it's a firewall or selinux issue, hard to tell.

from heimdroid.

p33k avatar p33k commented on May 27, 2024

I have the same problem. Just installed the latest heimcontrol.js on my new raspberry pi and set everything up.
Connecting via PC, Laptop, Smartphones, Tablets all works with the browser but with the app (apk from your homepage) I get the error 0.
set the raspberry pi IP in the options: http://192.168.2.10:8080 and tried even with different users, but I always directly get the error 0.
On my PI console with heimcontrol running I see no reaction.

What firewall could be a problem? I don't have a firewall active on my smartphone and router firewall should be no problem? Is there a firewall on the raspberry pi with raspberian that could be a problem?

from heimdroid.

JorisM avatar JorisM commented on May 27, 2024

Alright, I think I might have found the bug.

Can one of you try to install version 0.1.2 (newest link) and report back please?

from heimdroid.

p33k avatar p33k commented on May 27, 2024

http://jorism.github.io/Heimdroid/app/heimdroid.apk
is this the current version? I download it and install it directly on my phone.
Android app settings shows me version 0.1.2.
The error 0 is still there with that version.
Furthermore, if I type in 192.168.2.10:8080 without the http:// the app crashes.

from heimdroid.

JorisM avatar JorisM commented on May 27, 2024

0.1.2 is the correct version. does the app have full network access?
screenshot_2014-02-13-19-00-46

from heimdroid.

p33k avatar p33k commented on May 27, 2024

correction: with my android tablet the login worked immediately with the use of alias instead of IP
http://homecontrol:8080
Then after some trying it works on my smartphone too?!?!
Edit: and now it even works with the IP.
But now I have another problem after login it goes to a screen with the headline "Switches" on top but the the rest is white.

I currently use webcam, RGB, and Arduino modules on the home screen of heimcontrol

screenshot_2014-02-13-22-06-50

from heimdroid.

beniroquai avatar beniroquai commented on May 27, 2024

Same here. Although i use switches. But great for the solution to login
Am 13.02.2014 22:05 schrieb "p33k" [email protected]:

correction: with my android tablet the login worked immediately with the
use of alias instead of IP
http://homecontrol:8080

Then after some trying it works on my smartphone too?!?!

But now I have another problem after login it goes to a screen with the
headline "Switches" on top but the the rest is white.

I currently use webcam, RGB, and Arduino modules on the home screen of
heimcontrol

Reply to this email directly or view it on GitHubhttps://github.com//issues/3#issuecomment-35025729
.

from heimdroid.

p33k avatar p33k commented on May 27, 2024

Third correction: my mistake, heimdroid currently only supports GPOI switches?
Added some for test reasons, that works!

screenshot_2014-02-13-22-25-17

Is webcam, arduino, etc support planned? Or would I have to try to do it on my own?

from heimdroid.

JorisM avatar JorisM commented on May 27, 2024

Alright, thank you very much for your help!

I only use the GPIO toggles, so far I didn't have a reason for implementing any other features.
I was planning on adding other modules as well, which one would be the most useful for you right now?

from heimdroid.

beniroquai avatar beniroquai commented on May 27, 2024

Awesome work mate. Rcswitch for duino would be perfekt <3
Am 14.02.2014 09:06 schrieb "Joris" [email protected]:

Alright, thank you very much for your help!

I only use the GPIO toggles, so far I didn't have a reason for
implementing any other features.
I was planning on adding other modules as well, which one would be the
most useful for you right now?

Reply to this email directly or view it on GitHubhttps://github.com//issues/3#issuecomment-35063728
.

from heimdroid.

beniroquai avatar beniroquai commented on May 27, 2024

I don't know if anybody saw it. But power consumption of the app seems very high although the Phone is in Standby.

from heimdroid.

JorisM avatar JorisM commented on May 27, 2024

This is because the socket is always open even in standy. I can add a feature to turn this off and only reconnect when the app is resumed. Can you please open an issue for this? Thanks

from heimdroid.

Related Issues (10)

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.