Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some Babysitting #26

Open
N2641D opened this issue Mar 14, 2019 · 8 comments
Open

Some Babysitting #26

N2641D opened this issue Mar 14, 2019 · 8 comments

Comments

@N2641D
Copy link

N2641D commented Mar 14, 2019

I have found this project most recently and installed the software on my PI3. Everything looks great and I have started to play with the WebAPI. As I'm not an experienced programmer, could anybody please give me some babysitting for my experiments?

I figured out to e.g. close a shutter by: http://myIP:8080/set/shutter/ABB700D307C4/ch0003/down

What I'm unable to find right now are commands like:

  • set shutter to 75%
  • get actual shutter position
  • start a scene e.g. "allShutterWestDown"

I know about openHAB, however, it just makes fun to play a bit with this software.

Thank you.

Wilfried

@sstadlberger
Copy link
Owner

Shutter are currently not supported. Here are all available shutter commands:

  • up
  • down
  • toggle-up
  • toggle-down
  • pulse-up
  • pulse-down
  • stop

You should be able to get the position with http://myIP:8080/info/ABBXXXXXXXXXX/[channel optional]/[datapoint optional]

You can activate a scene with http://myIP:8080/set/scene/SCENEID/ch0000/set
(I'm not sure about ch0000, you might also want to try other channels).

You can get the information about all objects with http://myIP:8080/info

@N2641D
Copy link
Author

N2641D commented Mar 14, 2019

Wow - That was quick. Many thanks for your prompt help!

Wilfried

@henry-spanka
Copy link
Contributor

henry-spanka commented Mar 18, 2019

You can relatively easy set the shutter to a specific position manually with a little code.

You need the following datapoints:

  • odp0001 (Current Position in percent)
  • pm0000 (Time the shutter needs for opening)
  • pm0001 (Time the shutter needs for closing)

Then you can calculate the relative percentage based on the current position and move the shutter up or down for a specific amount of time. If you do the calculation correct the position error should be small (about 5%).

I have this implemented in my own project. You can try to implement it in your own if you like to.
https://github.com/henry-spanka/homebridge-buschjaeger/blob/ee86494ecdaed943aeee23c60036caebac848664/lib/BuschJaegerJalousieAccessory.js#L51

@N2641D
Copy link
Author

N2641D commented Mar 19, 2019

Hi Henry:
Thank you for your thoughts and the link to your project. As a first step, I actually implemented such a process. I created a script, which read the time to get each roller shutter from "open" to "close" position (ch0003/pm0001). As a next step that script executed a loop "for x = 1 to pm0001" as:
- open roller shutter
- send close command
- after "x" seconds, send stopp command
- request roller-shutter position (ch0003/odp0001)
I used that table to interpolate between the integer numbers and were within a range of 2% accurate.

Then I received a very valuable comment from Lasse Magnussen. In order to position a roller-shutter to a certain percentage, I inserted into Stefan's "sysap-external.js" (about line 67-73; shutter actions block) the line: 'set' : { 'idp0002' : value } (see ruebox/openhab2-addons#21 (comment)).

I now can send directly the command "http://myIP:myPort/set/shutter/ABB700C9AB60/ch0003/set/77" to move the roller-shutter to 77%.

My intention is to ask Stefan for permission to using that change for private use only. I hope you might find that information helpful as well.

Wilfried

@henry-spanka
Copy link
Contributor

henry-spanka commented Mar 19, 2019

Cool, seems I missed that. Will try to implement that in my own project as it's way better than an approximation using timeouts.

You can also set a datapoint without modifying the API directly. Try http://myIP:myPort/raw/ABBXXXXX/chXXXX/dpXXXX/77

@N2641D
Copy link
Author

N2641D commented Mar 28, 2019 via email

@Alex2612
Copy link

Hi all,
having trouble to get the project running:

SyntaxError: Invalid or unexpected token
at Module._compile (internal/modules/cjs/loader.js:703:23)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:770:10)
at Module.load (internal/modules/cjs/loader.js:628:32)
at Function.Module._load (internal/modules/cjs/loader.js:555:12)
at Module.require (internal/modules/cjs/loader.js:666:19)
at require (internal/modules/cjs/helpers.js:16:16)
at Object. (/home/pi/myhome/home/lib/freeathome/index.js:8:14)
at Module._compile (internal/modules/cjs/loader.js:759:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:770:10)
at Module.load (internal/modules/cjs/loader.js:628:32)

Pasted the JID, SysAP IP and Password to config.js (config.bosh & config.websocket) and tried "node home.js"

@sstadlberger
Copy link
Owner

Hi,

a couple of questions: Did you make a copy of config.default.js and renamed it to config.js? If so can you please post a redacted (no passwords etc.) copy of your config.js? It looks like it may contain a typo.

Cheers,
Stefan

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants