nick-less / sonoff-4ch-homekit

sonoff 4ch homekit firmware, based on esp-home-demo
8 stars 4 forks source link

Type of device #2

Open daueee opened 5 years ago

daueee commented 5 years ago

Is there any option to change the type of device ? Like (fan, light, switch, door sensor)

nick-less commented 5 years ago

as far as I know the assessory type can't be changed once device is paired, so this has to be done either at compile time or prior to pairing the device using some kind of setup function. For now you'll have to change the type by yourself (starting around line 247 in main.c) and build your own version

daueee commented 5 years ago

Hi dear! I will be honest, I'm just a curious I've tried to compile the same code many times and I couldn't do that. A lot of erros 😅😅😅. I tried using Eclipse, do you recommend any material? May a try again. If you have interest, you can change the type and compile again, I can support you on PayPal.

nick-less commented 5 years ago

The most obvious way of compiling the firmware would be using the supplied Dockerfile, which will build you a docker image containing the required cross compiler and the homekit libraries by maximkulkin. You would just install Docker, checkout the project, goto the project directory and type "docker build --tag=cross/esp8266 ." and wait for the dockerfile to finish building. After that you can run "docker run -v "$(pwd)"/src/:/home/sdkbuilder/esp-homekit/src -it cross/esp8266" which will build you the firmware. But, even if you change the service type from SWITCH to LIGHTBULB, the sonoff 4ch will still be just four switches as it doesn't have the capabilities to control brightness like a lightbulb device..

daueee commented 5 years ago

Thank you! I will try your tips. In fact I would like to change to door sensor!!

daueee commented 5 years ago

@nick-less Could you help again? I've installed Docker and create an account ( I never used before). So a create a repository "esp8266" and the a changed your command to build a docker container. I run the command docker login before try to build ( I'm using Windows) , then I navigate to my patch(where dockfile is locate ) C:\Sonoff >docker build --tag=daueee/esp8266 The process was finished successful.

But on the end of the dockfile we have:

now we have anything to build an open-rtos homekit firmware CMD["/bin/sh","-c", "make -j4 -C src"] - "Should I chage it?"

Should I chage it?

build docker build --tag=daueee/esp8266 . run docker run -v <localpath:<containerpath -it daueee/esp8266

Should I change like : docker run -v <c:\Sonoff : -it daueee/esp8266" ?

And you give a differet command here

"docker run -v "$(pwd)"/src/:/home/sdkbuilder/esp-homekit/src -it cross/esp8266"

I'm really new on this, I read many of artclies but I dindt get sucess. May you can recommend sometime?

daueee commented 5 years ago

I moved to Ubuntu but I didnt got sucess yet. OMG

nick-less commented 5 years ago

@nick-less Could you help again? I've installed Docker and create an account ( I never used before). So a create a repository "esp8266" and the a changed your command to build a docker container. I run the command docker login before try to build ( I'm using Windows) , then I navigate to my patch(where dockfile is locate ) C:\Sonoff >docker build --tag=daueee/esp8266 The process was finished successful.

But on the end of the dockfile we have:

now we have anything to build an open-rtos homekit firmware CMD["/bin/sh","-c", "make -j4 -C src"] - "Should I chage it?"

Should I chage it?

build docker build --tag=daueee/esp8266 . run docker run -v <localpath:<containerpath -it daueee/esp8266

Should I change like : docker run -v <c:\Sonoff : -it daueee/esp8266" ?

And you give a differet command here

"docker run -v "$(pwd)"/src/:/home/sdkbuilder/esp-homekit/src -it cross/esp8266"

I'm really new on this, I read many of artclies but I dindt get sucess. May you can recommend sometime?

@nick-less Could you help again? I've installed Docker and create an account ( I never used before). So a create a repository "esp8266" and the a changed your command to build a docker container. I run the command docker login before try to build ( I'm using Windows) , then I navigate to my patch(where dockfile is locate ) C:\Sonoff >docker build --tag=daueee/esp8266 The process was finished successful.

But on the end of the dockfile we have:

now we have anything to build an open-rtos homekit firmware CMD["/bin/sh","-c", "make -j4 -C src"] - "Should I chage it?"

Should I chage it?

No, thats the command being run when you start the docker image

build docker build --tag=daueee/esp8266 . run docker run -v <localpath:<containerpath -it daueee/esp8266

Should I change like : docker run -v <c:\Sonoff : -it daueee/esp8266" ? the format is: -v localdirectory:containerdirectory so you would run docker run -v "c:\Sonoff:/home/sdkbuilder/esp-homekit/src -it daueee/esp8266"

which mounts your local directory c:\Sonoff inside the container as /home/sdkbuilder/esp-homekit/src, where the makefile expects it.

your error was to remove the container directory, your not about to change this, only your local directory should be changed (if at all..)

And you give a differet command here

"docker run -v "$(pwd)"/src/:/home/sdkbuilder/esp-homekit/src -it cross/esp8266"

this command was ment to be run from the directory where you placed the checked out project, it passes the "src" directory inside the current directory as location where the source is expected by the makefile. I've used $(pwd) so it doesn't matter where you checked you the project.