Sunday, September 27, 2020

HS3 to HS4 migration. (Also Windows to Linux attempt.)

The issue

Fed up with all the Windows 10 issues (just this week alone 3 requiring reboots and the 4th was a memory issue that Windows was masquerading) I decided to bite the bullet and move my Homeseer to one of Linux boxes and figured might as well upgrade to version 4 of Homeseer at the same time. After asking around it appears I can fall back to my Windows instance if I get in trouble.

First Impressions

HS4 on Linux

Despite my Linux box being WAY more powerful (Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz) than my Windows box (Intel(R) Core(TM) i7-3700 CPU @ 3.40GHz), the web interface was slower on it than HS3 on Windows. Editing events was tedious with more time looking at hour glasses than selecting and typing. It seems to just randomly crash fairly regularly. 

HS4 on Windows

Does not seem to add any issues not seen on Linux as well and still seems faster than the Linux version.

HS4 in general

The biggest change is devices are devices in HS4 like most other automation systems with the data streams seen as linked "features" instead of devices in their own right as they were in HS3. This seems to have caused a few issues with events that might need to be manually edited. You can assign multiple categories to devices so I decide to redo most of mine from category / location to categories / area / location to make finding devices in lists easier not that only root devices are listed.

One thing that is bugging me about HS4 is the pages where the only return / nav option is the Home button which takes you to the devices page.



Some things are missing like custom pages and others hidden like global variables. Jon00 Links gets you some things back.

Before

After (with defaults)


You might want to visit Jon00's site for some fixes too.

Jon00 Event Viewer & Documenter for Homeseer 4 for instance makes finding broken events a lot easier.


Looking "BROKEN" is much better than just looking at each event. For example this one looks fine at a glance.
Worse yet this is what the fixed version looks like. Can you see the diff?

In some cases fixing appears to just be clicking options, selecting the same value (waiting for the page update between each) and then clicking the save icon for that section. Literally nothing visible changes. Note too, reselecting the device means scrolling back through the whole list with the scroll bar because not only does it move to the item in the list but typing the first letter does not get you in the ballpark either. The device you select might actually need to be changed from the a hs3 "device" its parent. and then select the feature.

Summary

The answer seems to be unless you are starting from scratch do not install on Linux. See my Windows upgrade steps below

Steps I did - the adventure / stuff I've tried so far going from HS3 on Windows to HS4 on Linux

Note this just the stuff that looked like it might work (read wasted most time on) and does not reflect all the dead ends I went down that I dismissed quickly or the hours of research online.

Basic install

I started from these instructions. These are the instructions I actually used. (I already have a local ntpd server so I did not need that bit.) Note I changed the http and https port since I already had a server running on this PC (10.10.2.197).

yum -y update

yum -y install yum-utils

yum -y install mono-complete

mozroots --import --sync

yum -y install mono-basic

mkdir /home/hs4

cd  /home/hs4

wget https://homeseer.com/updates4/linux_4_1_6_0.tar.gz

tar xzvf linux_4_1_6_0.tar.gz

cd ./Homeseer

echo '<?xml version="1.0" encoding="utf-8"?>' > /etc/firewalld/services/hs3p.xml

echo '<service>' >> /etc/firewalld/services/hs3p.xml

echo ' <short>HS3 Ports</short>' >> /etc/firewalld/services/hs3p.xml

echo ' <description>HomeSeer 3 Ports needed for the application. HTTP, HTTPS (...future on Linux I am sure...), HSTouch </description>' >> /etc/firewalld/services/hs3p.xml

echo ' <port protocol="tcp" port="8080"/>' >> /etc/firewalld/services/hs3p.xml

echo ' <port protocol="tcp" port="8443"/>' >> /etc/firewalld/services/hs3p.xml

echo ' <port protocol="tcp" port="10200"/>' >> /etc/firewalld/services/hs3p.xml

echo ' <port protocol="tcp" port="10401"/>' >> /etc/firewalld/services/hs3p.xml

echo '</service>' >> /etc/firewalld/services/hs3p.xml

I already had a /etc/firewalld/zones/public.xml

So edit 

vi /etc/firewalld/zones/public.xml

And only added

<service name="hs3p"/>

And restart the service

service firewalld restart

