Announcement

Collapse
No announcement yet.

Is possible to read from mysql and put the value in a device

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Is possible to read from mysql and put the value in a device

    I do not think I saw a post which someone took a value from a sql database (MySQL) and put the value in a device, is this possible?

    #2
    Yes, HS3 scripting uses the full .net framework so any example on the web to connect to a SQL SB and query a value should work just fine in HS3.
    💁‍♂️ Support & Customer Service 🙋‍♂️ Sales Questions 🛒 Shop HomeSeer Products

    Comment


      #3
      The script at the bottom of my blog post will show you how to retrieve data from MySQL and store it in a virtual device.
      https://www.rutg3r.com/gps-data-traccar-homeseer/

      Comment


        #4
        Originally posted by Rutger View Post
        The script at the bottom of my blog post will show you how to retrieve data from MySQL and store it in a virtual device.
        https://www.rutg3r.com/gps-data-traccar-homeseer/
        Thank you, this board is super cool and the community here are the best I know.

        Thanks,
        Aldo

        Sent from my SM-G935V using Tapatalk

        Comment


          #5
          It worked like a charm, thank you for the script. I'm not a scripter but reading it and make small modifications was easy.

          Thanks,
          Aldo

          Sent from my SM-G935V using Tapatalk

          Comment


            #6
            Anybody thought about a Traccar plugin? would be superb

            Comment


              #7
              Originally posted by deanrparry View Post
              Anybody thought about a Traccar plugin? would be superb
              I think you can do the same with earlier mentioned script to retrieve the Traccar data into Homeseer
              It's working like a charm. I've extended it with Google Maps and Streetview as well.

              Comment


                #8
                Originally posted by Rutger View Post
                I think you can do the same with earlier mentioned script to retrieve the Traccar data into Homeseer
                It's working like a charm. I've extended it with Google Maps and Streetview as well.
                I do not think it is that easy for me as i run my main Traccar Sever on the HomeSeer and you do something with sql settings i think might break my current setup?

                Trust me i have tried for HOURS! to get you solution to work i am going crazy lol

                Comment


                  #9
                  I do run Traccar and Homeseer on the same server, including XAMPP for web and MySQL server. Yes, I have spend also many hours to get Traccar working fine on MySQL years ago, but now it's kind of peace of cake.

                  If a Homeseer vb script (or with php) is able to connect to the MySQL server to store or retrieve data, than the Traccar config change should not be an issue.

                  Comment


                    #10
                    Originally posted by Rutger View Post
                    I do run Traccar and Homeseer on the same server, including XAMPP for web and MySQL server. Yes, I have spend also many hours to get Traccar working fine on MySQL years ago, but now it's kind of peace of cake.

                    If a Homeseer vb script (or with php) is able to connect to the MySQL server to store or retrieve data, than the Traccar config change should not be an issue.
                    The part that throws me is the part you edit traccar config itself and the username and password? what username and password.

                    Comment


                      #11
                      OK so if i sit back and read properly i need to install mySQL before i do anything yes? regardless of Traccar using its own sql?

                      Comment


                        #12
                        Maybe it's possible to get the data from SQL as well in Homeseer, but I never tried that.
                        There are probably some examples over here on the board or on the internet to achieve this.

                        I'm not using the default SQL DB from Traccar, but (as you can see in the Traccar documentation), MySQL is support too, but you need to have a MySQL environment for that ofcourse.
                        In my case I do have such an environment, because I save/update also all my HS device values into MySQL, and store temperature changes, timesheets(based on gps), etc, so the change in Traccar from SQL to MySQL was almost mandatory for me. Based on MySQL it's easier from me to get the Traccar data into Homeseer.
                        https://www.traccar.org/mysql/

                        Comment


                          #13
                          Originally posted by Rutger View Post
                          Maybe it's possible to get the data from SQL as well in Homeseer, but I never tried that.
                          There are probably some examples over here on the board or on the internet to achieve this.

                          I'm not using the default SQL DB from Traccar, but (as you can see in the Traccar documentation), MySQL is support too, but you need to have a MySQL environment for that ofcourse.
                          In my case I do have such an environment, because I save/update also all my HS device values into MySQL, and store temperature changes, timesheets(based on gps), etc, so the change in Traccar from SQL to MySQL was almost mandatory for me. Based on MySQL it's easier from me to get the Traccar data into Homeseer.
                          https://www.traccar.org/mysql/
                          thank you kind sir i will research this as i did not know you could use mysql with it hence my confusion but you have cleared it up very quickly

                          Comment


                            #14
                            the part of the "traccar.xml" file in the Traccar\Conf folder, is changed to:

                            <entry key='database.driver'>com.mysql.jdbc.Driver</entry>
                            <entry key='database.url'>jdbc:mysql://localhost:3306/traccar?allowMultiQueries=true&amp;autoReconnect=true&amp;us eUnicode=yes&amp;characterEncoding=UTF-8&amp;sessionVariables=sql_mode=ANSI_QUOTES</entry>
                            <entry key='database.user'>root</entry>
                            <entry key='database.password'>xxxxxx</entry>


                            - Where database.user: in my case "root" . A user which is created in the MySQL environment.
                            - Where database.password: the password for above created user.
                            - Because you have it running too on the same server, the database.url can be unchanged to "localhost"

                            You should create the database "traccar" manually, and after the config file is changed, and the Traccar service is started, it should create all the tables automatically in the MySQL database.

                            Comment


                              #15
                              close but giving up tonight have a database think i have sorted privileges... newton in bin/scripting! wish i knew more about this drives me mad!

                              Comment

                              Working...
                              X