sroebert / ikea-desk-control

MIT License
12 stars 2 forks source link

docs needed :) #7

Open lukasz-bielinski opened 3 years ago

lukasz-bielinski commented 3 years ago

Hi @sroebert could you please show how to run this software? :)

sroebert commented 3 years ago

This is a hobby project for which I unfortunately don't have enough time to document properly. I just wanted to put it out there for people to use in their own hobby projects.

What you will need to start it is npm install and npm start. For it to work you will need a configuration file data/config.json, which looks like this:

{
    "deskAddress": "12-34-56-78-90-ab",
    "deskPositionOffset": 62,
    "deskPositionMax": 65,
    "mqttUrl": "mqtt://192.168.1.123",
    "mqttUsername": "username",
    "mqttPassword": "password"
}

Before it is run, the machine you are running it, should have already been paired once with the desk. When run it will publish the desk position and speed to MQTT at ikea-desk-control/desk-address/status.

You can find the commands you can send using MQTT to ikea-desk-control/desk-address/command at the bottom of https://github.com/sroebert/ikea-desk-control/blob/master/src/desk-manager.js. For example, sending a number between deskPositionOffset and deskPositionOffset + deskPositionMax will set the height of the desk.

Hopefully this will help you enough to get started.

rmervine commented 3 years ago

@sroebert

Thank you for getting this info together.With almost no knowledge, I was able to get my device paired and subscribed to the MQTT topic. And I will put more details in this post for someone starting out new. While I can view the device perfectly, I'm having issues with getting the desk to move. I followed what you put in here for subscribing to the topic ikea-desk-control/desk-address/command

At first, I misunderstood desk-address to where I originally used desk-address. However, I then realized when looking through MQTT Explorer that it was desk-"My MAC". However, I can't quite get it to work. I wasn't sure if the word "command" was literally in there or the word command. I tried so many variants here when comparing your JS file:

Screen Shot 2021-09-04 at 6 33 29 PM

And I set my offset and position max like this: "deskPositionOffset": 62, "deskPositionMax": 160,

If you can help me with an exact mqtt publish topic here, that would be greatly appreciated.

sroebert commented 2 years ago

Sorry for the late reply as I missed this. You need to publish to ikea-desk-control/desk-CA:45:74:C1:A7:7E/command. You can use:

sroebert commented 2 years ago

I have actually rewritten this project in Swift for the Mac (for if you could run it on a Mac). I am using a different way of sending the Bluetooth commands, which make the positioning perfectly accurate, compared to the method used in this repo. (https://github.com/sroebert/IKEADeskControl)