Things got tricky at this point. I needed to set the port and IP address (since I have multiple Config/settings.ini did not exist till after running ./go 

After stopping it I could then edit Config/settings.ini and add

gWebSvrPort=8080

gServerAddressBind=10.10.2.197

Note you also need to change 

C:\Program Files (x86)\HomeSeer HS3\Bin\

to your new bin

For example

ScriptingReferences=System.Data.SQLite;C:\Program Files (x86)\HomeSeer HS3\Bin\System.Data.SQLite.dll,Newtonsoft.Json;C:\Program Files (x86)\HomeSeer HS3\Bin\homeseer\Newtonsoft.Json.dll

becomes

ScriptingReferences=System.Data.SQLite;/home/hs4/HomeSeer/bin/System.Data.SQLite.dll,Newtonsoft.Json;/home/hs4/HomeSeer/bin/homeseer/Newtonsoft.Json.dll

After restarting I still could not access remotely

Accessing via localhost on the PC I found the redirect was bad. You need to go to the register page directly

http://10.10.2.197:8080/register.html

I got as far as step 3 and it hung


09:57:24:8537:[Warning]->Unable to connect to MyHS service, license ID is 0. Please register the system with a valid license.
DoRegisterInternet
DoREgister Response
09:57:29:8699:[Info]->Stopping the MyHS Service...
09:57:33:8724:[Info]->Starting the MyHS Service...
09:57:33:9927:[Info]->System connected to MyHS Service, waiting for acknowledge...
File upload thread started
09:57:34:0435:[Info]->System connected to MyHS Service successfully with license ID ******.
DoRegisterInternet
10:05:12:9769:[Warning]->File does not exist: /home/hs4/HomeSeer/html/bootstrap/css/bootstrap.min.css.map
10:05:13:1402:[Warning]->File does not exist: /home/hs4/HomeSeer/html/bootstrap/js/bootstrap.min.js.map
10:05:13:1441:[Warning]->File does not exist: /home/hs4/HomeSeer/html/bootstrap/js/bs-custom-file-input.js.map
10:05:13:1442:[Warning]->File does not exist: /home/hs4/HomeSeer/html/sm/b0ce608ffc029736e9ac80a8dd6a7db2da8e1d45d2dcfc92043deb2214aa30d8.map
DoRegisterInternet


I finally just skipped the transfer services bit even though it most likely means more work later. On the plus side it means the HS3 instance should continue to work while I sort the HS4 instance.

Next it wants me to create an account. Not sure why since it already acknowledged I'm doing an upgrade. I used my previous login and password which it seemed to take OK so it would seem HS4 is using a diff system.


Not change to settings (last step) except to set location and Finish. And again hit a problem. Probably should have changed settings to not require login locally for now since no login appears to work. I renamed user file

mv Config/users.cfg Config/users.cfg.bak

restart and was able to get in with default/default.

Started looking at setup and first thing I noticed was location was well off. Told it Austin but appears to be Boston. Just under 2000 miles off.


Replaced contents of Config/users.cfg with the the contents from my HS3 copy and all seemed to restore my users which is a good sign.

Next bring over my config

Given the various ways suggested I decided to backup both instance folders plus backup config and events via the HS3 web interface at this point and mount a transfer folder on the CentOS box.

Note the Win share name might not work in fstab. If so try the IP address instead.

Trying to restore a backup from HS3 turned out to be an adventure. After  a good bit of trial and error I've sorted the backup seems to need to be:

  • named like 9_26_2020-16_17_54.zip
  • The timestamp part of the name needs to be newer than the latest backup
  • Contain the files Data.zip, Config.zip, scripts.zip and html.zip at top level.

After uploading a file if something goes wrong there may be no indication other than the list of available backups for restore is unchanged from the last time you tried to restore. 

Also you need to restart for the restore to take affect but before you do you will need update Config/settings.ini again.

gWebSvrPort=8080

gServerAddressBind=10.10.2.197

I also had to do the registration bit again.

Plugins

Note still no plugins showed as installed. I had to install and enable them one by one. I have quite a few.


I started with Z-Wave (used the standard instead of one of the Linux beta ones. Most went pretty smooth. 

Harmony was a bit weird. I had to readd the hubs which created all new objects that will need swapping in on the events.

The JowiHue plugin did not seem to like my old license but the new, version 4 one, was 60% off so not a biggie. Especially as much use as I get from that one. Does not seem be finding any of my 3 hubs though.


Events

My events all seem to transfer without having to export and import them. 

But all the ones with scripts needed their paths changed from absolute to just the filename. If any were not in the scripts folder they will need moved there as well. I clicked the import button it said event_groups.json was missing. I started manually changing all 412 of the script actions before I realized the config import filtered those files. I made a copy and changed the paths to try and import working through the issues. This sorts the script path change. I renamed my exported json to events.hs3.json

sed -e "s?C:/Program Files (x86)/HomeSeer HS3/scripts/??g" events.hs3.json > events.json

It also looks like some of the places virtual devices were getting got set to no device as well.

And some other random values seems messed up. For example Here is the export of one event

{
"mvarGroupRef": 6088529,
"Enabled": true,
"UserNote": "",
"IOMisc": "",
"Last_Trigger_Time": "2020-09-15T17:04:44.1950438-05:00",
"Retrigger_Delay": 0,
"Triggered": true,
"Triggers": {
"TrigGroups": {
"K0": {
"$type": "System.Collections.Generic.List`1[[Scheduler.Classes.EvTrig_BASE, Scheduler]], mscorlib",
"$values": [
{
"$type": "Scheduler.Classes.EvTrig_DEVICE_VALUE, Scheduler",
"ev_trig_dvRef": 451,
"mvarValue_or_Start": -2147483648.0,
"mvarTriggerSubType": 7,
"ValStart": -2147483648.0,
"ValEnd_Spec": 1.0,
"UIMessage": "",
"HasTriggers": true,
"TriggerSubType": 7,
"SubTriggerCount": 10,
"SubTriggerName": "This device had its value set and is less than...",
"IsTimeTrigger": false,
"TriggerConfigured": true,
"TriggerName": "A Device's Value is...",
"TriggerGroupID": 0,
"evRef": 3488,
"TriggerType": 6,
"iTrigMisc": 524288,
"Condition": false
},
{
"$type": "Scheduler.Classes.EvTrig_COUNTER, Scheduler",
"Inc_Dec_Value": 1.0,
"Trigger_Pos_and_Neg": false,
"Trigger_Every_Value": false,
"Trigger_Exceed": true,
"mvarCounterName": "WasherStatus",
"UIMessage": "",
"HasTriggers": true,
"TriggerSubType": 3,
"SubTriggerCount": 8,
"SubTriggerName": "WasherStatus value has exceeded this:",
"TriggerConfigured": true,
"TriggerName": "A Counter's Value is...",
"Version": 2.0,
"TriggerGroupID": 0,
"evRef": 3488,
"TriggerType": 10,
"iTrigMisc": 524288,
"Condition": true,
"Value_Trigger": 0.0,
"Value_Trigger_Set": true
}
]
}
},
"TrigGroupsComp": null
},
"Actions": {
"mvarActions": {
"K0": {
"$type": "Scheduler.Classes.EvACT_SCRIPT, Scheduler",
"mvarScript": "C:/Program Files (x86)/HomeSeer HS3/scripts/SayIt.vb",
"mvarMethod": "sayString",
"mvarParams": "The Laundry has finished washing",
"script_wait": false,
"script_single_instance": false,
"UIMessage": "",
"ActionName": "Run a Script or Script Command",
"Misc": 64,
"evRef": 3488,
"Action_Order": 0,
"Action_Type": 10,
"ActionAdvancedMode": true,
"ActionConfigured": true,
"Script": "C:/Program Files (x86)/HomeSeer HS3/scripts/SayIt.vb(\"sayString\",\"The Laundry has finished washing\")"
},
"K1": {
"$type": "Scheduler.Classes.EvACT_RUN_EVENT, Scheduler",
"run_event_ref": 9262,
"UIMessage": "",
"ActionName": "Run Another Event",
"Misc": 64,
"evRef": 3488,
"Action_Order": 1,
"Action_Type": 9,
"ActionAdvancedMode": true,
"ActionConfigured": true
},
"K2": {
"$type": "Scheduler.Classes.EvACT_COUNTER, Scheduler",
"CounterAction": 5,
"UIMessage": "",
"ActionName": "Control a Counter",
"Misc": 64,
"evRef": 3488,
"Action_Order": 2,
"Action_Type": 3,
"ActionAdvancedMode": true,
"ActionConfigured": true,
"CounterName": "WasherStatus"
}
}
},
"Version": 1.2,
"evRef": 3488,
"Name": "Clothes done",
"VoiceCommand": "",
"sType": "Alert-white",
"EvGroup": {
"GlobalActions": {
"mvarActions": {

}
},
"GlobalConditions": {
"TrigGroups": {

},
"TrigGroupsComp": null
},
"Version": 1.2,
"Group": "Laundry",
"Ref": 6088529
},
"Misc": 0,
"PlugExtraData": {

}
}

Looking at it in HS4 it looks like this and is constantly triggering.

Clicking on edit on the trigger you notice things look more difference than just a face lift.
It appears it has changed from treating each data element of a things as a device if not sees them as properties of a thing like most other home automation systems do. While the above looks correct. just clicking save does not fix the issue. You seem to need to go back through a full setup. When working it it looks the same so something is happening under the covers.





Scripts

VB includes were not working.

Voice assistants and other 3rd party links

As mentioned above the setup hung trying to sort these links so once everything else is working the last step will be sorting Alexa, Google Assistant and IFTTT linkages.

Falling back to HS3

After spending a couple days on this I needed to fall back to HS3 till I can get enough working HS4 to make it reasonable to so I'm falling back. Fortunately for me that means shutdown HS4 and powering up the old PC. It seems like everything is working but it will take some time to see if that truly is the case.

Picking back up

Z-Wave

The Z-nets only allow one connection and the connections can cross as it tries to sort them. If you have more than one (I have 3), best to turn all the plugins off, reboot each Z-Net and then turn the plugins back on one at a time. 


Preferably in ascending number order. The simplest way to reboot the Z-nets is just to go to the Z-net's web interface and click submit.

Still it seems I needed to a rescan to get motion triggers working again.

Plugins

Noticing some plugins do not seem to ever come out of "start is pending" status

Hue / JowiHue

Hubs did not show up at first. Did a rescan and they appeared. 

Scenes and animations seem to have been lost in the migration. Needed to recreate them



Harmony

Looks like only the first instance is needed now. 



I also needed to delete and readd one hub before it would connect.



Timers

Triggers using timers did not convert. As in this in HS3 Windows


Got converted to this in HS4 linux.


Note too the save icon. Change do not autosave like before. You should click the save action after editing a trigger or action.

Events

Other than mentioned elsewhere I'm seeing events triggered for no obvious reason. 

Scripts

As mentioned above the events needed the paths edited but after that I started see a lot of errors that appeared to indicate issues with includes and imports. Turns out those errors are misleading. For instance when I run my script ChkSensors.vb I see:

09:44:07:5322:[Event]->Event Trigger "Monitor Sensor check"

09:44:07:5326:[Event]->Running script in background (Sensor check): ChkSensors.vb("chkSensors")

09:44:08:3512:[Error]->Compiling script ChkSensors.vb: The import 'System.Core' could not be found.

09:44:08:3513:[Error]->Compiling script ChkSensors.vb: Variable declaration without an 'As' clause; Object type assumed.

09:44:08:3514:[Error]->Compiling script ChkSensors.vb: Variable declaration without an 'As' clause; Object type assumed.

09:44:08:3515:[Error]->Compiling script ChkSensors.vb: Variable declaration without an 'As' clause; Object type assumed.

09:44:08:3516:[Error]->Compiling script ChkSensors.vb: Variable declaration without an 'As' clause; Object type assumed.

09:44:08:3517:[Error]->Compiling script ChkSensors.vb: Variable declaration without an 'As' clause; Object type assumed.

09:44:08:3518:[Error]->Compiling script ChkSensors.vb: Variable declaration without an 'As' clause; Object type assumed.

09:44:08:3519:[Error]->Compiling script ChkSensors.vb: Variable declaration without an 'As' clause; Object type assumed.

09:44:08:3519:[Error]->Compiling script ChkSensors.vb: Variable declaration without an 'As' clause; Object type assumed.

09:44:08:3520:[Error]->Compiling script ChkSensors.vb: Variable declaration without an 'As' clause; Object type assumed.

09:44:08:3521:[Error]->Compiling script ChkSensors.vb: Variable declaration without an 'As' clause; Object type assumed.

09:44:08:3522:[Error]->Compiling script ChkSensors.vb: Variable declaration without an 'As' clause; Object type assumed.

09:44:08:3522:[Error]->Compiling script ChkSensors.vb: Variable declaration without an 'As' clause; Object type assumed.

09:44:08:3523:[Error]->Compiling script ChkSensors.vb: Variable declaration without an 'As' clause; Object type assumed.

09:44:08:3524:[Error]->Compiling script ChkSensors.vb: Variable declaration without an 'As' clause; Object type assumed.

09:44:08:3525:[Error]->Compiling script ChkSensors.vb: Variable declaration without an 'As' clause; Object type assumed.

09:44:08:3526:[Error]->Compiling script ChkSensors.vb: Variable declaration without an 'As' clause; Object type assumed.

09:44:08:3527:[Error]->Compiling script ChkSensors.vb: Variable declaration without an 'As' clause; Object type assumed.

09:44:08:3528:[Error]->Compiling script ChkSensors.vb: Variable declaration without an 'As' clause; Object type assumed.

09:44:08:3528:[Error]->Compiling script ChkSensors.vb: 42021

09:44:08:3529:[Error]->Compiling script ChkSensors.vb: 42021

09:44:08:3529:[Error]->Compiling script ChkSensors.vb: 42021

09:44:08:3530:[Error]->Compiling script ChkSensors.vb: 42021

09:44:08:3531:[Error]->Compiling script ChkSensors.vb: Variable declaration without an 'As' clause; Object type assumed.

09:44:08:3531:[Error]->Compiling script ChkSensors.vb: 'lastSaid2969Ref' is not declared. It may be inaccessible due to its protection level.

09:44:08:3532:[Error]->Compiling script ChkSensors.vb: 'lastSaid2969Ref' is not declared. It may be inaccessible due to its protection level.

09:44:08:3533:[Error]->Compiling script ChkSensors.vb: Function without an 'As' clause; Object return type assumed.

09:44:08:3534:[Error]->Compiling script ChkSensors.vb: 'lastSaid2969Ref' is not declared. It may be inaccessible due to its protection level.

09:44:08:3535:[Error]->Compiling script ChkSensors.vb: Function without an 'As' clause; Object return type assumed.

09:44:08:3536:[Error]->Compiling script ChkSensors.vb: 'lastSaid2969Ref' is not declared. It may be inaccessible due to its protection level.

09:44:08:3536:[Error]->Compiling script ChkSensors.vb: 'AnnounceMode981Ref' is not declared. It may be inaccessible due to its protection level.

09:44:08:3537:[Error]->Compiling script ChkSensors.vb: 'AnnounceMode981Ref' is not declared. It may be inaccessible due to its protection level.

09:44:08:3538:[Error]->Compiling script ChkSensors.vb: 'CheckedDeviceCount4605Ref' is not declared. It may be inaccessible due to its protection level.


But from what I'm reading the issue is a bug with vbnc and arrays. For examples these, though none fix for what I'm seeing: 
Bottom line "System.Core" is basically an indicator "something" went wrong and the "Variable declaration without an 'As' " are real warnings that should not matter. The "inaccessible due to its protection level" errors are the real issues.

At this point I decided to take a step back and see if I could get HS3 running on Linux to separate the migration to Linux issues from the HS3 to HS4 issues. Unfortunately it looks like at least some of the issues might be the events export as some things were still missing. So it looks like it makes little diff if I go to to HS3 or HS4 as it appears the migration to Linux is most of the issues. So I looked at my Raspberry Pi HS3 test instance which was working to see what version on mono it is using to downgrade my CentOS system to. First I needed to add the mono repo to get at the legacy versions.

yum-config-manager --add-repo http://download.mono-project.com/repo/centos7

Remove the current mono version

 yum remove mono* libmono*

 yum autoremove

And install the legacy versions

yum install -y mono-complete-5.18.0.240-0.xamarin.2.epel7.x86_64 --nogpgcheck

--nogpgcheck is added because the keys were missing when I was doing my install.

Just for added fun the 5.18.0.240-0 version on the Raspberry Pi does not appear to match up with the same version on CentOS. The version vbc on CentOS seemed too old for the version Homeseer needs from the error 

Unhandled Exception:

System.TypeLoadException: Could not load type of field 'HSConsole.My.MyProject:m_ComputerObjectProvider' (0) due to: Could not load file or assembly 'Microsoft.VisualBasic, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies.

[ERROR] FATAL UNHANDLED EXCEPTION: System.TypeLoadException: Could not load type of field 'HSConsole.My.MyProject:m_ComputerObjectProvider' (0) due to: Could not load file or assembly 'Microsoft.VisualBasic, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies.

The newest mono-complete from the mono repo installs these versions

====================================================================================================================================

 Package                Arch   Version                                                 Repository                              Size

====================================================================================================================================

Installing:

 mono-complete          x86_64 6.12.0.107-0.xamarin.9.epel7                            download.mono-project.com_repo_centos7 3.5 k

Installing for dependencies:

 ibm-data-db2           x86_64 6.12.0.107-0.xamarin.9.epel7                            download.mono-project.com_repo_centos7  39 k

 libmono-2_0-devel      x86_64 6.12.0.107-0.xamarin.9.epel7                            download.mono-project.com_repo_centos7  52 k

 libmono-llvm0          x86_64 6.12.0.107-0.xamarin.9.epel7                            download.mono-project.com_repo_centos7 8.9 M

 libmonoboehm-2_0-devel x86_64 6.12.0.107-0.xamarin.9.epel7                            download.mono-project.com_repo_centos7 3.1 k

 libmonosgen-2_0-devel  x86_64 6.12.0.107-0.xamarin.9.epel7                            download.mono-project.com_repo_centos7 6.3 k

 mono-core              x86_64 6.12.0.107-0.xamarin.9.epel7                            download.mono-project.com_repo_centos7  34 M

 mono-data              x86_64 6.12.0.107-0.xamarin.9.epel7                            download.mono-project.com_repo_centos7 4.4 M

 mono-data-oracle       x86_64 6.12.0.107-0.xamarin.9.epel7                            download.mono-project.com_repo_centos7  80 k

 mono-data-sqlite       x86_64 6.12.0.107-0.xamarin.9.epel7                            download.mono-project.com_repo_centos7  67 k

 mono-devel             x86_64 6.12.0.107-0.xamarin.9.epel7                            download.mono-project.com_repo_centos7  25 M

 mono-extras            x86_64 6.12.0.107-0.xamarin.9.epel7                            download.mono-project.com_repo_centos7 398 k

 mono-llvm-tools        x86_64 6.0+mono20190708165219-0.xamarin.1.epel7                download.mono-project.com_repo_centos7  17 M

 mono-locale-extras     x86_64 6.12.0.107-0.xamarin.9.epel7                            download.mono-project.com_repo_centos7 291 k

 mono-mvc               x86_64 6.12.0.107-0.xamarin.9.epel7                            download.mono-project.com_repo_centos7 433 k

 mono-reactive          x86_64 6.12.0.107-0.xamarin.9.epel7                            download.mono-project.com_repo_centos7 332 k

 mono-wcf               x86_64 6.12.0.107-0.xamarin.9.epel7                            download.mono-project.com_repo_centos7 973 k

 mono-web               x86_64 6.12.0.107-0.xamarin.9.epel7                            download.mono-project.com_repo_centos7 2.2 M

 mono-winforms          x86_64 6.12.0.107-0.xamarin.9.epel7                            download.mono-project.com_repo_centos7 1.5 M

 mono-winfxcore         x86_64 6.12.0.107-0.xamarin.9.epel7                            download.mono-project.com_repo_centos7 263 k

 monodoc-core           x86_64 6.12.0.107-0.xamarin.9.epel7                            download.mono-project.com_repo_centos7  19 M

 msbuild                noarch 1:16.6+xamarinxplat.2020.10.22.18.31-0.xamarin.1.epel7  download.mono-project.com_repo_centos7  10 M

 msbuild-libhostfxr     x86_64 3.0.0.2019.04.16.02.13-0.xamarin.4.epel7                download.mono-project.com_repo_centos7 167 k

 msbuild-sdkresolver    noarch 1:16.6+xamarinxplat.2020.10.22.18.31-0.xamarin.1.epel7  download.mono-project.com_repo_centos7  49 k

Updating for dependencies:

 libmono-2_0-1          x86_64 6.12.0.107-0.xamarin.9.epel7                            download.mono-project.com_repo_centos7 3.3 k

 libmonoboehm-2_0-1     x86_64 6.12.0.107-0.xamarin.9.epel7                            download.mono-project.com_repo_centos7 6.3 M

 libmonosgen-2_0-1      x86_64 6.12.0.107-0.xamarin.9.epel7                            download.mono-project.com_repo_centos7 6.8 M

From the epel repo

====================================================================================================================================

 Package                               Arch                      Version                           Repository                  Size

====================================================================================================================================

Installing:

 mono-complete                         x86_64                    6.8.0-1.el7                       epel                        39 k

Installing for dependencies:

 glib2-devel                           x86_64                    2.56.1-8.el7                      updates                    454 k

 ibm-data-db2                          x86_64                    6.8.0-1.el7                       epel                        75 k

 mono-core                             x86_64                    6.8.0-1.el7                       epel                        19 M

 mono-data                             x86_64                    6.8.0-1.el7                       epel                       4.8 M

 mono-data-oracle                      x86_64                    6.8.0-1.el7                       epel                       116 k

 mono-data-sqlite                      x86_64                    6.8.0-1.el7                       epel                       103 k

 mono-devel                            x86_64                    6.8.0-1.el7                       epel                       6.4 M

 mono-extras                           x86_64                    6.8.0-1.el7                       epel                       463 k

 mono-locale-extras                    x86_64                    6.8.0-1.el7                       epel                       325 k

 mono-mvc                              x86_64                    6.8.0-1.el7                       epel                       484 k

 mono-reactive                         x86_64                    6.8.0-1.el7                       epel                       400 k

 mono-wcf                              x86_64                    6.8.0-1.el7                       epel                       921 k

 mono-web                              x86_64                    6.8.0-1.el7                       epel                       2.5 M

 mono-winforms                         x86_64                    6.8.0-1.el7                       epel                       1.6 M

 mono-winfx                            x86_64                    6.8.0-1.el7                       epel                       310 k

 monodoc                               x86_64                    6.8.0-1.el7                       epel                        19 M


Transaction Summary

====================================================================================================================================

Install  1 Package (+16 Dependent packages)

But still getting the Exception so added mono-*

====================================================================================================================================

 Package                                  Arch                     Version                             Repository              Size

====================================================================================================================================

Installing:

 mono-addins                              x86_64                   1.1-3.el7                           epel                   417 k

 mono-addins-devel                        x86_64                   1.1-3.el7                           epel                    18 k

 mono-basic                               x86_64                   4.6-3.el7                           epel                   751 k

 mono-basic-devel                         x86_64                   4.6-3.el7                           epel                   9.2 k

 mono-cecil                               x86_64                   0.9.6-6.el7                         epel                   231 k

 mono-cecil-devel                         x86_64                   0.9.6-6.el7                         epel                   4.7 k

 mono-icon-theme                          noarch                   1:4.10.5-4.el7                      base                   3.7 M

 mono-mvc-devel                           x86_64                   6.8.0-1.el7                         epel                    39 k

 mono-reactive-devel                      x86_64                   6.8.0-1.el7                         epel                    39 k

 mono-reactive-winforms                   x86_64                   6.8.0-1.el7                         epel                    49 k

 mono-web-devel                           x86_64                   6.8.0-1.el7                         epel                    39 k

 mono-yui                                 x86_64                   1.1.0-7.el7                         epel                   232 k

 mono-zeroconf                            x86_64                   0.9.0-16.el7                        epel                    99 k

 mono-zeroconf-devel                      x86_64                   0.9.0-16.el7                        epel                    24 k

Installing for dependencies:

 gtk-sharp2                               x86_64                   2.12.26-4.el7                       epel                   681 k

 libyui                                   x86_64                   3.1.5-1.el7                         epel                   209 k

 libyui-gtk                               x86_64                   2.44.5-5.el7                        epel                   203 k


Transaction Summary

====================================================================================================================================

Install  14 Packages (+3 Dependent packages)

That sorted the Exception which implies mono-complete is not installing needed dependencies. 

After further troubleshooting is appears the issue I'm seeing comes down to variables defined in in and included script are not getting passed on to a script that includes it. For example my script PushBullet.vb includes SayIt.vb which includes Refs.vb. If I run a method in SayIt.vb it just works with no errors but if I run one in PushBullet.vb I get errors like these

03:53:29:4362:[Event]->Event Script Edit Edit PushBullet.vb triggered by the event page 'Run' button.

03:53:29:4365:[Event]->Event Trigger "Script Edit Edit PushBullet.vb"

03:53:29:4367:[Event]->Running script in background (Edit PushBullet.vb): PushBullet.vb("SendMsg","Test#test message")

03:53:30:1916:[Error]->Compiling script PushBullet.vb: Visual Basic.Net Compiler version 0.0.0.5943 (Mono 4.6 - tarball)

Copyright (C) 2004-2010 Rolf Bjarne Kvinge. All rights reserved.


/tmp/3zxjcr2a.0.vb (2,16) : warning VBNC40056: The import 'System.Core' could not be found.

/tmp/3zxjcr2a.0.vb (43,14) : warning VBNC42020: Variable declaration without an 'As' clause; Object type assumed.

/tmp/3zxjcr2a.0.vb (44,13) : warning VBNC42020: Variable declaration without an 'As' clause; Object type assumed.

/tmp/3zxjcr2a.0.vb (62,14) : warning VBNC42020: Variable declaration without an 'As' clause; Object type assumed.

/tmp/3zxjcr2a.0.vb (63,12) : warning VBNC42020: Variable declaration without an 'As' clause; Object type assumed.

/tmp/3zxjcr2a.0.vb (84,11) : warning VBNC42020: Variable declaration without an 'As' clause; Object type assumed.

/tmp/3zxjcr2a.0.vb (90,11) : warning VBNC42020: Variable declaration without an 'As' clause; Object type assumed.

/tmp/3zxjcr2a.0.vb (96,11) : warning VBNC42020: Variable declaration without an 'As' clause; Object type assumed.

/tmp/3zxjcr2a.0.vb (102,11) : warning VBNC42020: Variable declaration without an 'As' clause; Object type assumed.

/tmp/3zxjcr2a.0.vb (107,11) : warning VBNC42020: Variable declaration without an 'As' clause; Object type assumed.

/tmp/3zxjcr2a.0.vb (218,15) : warning VBNC42020: Variable declaration without an 'As' clause; Object type assumed.

/tmp/3zxjcr2a.0.vb (219,16) : warning VBNC42020: Variable declaration without an 'As' clause; Object type assumed.

/tmp/3zxjcr2a.0.vb (220,17) : warning VBNC42020: Variable declaration without an 'As' clause; Object type assumed.

/tmp/3zxjcr2a.0.vb (229,25) : warning VBNC42020: Variable declaration without an 'As' clause; Object type assumed.

/tmp/3zxjcr2a.0.vb (296,14) : warning VBNC42020: Variable declaration without an 'As' clause; Object type assumed.

/tmp/3zxjcr2a.0.vb (302,21) : warning VBNC42020: Variable declaration without an 'As' clause; Object type assumed.

/tmp/3zxjcr2a.0.vb (310,14) : warning VBNC42020: Variable declaration without an 'As' clause; Object type assumed.

/tmp/3zxjcr2a.0.vb (318,21) : warning VBNC42020: Variable declaration without an 'As' clause; Object type assumed.

/tmp/3zxjcr2a.0.vb (326,14) : warning VBNC42020: Variable declaration without an 'As' clause; Object type assumed.

/tmp/3zxjcr2a.0.vb (327,10) : warning VBNC42020: Variable declaration without an 'As' clause; Object type assumed.

/tmp/3zxjcr2a.0.vb (327,16) : warning VBNC42020: Variable declaration without an 'As' clause; Object type assumed.

/tmp/3zxjcr2a.0.vb (327,23) : warning VBNC42020: Variable declaration without an 'As' clause; Object type assumed.

/tmp/3zxjcr2a.0.vb (327,32) : warning VBNC42020: Variable declaration without an 'As' clause; Object type assumed.

/tmp/3zxjcr2a.0.vb (328,17) : warning VBNC42020: Variable declaration without an 'As' clause; Object type assumed.

/tmp/3zxjcr2a.0.vb (329,21) : warning VBNC42020: Variable declaration without an 'As' clause; Object type assumed.

/tmp/3zxjcr2a.0.vb (117,46) : error VBNC30451: 'lastSaid2969Ref' is not declared. It may be inaccessible due to its protection level.

/tmp/3zxjcr2a.0.vb (128,68) : error VBNC30451: 'lastSaid2969Ref' is not declared. It may be inaccessible due to its protection level.

/tmp/3zxjcr2a.0.vb (127,13) : warning VBNC42024: Function without an 'As' clause; Object return type assumed.

/tmp/3zxjcr2a.0.vb (125,48) : error VBNC30451: 'lastSaid2969Ref' is not declared. It may be inaccessible due to its protection level.

/tmp/3zxjcr2a.0.vb (124,17) : warning VBNC42024: Function without an 'As' clause; Object return type assumed.

/tmp/3zxjcr2a.0.vb (123,48) : error VBNC30451: 'lastSaid2969Ref' is not declared. It may be inaccessible due to its protection level.

/tmp/3zxjcr2a.0.vb (134,76) : error VBNC30451: 'AnnounceMode981Ref' is not declared. It may be inaccessible due to its protection level.

/tmp/3zxjcr2a.0.vb (135,51) : error VBNC30451: 'AnnounceMode981Ref' is not declared. It may be inaccessible due to its protection level.

/tmp/3zxjcr2a.0.vb (227,34) : error VBNC30451: 'Partition14702Ref' is not declared. It may be inaccessible due to its protection level.

/tmp/3zxjcr2a.0.vb (231,66) : error VBNC30451: 'Partition14702Ref' is not declared. It may be inaccessible due to its protection level.

/tmp/3zxjcr2a.0.vb (297,80) : error VBNC30451: 'AlarmLevel2899Ref' is not declared. It may be inaccessible due to its protection level.

/tmp/3zxjcr2a.0.vb (299,41) : error VBNC30451: 'AlarmLevel2899Ref' is not declared. It may be inaccessible due to its protection level.

/tmp/3zxjcr2a.0.vb (299,54) : error VBNC30451: 'AlarmAway' is not declared. It may be inaccessible due to its protection level.

/tmp/3zxjcr2a.0.vb (301,46) : error VBNC30451: 'AlarmLevel2899Ref' is not declared. It may be inaccessible due to its protection level.

/tmp/3zxjcr2a.0.vb (301,59) : error VBNC30451: 'AlarmHome' is not declared. It may be inaccessible due to its protection level.

vbnc : Command line : error VBNC99999: Unexpected error: Object reference not set to an instance of an object

  at vbnc.ElseIfStatement.ResolveStatement (vbnc.ResolveInfo Info) [0x00058] in /builddir/build/BUILD/mono-basic-4.6/vbnc/vbnc/source/Statements/ElseIfStatement.vb:78

  at vbnc.Statement.ResolveCode (vbnc.ResolveInfo Info) [0x00000] in /builddir/build/BUILD/mono-basic-4.6/vbnc/vbnc/source/Statements/Statement.vb:53

  at vbnc.BaseObjects`1[T].ResolveCode (vbnc.ResolveInfo Info) [0x00054] in /builddir/build/BUILD/mono-basic-4.6/vbnc/vbnc/source/General/BaseObjects`1.vb:63

  at vbnc.IfStatement.ResolveStatement (vbnc.ResolveInfo Info) [0x000ac] in /builddir/build/BUILD/mono-basic-4.6/vbnc/vbnc/source/Statements/IfStatement.vb:119

  at vbnc.CodeBlock.ResolveCode (vbnc.ResolveInfo Info) [0x000c6] in /builddir/build/BUILD/mono-basic-4.6/vbnc/vbnc/source/Code/CodeBlock.vb:570

  at vbnc.MethodBaseDeclaration.ResolveCode (vbnc.ResolveInfo Info) [0x00088] in /builddir/build/BUILD/mono-basic-4.6/vbnc/vbnc/source/General/MethodBaseDeclaration.vb:331

  at vbnc.SubDeclaration.ResolveCode (vbnc.ResolveInfo Info) [0x00048] in /builddir/build/BUILD/mono-basic-4.6/vbnc/vbnc/source/Members/SubDeclaration.vb:118

  at vbnc.BaseObjects`1[T].ResolveCode (vbnc.ResolveInfo Info) [0x00054] in /builddir/build/BUILD/mono-basic-4.6/vbnc/vbnc/source/General/BaseObjects`1.vb:63

  at vbnc.TypeDeclaration.ResolveCode (vbnc.ResolveInfo Info) [0x00081] in /builddir/build/BUILD/mono-basic-4.6/vbnc/vbnc/source/TypeDeclarations/TypeDeclaration.vb:407

  at vbnc.ClassDeclaration.ResolveCode (vbnc.ResolveInfo Info) [0x00029] in /builddir/build/BUILD/mono-basic-4.6/vbnc/vbnc/source/TypeDeclarations/ClassDeclaration.vb:140

  at vbnc.AssemblyDeclaration.ResolveCode (vbnc.ResolveInfo Info) [0x00040] in /builddir/build/BUILD/mono-basic-4.6/vbnc/vbnc/source/TypeDeclarations/AssemblyDeclaration.vb:159

  at vbnc.Compiler.Compile_Resolve () [0x003ae] in /builddir/build/BUILD/mono-basic-4.6/vbnc/vbnc/source/General/Compiler.vb:416

  at vbnc.Compiler.Compile () [0x004c6] in /builddir/build/BUILD/mono-basic-4.6/vbnc/vbnc/source/General/Compiler.vb:532

Compilation took 00:00:00.6890000

Taking the same scripts back to the Raspberry Pi even the SayIt.vb methods got the same "is not declared. It may be inaccessible due to its protection level." errors. Meaning it is not seeing any vars defined in an included file. 

Since CentOS can see vars and method one level up, a quick fix seemed to be to copy Refs.vb in SayIt.vb though that did not sort the Alarm.vb script which includes PushBullet.vb. I worked around that by copying the bits of PushBullet.vb it used into it and including SayIt.vb

But then vesync.vb tried to run and crashed HS4.

=================================================================

        Basic Fault Address Reporting

=================================================================

Memory around native instruction pointer (0x7f139c7ac387):0x7f139c7ac377  48 63 d7 48 63 f6 48 63 f9 b8 ea 00 00 00 0f 05  Hc.Hc.Hc........

0x7f139c7ac387  48 3d 00 f0 ff ff 77 1e f3 c3 0f 1f 80 00 00 00  H=....w.........

0x7f139c7ac397  00 85 c9 7f db 89 c8 f7 d8 81 e1 ff ff ff 7f 0f  ................

0x7f139c7ac3a7  44 c6 89 c1 eb ca 48 8b 15 9c 0a 39 00 f7 d8 64  D.....H....9...d


=================================================================

        Managed Stacktrace:

=================================================================

          at <unknown> <0xffffffff>

          at scriptcode10.VBWrapper:sendCmd <0x000d7>

          at scriptcode10.VBWrapper:sendOff <0x0010b>

          at scriptcode10.VBWrapper:reset <0x00037>

          at scriptcode10.VBWrapper:resetRef <0x0016f>

          at <Module>:runtime_invoke_void__this___object <0x00094>

          at <unknown> <0xffffffff>

          at System.Reflection.RuntimeMethodInfo:InternalInvoke <0x000d0>

          at System.Reflection.RuntimeMethodInfo:Invoke <0x00123>

          at System.Reflection.MethodBase:Invoke <0x00045>

          at Scheduler.clsRunVBNetScript:ExecuteScript <0x00deb>

          at System.Threading.ThreadHelper:ThreadStart_Context <0x000a5>

          at System.Threading.ExecutionContext:RunInternal <0x001f1>

          at System.Threading.ExecutionContext:Run <0x00043>

          at System.Threading.ExecutionContext:Run <0x0006f>

          at System.Threading.ThreadHelper:ThreadStart <0x00043>

          at System.Object:runtime_invoke_void__this__ <0x00085>

=================================================================

Connection to HomeSeer lost, exiting

So I disabled the vesync.vb script on the CentOS box and went back to the Pi with the idea trying to debug there without risking crashing my [some what] running system. In an effort to make the Pi test system closer to the CentOS system I upgraded it mono to version 6. That did not seem to change any outcomes.

 This gave me some ideas on how to add some debug. After editing /usr/bin/vbnc to this

#!/bin/bash

# mono vbnc invocation script patched for HS3 aspx compatibility

logfile=/tmp/$(basename $0)$$.log

echo "$0 $@" > $logfile

for x

do

    echo $x >> $logfile

    if [[ $x =~ ^/tmp/ && -e $x ]]

    then

        (echo "------------"; echo "$x "; cat $x) >> $logfile

    fi

done

exec /usr/bin/mono --debug $MONO_OPTIONS /usr/lib/mono/4.5/vbnc.exe "$@" 2>&1 | tee -a $logfile

This lets you see the options used to compile the script and sync the code lines to stacktrace. The start of the log in this case read:

/usr/bin/vbnc /quiet /target:library /out:/tmp/gnq3bi3e.dll /r:System.dll /r:System.Core.dll /r:System.Xml.dll /r:System.Data.dll /r:Scheduler.dll /r:HomeSeerAPI.dll /r:Microsoft.VisualBasic.dll /r:System.Data.DataSetExtensions.dll /r:System.Data.Linq.dll /r:System.Xml.Linq.dll /r:HSCF.dll /r:Microsoft.VisualBasic.dll /t:library /tmp/gnq3bi3e.0.vb

/quiet

/target:library

/out:/tmp/gnq3bi3e.dll

/r:System.dll

/r:System.Core.dll

/r:System.Xml.dll

/r:System.Data.dll

/r:Scheduler.dll

/r:HomeSeerAPI.dll

/r:Microsoft.VisualBasic.dll

/r:System.Data.DataSetExtensions.dll

/r:System.Data.Linq.dll

/r:System.Xml.Linq.dll

/r:HSCF.dll

/r:Microsoft.VisualBasic.dll

/t:library

/tmp/gnq3bi3e.0.vb

------------

/tmp/gnq3bi3e.0.vb

<feff>Imports System

Imports System.Core

Imports System.Xml

Imports System.Data

Imports System.Linq

Imports System.Data.Linq

Imports Microsoft.VisualBasic

Imports Scheduler

Imports HomeSeerAPI

Imports HomeSeerAPI.CAPI

Imports System.Collections


Namespace scriptcode11

Class VBWrapper 

dim hs as object

public sub InitHS(newhs as object)

hs = newhs

end sub

'load object refs and speech methods


' import headers def


' Methods for sending messages to Pushbullet


Sub Main(ByVal params As String) 

    SendMsg(params)

End Sub

You will note the includes are missing since the start of my code ought to be:

'load object refs and speech methods

#Include SayIt.vb


' import headers def

#Include Secrets.vb


' Methods for sending messages to Pushbullet


Sub Main(ByVal params As String) 

    SendMsg(params)

End Sub

Most documentation says there is no Include support in vb. Which might explain why it does not work in mono though it worked in Windows VB as mentioned here and was working fine for me in my Windows instance. (Unfortunately all the scripts I had previously tried on my Pi test instance did not use includes.)  So now I'm looking at how to rewrite without using Includes. It looks like the best solution for me is to change all the SayIt.vb method calls to use RunScriptFunc instead.

Starting Over going from HS3 on Windows to HS4 on Windows instead.

After spending close to 2 weeks trying to sort getting HS4 on Linux to work only to have it crash on me yet again requiring a reboot of the machine to get the plugins working again I decided staying on Windows might make more sense for now. Especially since it appears my scripts will need major rewrites to work on Linux.  Note issues below were seen in both Windows and Linux unless otherwise noted.

Basic install

As suggested here I cloned my Homeseer HS3 folder to a Homeseer HS4 one then installed over that. Sort of a combo of the two options here. Note you will still need to go through the all config options even though it should know most of the info already.

St first glance most of the issues I saw moving to HS4 on Linux are not there. Even Alexa linkage is fine. Note you will need to go into events that call scripts to change the path if running them from the Homeseer HS3 folder is a problem for you. They seem to run fine that way though.

Fonts are a bit uneven so you might want to update C:\Program Files (x86)\HomeSeer HS4\html\css\Custom.css to look like this
/* Add style elements to this file to customize your HomeSeer Web Interface */
/* Any style elements in this file that are a duplicate of one in STYLE.CSS will override STYLE.CSS */
.jqDropList {
    font-family: Trebuchet MS,Tahoma,Verdana,Arial,sans-serif;
    font-size: 1em;
}

Plugins

Note you will probably need to tell your firewall to allow the plugins to talk again.

Hue / JowiHue

Everything seems to be like it was with no issues.

Harmony

Still using multiple instance like before unlike on Linux.

Events

Mostly they seem to have converted fine. Script path might need editing and a few values were not quite right but way better than on Linux. Unclear it this is a Linux upgrade issue or having to export and import events to convert all the Windows paths to Linux ones. I did still had few instances where the conversion still had the HS4 feature as the device like HS3 instead of converting. See Jon00 Event Viewer & Documenter for Homeseer 4 above. Note though some appear to show as broken in Jon00's tool even though they are working.

Sometimes device actions do not seem to allow editing of the device and you must remove and replace it instead.

Scripts

Are working fine without mod from HS3 versions. 

Updates:

3/2/2021

For some reason my Homeseer 4 server rebooted on 2/28/2021 and after it came back up the events.json file was the same size but filled with blanks. Note the Event view only shows a "was shutdown improperly" error. No errors or warnings for at least an hour before it came back up. Normally this would indicate a loss of  power but the unit is on its own 1500 watt UPS which will support it longer than most of my other servers and none of them dropped offline. So odd on multiple levels. 

I copied the backup file in place and things seemed to be OK. The next day I noticed some events did not seem to be running and I found what was happening was any scripts with includes (almost all of the ons I wrote) called by events were failing. Since this does not stop the event from completing you might not notice unless monitoring the log. This would seem to indicate the .Net framework upgraded to a version that no longer supports includes similar to what I found above on Linux but again no updates were logged for a couple days before the reboot and even then they were for Defender.

So I was left scrambling to rewrite all my scripts to not use includes. This mainly meant replacing "included" defines with global variables and "included" method calls with RunScriptFunc calls. 

Another issue I found was calling hs.SetDeviceString(dv.Ref(Nothing), "", True) yielded an error IL_013e. Trying to set it to a text value instead just changed the error code to IL_0105. A workaround was not quickly found but fortunately in this case it this was in cleanup code for BLRadar trial mods so just commenting it out for now was fine.

I was doing testing on Raspberry Pi HS3 instance to disrupt as little as possible and do double duty od hopefully vetting changes against both HS3 and Linux. Anyway there still seems to be an issue with Newtonsoft.Json on the Pi instance so probably CentOS as well. I'll need to sort that before attempting the move to Linux again but for now working under HS4 just adding to the todo queue as well.

1 comment: