sorry I want to know how can I have access to mozilla webthings gateway database? I want to understand how did you save the rules that users create, in database
The DB is based on SQL Lite. There are several free SQL Lite database tools that can open/edit this type of DB. I did it a year ago when playing with stuff using the free “SQLite Browser” tool. From a previous thread, the DB should be here: ~/.mozilla-iot/config/db.sqlite3
The new location is
thank you,I’ve installed sqlite browser on my PC,but where should I insert the location (
~/.webthings/config/db.sqlite3)to find it and see the database and its tables?
I want to see the scenarios table to understand how you save scenarios in DB
in which of below areas should I insert this address (
~/.webthings/config/db.sqlite3)to see the DB???
I am not familiar with the screen method and assume the GW does not provide this capbility anyway.
If your GW is on the same computer system, just open the database using the Open Database menu and select the physical file.
If your GW is on another computer you can either: copy the db to your local computer running the SQLLite browser OR remotely mount the ~mozilla folder on your local computer. The later option is what I do on my RPI after creating a Samba share for the ~mozilla folder. I can easily mount ~mozilla on any of my computers, perform addon development, review log files, and of course inspect the DB (which is not really interesting at the end of the day )
thanks a lot,I could open the DB and saw the tables.
where can I find the code of saving Rules in rules table?
I wana understand the logic and method you used for saving rules as meaningful texts in rules table.
If you explain what you’re trying to achieve we might be able to help.
I’m writing a web server on windows with C# . In my Rules page I want to save each rule as text like yours, but in fact the texts must be parametric so that I can analyze each rule when reading them from DB.
My problem is how to store each rule in the database so that I can check their text to see if the rule is true to run or not.
I want to know your logic when storing each rule in the database and to understand how you analyze the text you save for each rule when reading the rule table.
Ah OK, well hopefully the source code in https://github.com/WebThingsIO/gateway/tree/master/src/rules-engine will give you an idea of how the rules are modeled as collections of “triggers” and “effects”.
It seems hard and complicated to convert it to c#,I hope I can do that.
The next thing I want to do is this:
the user must be able to put parentheses around any number of items from his condition. For example, if (lights one and two are on) or (lights 2 and 4 are off) then …
could you help me and guide me how to do this?how can I extract and analyse the rules with the parentheses around them?how to store rules with parentheses in DB and check the rule?!
mozilla Gateway doesn’t have this option,but I want to add it in my webserver.