Device Create API(Device Icon Change)
-
- Posts: 27
- Joined: Thu Feb 17, 2022 4:41 am
Device Create API(Device Icon Change)
I noticed that there is only 4 API for devices like fan, switch, lightbulb and temperature sensor. I went into the cpp and header file and I created a class for a new thing which was a lock. I checked every possible library that could need it and added it. However; Arduino doesn't compiles as it doesn't recognize the ESP32 Dev Module anymore. Don't know why. Is there anyway to do it? Is there any other way for example if I create a custom device that instead of getting a random icon, I could add my own image icon?
-
- Posts: 309
- Joined: Wed Feb 20, 2019 7:02 am
Re: Device Create API(Device Icon Change)
Hello,
Sample code for custom devices can be found here. However, you cannot have custom icons in the phone app, since the phone app sources only support a small set of icons that you can see here. We would have liked to give an option to add own icons without having to re-compile the phone apps, but we have not started any work on that front yet. If you are looking for any specific device type or icon, do let us know.
Sample code for custom devices can be found here. However, you cannot have custom icons in the phone app, since the phone app sources only support a small set of icons that you can see here. We would have liked to give an option to add own icons without having to re-compile the phone apps, but we have not started any work on that front yet. If you are looking for any specific device type or icon, do let us know.
-
- Posts: 27
- Joined: Thu Feb 17, 2022 4:41 am
Re: Device Create API(Device Icon Change)
Yes, I have used that table however for example if I create a lock device it says it doesnt exist. How can I get this done through arduino ide. As I see there is only 4 classes , not all of those in that table. So, If i call the Static Lock my_lock("Lock", NULL) it gives me an error since its not one of those. I even wnet an created a class for the lock but it stills give me the same error. How can I use the lock sample then.
-
- Posts: 309
- Joined: Wed Feb 20, 2019 7:02 am
Re: Device Create API(Device Icon Change)
Hello, you can see that a custom dimmer device has been defined in this example. Have you similarly tried defining a lock, something like this?
Code: Select all
static Device my_device("Lock", "esp.device.lock", NULL);
-
- Posts: 27
- Joined: Thu Feb 17, 2022 4:41 am
Re: Device Create API(Device Icon Change)
Thank you very much now I do get the image icon. One more question, how is it that the paramupdatereport function work in arduino , cuz in esp-idf sample I get it how is done but cannt seem to find the one arduino uses to updates sensors values, not the callback.
-
- Posts: 27
- Joined: Mon Mar 27, 2017 1:09 am
Re: Device Create API(Device Icon Change)
How about this:
my_device.updateAndReportParam("Hours Exercising:", h1);
Note, if you are updating several parameters, you will need to DELAY between calling them, else things choke.
Be sure not to use delay(); , you want a non-blocking timer. I update 3 values and have 200ms between each call.
my_device.updateAndReportParam("Hours Exercising:", h1);
Note, if you are updating several parameters, you will need to DELAY between calling them, else things choke.
Be sure not to use delay(); , you want a non-blocking timer. I update 3 values and have 200ms between each call.
-
- Posts: 27
- Joined: Thu Feb 17, 2022 4:41 am
Re: Device Create API(Device Icon Change)
Thank you very much.
-
- Posts: 309
- Joined: Wed Feb 20, 2019 7:02 am
Re: Device Create API(Device Icon Change)
Another option, if you have the param pointer is to use
Code: Select all
param->updateAndReport(val);
-
- Posts: 27
- Joined: Thu Feb 17, 2022 4:41 am
Who is online
Users browsing this forum: No registered users and 80 guests