Customize Consent Preferences

We use cookies to help you navigate efficiently and perform certain functions. You will find detailed information about all cookies under each consent category below.

The cookies that are categorized as "Necessary" are stored on your browser as they are essential for enabling the basic functionalities of the site. ... 

Always Active

Necessary cookies are required to enable the basic features of this site, such as providing secure log-in or adjusting your consent preferences. These cookies do not store any personally identifiable data.

No cookies to display.

Functional cookies help perform certain functionalities like sharing the content of the website on social media platforms, collecting feedback, and other third-party features.

No cookies to display.

Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics such as the number of visitors, bounce rate, traffic source, etc.

No cookies to display.

Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.

No cookies to display.

Advertisement cookies are used to provide visitors with customized advertisements based on the pages you visited previously and to analyze the effectiveness of the ad campaigns.

No cookies to display.

In Homeseer 2 it was possible to retrieve device data via DOM. In Homeseer 3 it’s not possible anymore. To prepare any reponsive webdesign or app I would like to store all relevant device data into a MySQL database. I’ve already running a XAMPP server so the MySQL was an easy step forward. You have to find out yourself how to configure the MySQL part.

I’ve created manually a database in phpmyadmin, it can be done in the script below too, but this will be added later.

My table called “devices” and the the column data is created as following:

mysqltable

The name of the Homeseer script is “MySQL_Devices.vb”.

A link has to be added to the Startup.vb script from Homeseer. It should added to the bottom of the script, but before the “End” statement:

Dim port As String = hs.GetINISetting(“Settings”, “gWebSvrPort”, “”)
If port <> “80” Then
hs.Speak(“Web server port number is ” & port)
End If
hs.RegisterStatusChangeCB(“MySQL_Devices.vb”, “StatusChangeCB”)

In this case the script will be called when a device will be changed to any value so an event isn’t necessary to run this script.

A restart of Homeseer is necessary to run this script, which should be done when th vb.NET script below is saved.

 

In my case, I’m not interested in old device values (historic data), only the current ones. For historic data I’ve seperate databases, with energy usage (water/power/gas), etc.

This script will do a check the database first if the device address (like “G21”) is already present. If yes, the existing device data will be overwritten with the current data.

If no device address is found, a new record will be created and the current device data will be stored in this record.

In this way, no unnecessary data is visible in the database and is always up to date.

 

The “MySQL_Devices.vb” script contains a lot of debuging information, so if the option is enabled, you will see what’s happing with all the steps and values.

 

The result in the MySQL database should be like (sorted on “device_lastchange”):

mysql-devices

 

Downloads:

MySQL_Devices.vb script:

  MySQL_Devices.vb (7.5 KiB, 2,887 hits)

Privacy Preference Center