bwssytems / ha-bridge

Home automation bridge that emulates a Philips Hue light system and can control other systems such as a Vera, Harmony Hub, Nest, MiLight bulbs or any other system that has an http/https/tcp/udp interface. This is a compact impl to run on small format computers. This is impl started from this project https://github.com/armzilla/amazon-echo-ha-bridge.
Apache License 2.0
1.45k stars 199 forks source link

Persistant data storage for habridge #1311

Closed npaisnel closed 3 years ago

npaisnel commented 3 years ago

Just wondering where the 'other place' is that habridge stores its data.

I delete habridge.config devices.db ~habridge/data even replace the jar file with the latest jar now I am using 5.4.0-RC1 but on restart certain data is not purged.

If I have stuff on Bridge Control Page selected/ changed ...like 9 octet ID seed number Link Button Time Out Harmony IP address etc

on restart / reboot..habridge recreates the data folder and config file device.db file.

but the Bridge Control data I have previously saved...it still there

There must be some other persistent storage file holding this data?

Maybe this is the issue with Alexa not finding Devices...something in this "other persistent" data that iscausing this discovery headache?

bwssytems commented 3 years ago

The data storage without updates on startup command line defaults to the path relative to where the habridge is started. The documentation identifies how to change those paths on startup.

npaisnel commented 3 years ago

Will try and find that documentation..only searched the Wiki link at the top of this page so far ..

I see these places in the WebGUI but I am guessing there is another file that stores the Bridge Control data that is not accessible from the WebGUI

Screenshot 2021-05-06 at 15 22 54

npaisnel commented 3 years ago

So far I have only found https://github.com/bwssytems/ha-bridge#-dconfigfilefilepath

https://github.com/bwssytems/ha-bridge#configuration-path-and-file

There must be a third place ...that is what I am looking for ..I want to clear all old config and restart. deleting habridge.config and devices.db does not do that

even deleting the jar file and replacing with a new jar does not go back to a clean config.

npaisnel commented 3 years ago

The data storage without updates on startup command line defaults to the path relative to where the habridge is started. The documentation identifies how to change those paths on startup.

I cannot find ANYTHING other than those three /habridge/data/device.db /habridge/data/group.db /habridge/data/nabridge.config

There must be another file ? another location ?

The place where the "Bridge Control " page stores its data?

I delete habridge.config device.db

and still on restart data is saved.

I want to go to a clean "restart" everything to default

bwssytems commented 3 years ago

Sorry, for the confusion. The confiig file path is the only one, but make sure your other file paths in that config file point to the proper place.

npaisnel commented 3 years ago

Thank you for continuing to answer this. I am not for some reason making myself clear...sorry...

I will try again ...all i can do is repeat myself, phrasing it differently

This is getting very difficult for me to get you to understand what I am saying.

I have never changed any file paths. they are exactly as default.

i showed that in the picture. here, below As you can see the file path is

~/habridge/data for three files
group.db, habridge.config device/db

I delete those files. I delete the habridge/data directory

I restart the raspberry pi.

AFTER restart habridge/data is directory is re-created a new habridge file is created.

BUT DATA FROM THE PREVIOUS CONFIG is persistent across the restart.

WHERE IS this data that is persistent stored ? I delete habridge.config so it cannot be in there...

habridge/data/ has three files .

I am asking what is the Fourth file. where is the persistent data THAT IS NOT in habridge/data stored?

The data that I am referring to is the data on the page / tab called " Bridge Control " located at the webGUI http://IP-ADDRESS/#!/system

Entries on that page . Like: Harmony Address UPNP Response Port Link Button Timeout (seconds) ID Seed (start numbering from this value)

DO NOT GET DELETED ON RESTART EVEN WITH habridge.config deleted.

Screenshot 2021-05-13 at 06 17 14

bwssytems commented 3 years ago

There is no fourth file, it is only in the habridge.config file. Please post your habridge start up command.

npaisnel commented 3 years ago

[Unit] Description=Heyu Engine Wants=network.target After=network.target

[Service] Type=oneshot RemainAfterExit=yes User=pi Group=pi WorkingDirectory=/home/pi ExecStart=/usr/local/bin/heyu start ExecReload=/usr/local/bin/heyu restart ExecStop=/usr/local/bin/heyu stop

[Install] WantedBy=multi-user.target

npaisnel commented 3 years ago

Oh sorry ..wrong one

[Unit] Description=HA Bridge Wants=network.target After=network.target

[Service] Type=simple WorkingDirectory=/home/pi/habridge ExecStart=/usr/bin/java -jar -Dconfig.file=/home/pi/habridge/data/habridge.config /home/pi/habridge/ha-bridge.jar

[Install] WantedBy=multi-user.target

npaisnel commented 3 years ago

Light bulb moment

Is it because When I delete the habridge.config file..the service is still running

I am starting ha-bridge as a service. maybe I need to Stop the service..delete the files ..then re boot and restart the service?

Maybe that is why data is being saved even after deleting the habridge.config file?

npaisnel commented 3 years ago

YES..that was the issue.

before deleting the habridge.config folder need to

sudo systemctl stop habridge

THEN delete the habridge.config file

then

sudo systemctl start habridge