greiginsydney / Homebridge-cbus-installer

An install script that automates the process
GNU General Public License v3.0
8 stars 4 forks source link

Toolkit wont connect to Pi (new Java 8?) - java.security file missing at Step 13. #37

Closed malowe1 closed 5 months ago

malowe1 commented 5 months ago

Extension of issues #28 & #35 ?

Step 13: sudo nano /usr/lib/jvm/java-8-openjdk-armhf/jre/lib/security/java.security now returns blank screen with: [ Directory '/usr/lib/jvm/java-8-openjdk-armhf/jre/lib/security' does not exist ]

No jvm directory visible - is this step still valid or am I doing something wrong??

@DarylMc - Hi

Have reviewed above issues - running through a fresh install (pi3b+, 32bit HB image, updated Java pre-req's, toolkit 1.16.3) following greiginsydney SETUP.md and your SETUP.md steps to the letter- all going well (a few quirks) until I try to open Remote Toolkit - so I do to your Step 12 and 13: Remove TLS V1 instructions to allow Toolkit to connect to pi. Suspect the updated Java 8 file might be causing me an issue? Any clues appreciated.

Cheers Mike

DarylMc commented 5 months ago

The security file is probably in a different location. I don't have a setup here to look at but perhaps you could Google how to search for a file from the command line. java.security

malowe1 commented 5 months ago

Thanks Daryl, pi@homebridge:~ $ find /usr/* -iname java.security shows location at: /usr/java/jdk1.8.0_381/jre/lib/security/java.security

Not /usr/lib/jvm/java-8-openjdk-armhf/jre/lib/security/java.security

Install script may not pick it up and move it?

DarylMc commented 5 months ago

Nice work Have a look at the file and see if you can unblock the TLS Let me know how you go.

malowe1 commented 5 months ago

The line numbering is a little further down (Go To Line (control shift underscore) 704,40) is more like 725,35

But I'll delete both TLSv1 and TLSv1.1 just to make sure.

image

malowe1 commented 5 months ago

Sorry Daryl, Help - I'm still looking for a fault/fix.

I still can't seem to connect to Toolkit / get homebridge-cbus running. The TLSv1 issue isn't my connection / communication problem.

CGate appears running fine. Cgate is running

Error log looks like this: 06/01/2024, 14:48:11] [homebridge-cbus] This plugin generated a warning from the characteristic 'Brightness': characteristic value expected valid finite number and received "undefined" (undefined). See https://homebridge.io/w/JtMGR for more info. 2024-01-06T04:18:11.677Z cbus:client rx response { commandId: 300, code: 401, matched: false, processed: false, type: 'response', raw: '[300] 401 Bad object or device ID.' } 2024-01-06T04:18:11.677Z cbus:client matched request '[300] get //14MFAIR/254/56/20 level # getOn' with response '[300] 401 Bad object or device ID.' (11 pending requests)

So its either my config file or project xml file. (or homebridge-cbus not set up as a child bridge?)

Config Extract looks fine:

"bridge": {
    "name": "Homebridge 14MFAIR",
    "username": "0E:FF:F2:54:22:26",
    "port": 51867,
    "pin": "111-22-333",
    "advertiser": "avahi"
},
"accessories": [],
"platforms": [
    {
        "name": "Config",
        "port": 8581,
        "auth": "form",
        "theme": "auto",
        "tempUnits": "c",
        "lang": "en",
        "platform": "config"
    },
    {
        "platform": "homebridge-cbus.CBus",
        "name": "CBus",
        "client_ip_address": "127.0.0.1",
        "client_controlport": 20023,
        "client_cbusname": "14MFAIR",
        "client_network": 254,
        "client_application": 56,
        "client_debug": true,
        "platform_export": "/home/pi/my-platform.json",
        "accessories": [
            {
                "type": "light",
                "id": 0,
                "name": "Play Area"
            },
            {..

xml file screenshot - highlighting text that I've checked or modified.

xml issues

DarylMc commented 5 months ago

@malowe1 Just noticed one thing. In your xml add the port number to the IP address. InterfaceAddress>127.0.0.1:10001</InterfaceAddress>

malowe1 commented 5 months ago

Bingo.. (50%) OK, so added the :10001 and now have Homebridge-cbus operational in Homekit 👍

Now Clipsal Toolkit (now v1.16.4) is still not talking to Pi so when I attempt to open remote session - Error 20053 - an error occured while initialising SSL... (Even though i've removed TLSv1 and TLSv1.1)

Do you know what else could be blocking Toolkit from opening remote session?

DarylMc commented 5 months ago

Maybe check the java.security file saved properly otherwise I'm not sure. Check access.txt file Eg "remote 192.168.0.255 Program" 255 being the entire subnet.

malowe1 commented 5 months ago

Thanks @DarylMc - confirming java.security and access file appear in order. I've been looking everywhere, I'll go back over the video you shared last June, keep plugging away or start from scratch again.

Not sure why my toolkit connection is such a challenge - can only assume it's from my project xml file being derived from a 'hard-wired' serial/COM connection and maintains the laptop settings and details.

The only other clue I've seen is a java exception ""CommandInterface.interpreter" java.lang.NullPointerException" per below log. But this is beyond me.

pi@homebridge:~ $ sudo service cgate status ● cgate.service - cgate Loaded: loaded (/etc/systemd/system/cgate.service; enabled; preset: enabled) Active: active (running) since Sat 2024-01-06 18:22:08 ACDT; 3h 59min ago Main PID: 458 (java) Tasks: 28 (limit: 1571) CPU: 35.884s CGroup: /system.slice/cgate.service └─458 /usr/bin/java -Djava.awt.headless=true -jar -noverify /usr/local/bin/cgate/cgate.jar

Jan 06 18:22:08 homebridge systemd[1]: Started cgate.service - cgate. Jan 06 18:22:14 homebridge java[458]: Clipsal C-Gate(TM) v2.11.4 (build 3251) Jan 06 18:22:17 homebridge java[458]: Logging to file: logs/event.txt Jan 06 18:22:17 homebridge java[458]: 20240106-182217 800 cgate - C-Gate started. Jan 06 18:22:17 homebridge java[458]: C-Gate is running. Jan 06 18:27:15 homebridge java[458]: Exception in thread "CommandInterface.interpreter" java.lang.NullPointerException Jan 06 18:27:15 homebridge java[458]: at gR.run(ProGuard:6275) Jan 06 18:27:15 homebridge java[458]: at java.lang.Thread.run(Thread.java:750) pi@homebridge:~ $

If I find cause or solution, will share details here.

DarylMc commented 5 months ago

@malowe1 @greiginsydney I did a fresh install using jdk-8u202-linux-arm32-vfp-hflt.tar.gz https://download.oracle.com/otn/java/jdk/8u202-b08/1961070e4c9b4e26a04e7f5a083f551e/jdk-8u202-linux-arm32-vfp-hflt.tar.gz I did not need to alter the java.security file and connected to remote CGate with Toolkit no problem. Thinking back the TLS problem was introduced by an update sometime in the past when the package was updated by apt. As far as updates go Clipsal still recommends jdk1.8.0_202 so I think it is best to use it in this application.

malowe1 commented 5 months ago

Thansk @DarylMc - for your fresh install, did you have to load the homebridge-cbus plugin via the UI or did the scripts handle all that for you? I noticed when I reflashed using greiginsyd's set-up steps & booted up the UI, the message "Error, homebridge-cbus plugin not registered." appeared and I simply installed it via plugin tab.

Given my current setup has Homebridge-CBus working with Homekit, but CBus Toolkit (Connect to Remote..) is not, I'll trial on a seperate SD Card, mirror your instructions re jdk1.8.0_202 & test until I'm confident the problem is isolated.

DarylMc commented 5 months ago

You can install the Homebridge CBus plugin following Greig's instructions or you could also do it in the web gui. Either way it needs to be done before running Greig's script.

malowe1 commented 5 months ago

@DarylMc - all working fine now for a couple of weeks - Homebridge and Toolkit are stable and finally communicating remotely. I'm wondering whether a few additional details in your "Pre-req's" section would help?

For myself and potentially other users, the default .xml project file in the tag folder as created by Clipsal CBus install is typically configured when CBUS Toolkit is installed.

"Description>C-Bus project generated from live network by C-Gate v2.11.5 (build 3260)</Description"

Unless I'm mistaken, the scripts don't change the properties in this file at step 1 or step 2? Therefore, instructions to check a few areas in .xml file might be needed prior or post installation steps.

I'm comfortable to close this issue now - thanks again for your time and support.

DarylMc commented 2 months ago

@DarylMc - all working fine now for a couple of weeks - Homebridge and Toolkit are stable and finally communicating remotely. I'm wondering whether a few additional details in your "Pre-req's" section would help?

For myself and potentially other users, the default .xml project file in the tag folder as created by Clipsal CBus install is typically configured when CBUS Toolkit is installed.

"Description>C-Bus project generated from live network by C-Gate v2.11.5 (build 3260)</Description"

Unless I'm mistaken, the scripts don't change the properties in this file at step 1 or step 2? Therefore, instructions to check a few areas in .xml file might be needed prior or post installation steps.

  • "Network>Local Network</TagName" (should be changed to "homebridge")
  • "Interface>InterfaceType>Serial</InterfaceType" (should be changed to "CNI")
  • "InterfaceAddress>Unavailable</InterfaceAddress" (should be changed to "127.0.0.1:10001")

I'm comfortable to close this issue now - thanks again for your time and support.

Clipsal puts some effort to keep Toolkit and CGate versions working together on the Windows platform. I've heard but never seen that uploading a damaged xml to the CBus network can brick devices. I'd always feel safer using a local CGate on a Windows machine to make changes to the CBus network and keep the known good project file there. Then you would only need to delete the old xml on the pi and move the new xml over. Maybe run the install script again if there is new group addresses to go to the config.json file.

Regarding the changes to interface type and IP address it probably could do with some instruction. Changing the project network details is quite trivial in CBus Toolkit and easy to reverse. This is also most easily and safely done within CBus Toolkit on the Windows machine in the project's network tab.

I'm not sure what you mean "Network>Local Network</TagName" in the project xml but the network tag name and number is just the network name and network number eg 254 which was setup in CBus Toolkit when you created the project. It doesn't need to be changed.

DarylMc commented 2 months ago

Screenshot 2024-05-01 at 1 19 02 PM