How do I always check if the accountant I created arrived at 1 hour and make a rule of three

would it look like then?
the way I put the blocks is correct?

All rooms on the same screen, just as we talked about before, using that form of visible true or false

how ideal would it be? with a single button? how could this be done

Yes, Exactly.

Select LampType,LampPower from lampadas Where Id_comodo = iddocomodo ,that you will get according to the previously chosen room.

What I mentioned was about the fields in your table, to record the time that was turned on and the time that was turned off

an important question before continuing, even my teacher asked me and I was in doubt about what to answer.
the buttons that activate the lamps have this code block (as shown in the image below)
I need to add the command to the URL writing key and the associated field on the website, after that on ESP32 (device that checks the signal from the website and actually turns on the lamp) there must also be the same verification, get the URL Written key and the associated field.
If the lamp is not previously registered in the case let the user register, how would this part look, for example, how would the user add this lamp block of code together with the moment when the user adds the lamp? in the case to send the data to the site.!
edit: what I thought of a solution, but I don’t know if it’s right, so you can correct me if that’s the case.
the site has a fixed url and writing key, what changes is the field to which the lamp will be directed, I would have to “tell” the program that:
when the user registers the first lamp, that lamp would come with this code block and would be linked with the first field of the site, the second to the second, and so on. However, this is theory, I don’t know how or if you could do it here
1|690x317

And before anything, I appreciate the help, it has helped a lot, and I really liked the platform.

1 Like

So, I designed the logic, thinking about automation without the dependency on the api (thingspeak).

How does it work?
Url is the same
Key is the same
What varies is the field.
How is it passed the API?

Each lamp is associated with a field1, field2 (this is what I saw in its blocks). Can you register 50 lamps? 1000? And don’t you use them?(It is not the correct) So, you will always have enough lamps. And is each lamp associated with a field by its sequential number? The ideal is to have 2 blocks only: 1 to turn on and 1 to turn off. The on and off buttons will be created dynamically, according to the number of lamps in the bedroom, living room, kitchen, bathroom 


If the API allows you to do that, yes, do it.

That is exactly what I have quoted.
Url is the same
Key is the same
What varies is the field.
How is it passed the API?

field+number ,
represents the lamp?
field1 = lamp1
field2 = lamp2
fieldN = lampN

If so, create one more field in the database, and include that value in it :+1:. So, when you search for the information on the lamps in bedroom1 (2 lamps for example - lamp9 and lamp10) you will have as a return, field9 and field10.
:point_down:
When you do the Select in the Table, you have in the return the number of records returned (in your system, this number will represent the number of lamps in the room)

:point_down:
In this API , Can you only have 8 rooms? And how will you control N lamps for the N rooms?
Will you just switch to API - 0 and 1?
And will it draw the graph?

hi, with difficulty to create this bank (due to my lack of experience!) but i will try more before i’m just asking you help haha.

it is not that I will only have 8 rooms, it is that the site that uses a free version of it only allows up to 8, in the future if I invest more in the work I will buy the license and then I will have more

to activate a lamp using this same function, if you send 1 it lights up if you send 0 it goes off.
if it were for example a temperature sensor there would be very different, but at the moment to focus on the lamps

I hadn’t thought of a chart because when I started the work, I didn’t know if I would be able to do it on time, I need to be with it almost ready, some 70% completed by the 28th, but what’s missing right now (in the app) is this part from the bank.
Anyway, with a graph you say, some tables showing how much time and expense the lamps have generated?

through the initial configurations, when the user adds a lamp to the room, the buttons will be created automatically, already linked with the fields on the site, is that it?
if it is, the theory I understood well, I’m just having difficulty putting it on the kodular.
have some code example doing this, just like you showed me before

1- The user includes in the database
2- Your app creates a menu - ROOMS - LIVING ROOMS - BATHROOMS - KITCHEN
3- The user chooses a bathroom
4- Your app goes to the database and makes a query in all the bathrooms that exist
5- You create the buttons (with the dynamic component) creating the number of buttons according to the number of records returned from the database. The After Query block returns the number of records.
6 With this number, make a for each from 1 to that number and create the buttons.
7- If it is more than 1 room, you create the buttons with the names of the rooms and when you click on this button (which contains an id that identifies you) make an IF and select the bank to search for the lamps.


Edit

The menus will be assembled according to the number of each bedroom, living room, kitchen, bathroom First screen. put the types of compartments in the house 1- Rooms 2- Rooms 3- Bathroom 
 The user will click on one. With that, make a Select SQL in the database according to the user’s choice. Select from table where type = 3 (bathrooms) Then the return (after query block) will have the number of bathrooms. With this number you set up the other menu 1-bathroom 1 2-bathroom 2 and then do the same thing, only you will do the Select SQL in the lamp table according to the chosen bathroom

hi sorry to bother you again, this part I’m having a hard time, I had never used a dynamic component (from what I saw I should have used it before!).
Ask me a question, I had done it that way (a clickable image, which led to the inside of the room)


which led to the inside of the room) now I have to do the same thing but with the dynamic component, right?

this is what I have in the database, as you have been guiding me, is this point correct?

this part I was studying the sqlite documentation and I believe I understood how to do it, however, I don’t know how to use it here on kodular or what blocks to use, I looked it up in the community (that’s how I learned more about sqlite and found links) but I didn’t understand how will I do so that, after the user selects the room in the settings part, his answer is displayed on the home, in a similar way to what I had already done without the dynamic components.

I know I already asked a lot and for someone with an advanced level these doubts can be very simple, but I’m starting and I want to learn.
So I thank you for your patience and help.

Yes, because theoretically the number of lamps is variable :+1:

:x:Delete → Create Table Campo 
 :x:

Keep that laYout with the icons. :+1:When the user clicks on an icon, switch to an id variable (1 - bedroom, 2 - bathroom, 3 - kitchen, 4 - living room). Remember that these values ​​are the same as the values ​​in the Idcomodo (field) on table comodos, OK, You understood ? :+1: Because it is this value that will be placed in the clause where idcomodo and will do a filtering in the lamps table. If they are not the same, LOGIC ERROR will occur, the user will click on the kitchen and bring the lamps from the room (for example)

:+1:
I am helping you because you have shown your great effort in wanting to learn.
And I see that you are learning.
And, unlike many, it did not ask for AIA or ready block