Custom Device Icon and Icon status change

Ifthekhar
Posts: 13
Joined: Mon Mar 29, 2021 1:10 pm

Custom Device Icon and Icon status change

Postby Ifthekhar » Mon Apr 12, 2021 10:16 am

Hello Everyone,
I was wondering if there is a way to add a custom icon or image to an existing device or a custom device. For example, if I create a device, that is supposed to read a push button status from an I/O pin and also has to turn ON or OFF a LED based on the button status, I want to have a LED icon on my esp rainmaker app (not the predefined lightbulb icon) for my device to show the LED status.

Secondly, is it also possible to change the icon color based on the LED status (e.g. For OFF state no color for ON state Green)

In some previous ESP32 projects I created a small webserver inside the ESP32, in that case, I edited the HTML file and linked a small image from the project's content directory or used an icon from the web and just added the link of that icon on the HTML file.

I am not sure whether I need to add a custom png file to one of the folders in the main project directory to perform that operation because it looks like the rainmaker app actually selects the icon of the device from the android app side not from the uploaded code (please correct me if I'm wrong).

Best Regards.

ESP_Piyush
Posts: 307
Joined: Wed Feb 20, 2019 7:02 am

Re: Custom Device Icon and Icon status change

Postby ESP_Piyush » Fri Apr 16, 2021 6:11 pm

Hello,

In the workflow you mentioned, since your browser was fetching images directly from the firmware, this was quite easily possible. However, in case of RainMaker, the device can only indicate the ui-type for a given parameter, which has a limited number of options right now. We have received quite some feature requests for additional UI options on GitHub which you can find here, here and here. However, now that you mention, I think there could be even more options like say, you being able to replace the default image by giving a url to your phone app, or the device itself giving a url at which the image can be found, or may be add some framework wherein people can contribute their images and corresponding "ui-type" string so that the phone apps can directly map to it. We will evaluate such options in future and try to get them in.

Ifthekhar
Posts: 13
Joined: Mon Mar 29, 2021 1:10 pm

Re: Custom Device Icon and Icon status change

Postby Ifthekhar » Mon Apr 19, 2021 7:31 am

Hello Piyush,
Thank you for your reply. Is the android app for the ESP RainMaker, Opensource? Then do you think that I can add some custom icon there directly? At least for now that can be one solution for me. If that is possible then I would really appreciate it if you can send me the git link for it.

I am still not sure about the directory where I would need to put the custom icons or how to compile an apk file after that, and how to link it to the "app_driver.c" and "app_main.c" script but I can give it a try :)

Best Regards,
Ifthekhar

ESP_Piyush
Posts: 307
Joined: Wed Feb 20, 2019 7:02 am

Re: Custom Device Icon and Icon status change

Postby ESP_Piyush » Mon Apr 19, 2021 10:36 am

Hi Ifthekar,

Pointers for RainMaker phone app sources: Android, iOS.

Meanwhile, here is one additional pointer which has other useful links as well.

Do let us know if you get stuck anywhere while trying this out.

Regards,
Piyush

fpga3000
Posts: 1
Joined: Sun May 02, 2021 6:28 am

Re: Custom Device Icon and Icon status change

Postby fpga3000 » Sun May 02, 2021 6:48 am

Ifthekhar wrote:
Mon Apr 19, 2021 7:31 am
Hello Piyush,
Then do you think that I can add some custom icon there directly? At least for now that can be one solution for me. If that is possible then I would really appreciate it if you can send me the git link for it.
I guess it is this lightbulb you want to replace.

Ifthekhar
Posts: 13
Joined: Mon Mar 29, 2021 1:10 pm

Re: Custom Device Icon and Icon status change

Postby Ifthekhar » Thu May 06, 2021 11:34 am

Thank you all, but I am now facing another issue. I have installed the Android Studio. But when I tried to build it, it showed me this error:

Code: Select all

> Process 'command 'git'' finished with non-zero exit value 128
I have found a solution online:
https://stackoverflow.com/questions/350 ... 8/48090325

I just needed to add 'cmd' to the 7th line of the "build.gradle" file:

Code: Select all

commandLine 'cmd', 'git', 'rev-parse', '--short', 'HEAD'
Then if I go to Buid>Rebuild Project, it shows me 42 errors in the "buildConfig.java" file:

Code: Select all

failed
API 'variant.getJavaCompile()' is obsolete and has been replaced with 'variant.getJavaCompileProvider()'.
:app:compileDebugJavaWithJavac
app/build/generated/source/buildConfig/debug/com/espressif/rainmaker/BuildConfig.java
unclosed string literal
illegal start of type
';' expected
';' expected
';' expected
<identifier> expected
illegal character: '\'
illegal character: '\'
illegal start of type
';' expected
illegal character: '\'
illegal character: '\'
illegal start of type
';' expected
illegal start of type
';' expected
invalid method declaration; return type required
illegal start of type
illegal character: '\'
illegal character: '\'
unclosed string literal
unclosed string literal
illegal start of type
';' expected
';' expected
';' expected
<identifier> expected
illegal character: '\'
illegal character: '\'
illegal start of type
';' expected
illegal character: '\'
illegal character: '\'
illegal start of type
';' expected
illegal start of type
';' expected
invalid method declaration; return type required
illegal start of type
illegal character: '\'
illegal character: '\'
unclosed string literal

I am not sure whether I am doing it the wrong way, so please correct me if I wrong.

it looks like the errors are between lines 11 to 14 and 32 to 35. I tried to make them one single line (11 to 14) as line 11 starts with
"2.2.4
and line 14 ends with
app>";
So it felt like it should be a single line. but it did not solve the issue. I tried a bunch of other stuff later on but nothing seems to solve the issue. Maybe it's a silly error and my naive eyes are just missing it. Any suggestion on how to solve this issue?

ESP_Piyush
Posts: 307
Joined: Wed Feb 20, 2019 7:02 am

Re: Custom Device Icon and Icon status change

Postby ESP_Piyush » Mon May 17, 2021 5:10 pm

Hello,

Have you downloaded the esp-rainmaker-android as a zip file or using git clone? It is recommended to use git clone.

Regards,
Piyush

Ifthekhar
Posts: 13
Joined: Mon Mar 29, 2021 1:10 pm

Re: Custom Device Icon and Icon status change

Postby Ifthekhar » Tue May 18, 2021 2:53 pm

Hello Piyush,
I think that was the mistake. Now I have downloaded it through git clone and it's compiling just fine.

Thank you.

Best Regards,
Ifthekhar

Who is online

Users browsing this forum: No registered users and 10 guests