Thursday, November 12, 2020

Setting Raspberry Pi to show name and clock when idle

 Whether connecting to console or VNC it does not hurt to be able to see the system is working and confirm you are on the right machine quickly when you have a few online.

First install the basic screen savers with

sudo apt-get install xscreensaver*

Start XScreenSaver. 


Under Display Modes, select Only One Screen Saver. Then scroll down and select GLText as your screen saver.


Click Settings. Select Display Date and Time and Always Face Front. Make sure that the check box next to Wander is selected. From the drop-down menu, select Don’t Rotate. Choose the frame rate that you want. 


Click the Advanced Tab. In the Text Manipulation field, click the radio button beside Text. In the field add your hostname and %n (UPSMon62 in this example)


For further customization variables see strftime.org For instance I prefer this




Sunday, September 27, 2020

HS3 on Windows to HS4 on Centos 7 migration.

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.

Steps I did

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.