Comments (20)
It's a topic of the new homebridge plugin structure. I need to implement an accessory remover that can erase single accessories without deleting all of the data.
from homebridge-knx.
Now there is a tiny webserver at {yourIp}:18081/list
that shows which devices (accessories) are in the homebridge cache:
Restored devices from homebridge cache:
Device Arbeitszimmerlampe
Device Arbeitszimmerrollo
Device TestDevice
Next step is to make them deletable.
from homebridge-knx.
OK I will take a look tomorrow.
But whats about making a hash over the device configuration and store it together with the cache.
And compare this hash every time homebridge is starting up again and if the hash is changed during the startup the cache of the device with the changed hash value need to be also deleted...
from homebridge-knx.
The hash is already there. I could include a setting to tell homebridge-KNX to remove all accessories that were loaded from cache but are not found in the configuration.
The UUID fields that homebridge-knx writes to the config are the keys that can be used to identify accessories. That's why users must not change them after first startup.
from homebridge-knx.
Sorry misunderstood your post. You want to re-create the whole device if it was changed. That would mean removing it from any scene, room etc if you change a group address- I don't think that's a good idea.
from homebridge-knx.
my idea was to remove devices that are no longer in the config file and more important to remove the cache of changed devices. most time when you try out new things you do step by step modifications on the same device and homebridge do not care this changes inside the device or show the device twice (old and new version) :-(
from homebridge-knx.
Homebridge caches the accessories, and they are identified on startup by their UUID strings (services with their subtype strings). Those strings are written to the knx_config.json.
So when you change the knx_config you should always start with the version from the homebridge server, and not with a fresh one, because with a fresh knx_config will not match any of the cached devices, and you have all devices twice.
I will implement the accessory remover that will do both - be able to delete orphaned devices (no config entry) and delete the cache of existing devices in order to reload the device on next startup.
How ever, I will not be able to work on that probably for the next days, until then you will need to delete the accessories folder in the homebridge folder to reload the accessories from the config.
from homebridge-knx.
OK Thanks.
In the past I never copied the knx_config.json from the RasPI back to modify it. I think I need to do it from now on.
from homebridge-knx.
I just committed some changes for the cached accessories.
You can now open a browser at http://yourServerNameOrIP:18081/list
and delete accessories from the cache. right now, only accessories that were already in the cache when homebridge started are shown. So you probably need to restart homebridge twice if you want to make changes to a new device.
from homebridge-knx.
Fun thing is: they immediately vanish in Home 😄
from homebridge-knx.
Next push: shows also devices from knx_config.json that were not loaded from cache at startup.
from homebridge-knx.
sounds good. I will give it a try right now...
from homebridge-knx.
I did try to delete a device from the cache with the web gui and get this error:
/usr/local/lib/node_modules/homebridge/lib/api.js:166
throw new Error(pluginName + " - " + platformName + " attempt to unregister an accessory that isn't PlatformAccessory!");
^
Error: undefined - undefined attempt to unregister an accessory that isn't PlatformAccessory!
at API.unregisterPlatformAccessories (/usr/local/lib/node_modules/homebridge/lib/api.js:166:13)
at KNXPlatform. (/usr/local/lib/node_modules/homebridge-knx/index.js:263:20)
at emitTwo (events.js:87:13)
at Server.emit (events.js:172:7)
at HTTPParser.parserOnIncoming as onIncoming
at HTTPParser.parserOnHeadersComplete (_http_common.js:88:23)
during next start (after the crash) the status web page looks like this::
(2 devices are shown as cached and also as new loaded and the device I tried to delete from the cache is not shown at all.
Restored devices from homebridge cache:
Device Einbruchmeldezentrale alpha [Delete from cache!]
Device Test alpha [Delete from cache!]
Devices from homebridge-knx config:
Device Einbruchmeldezentrale alpha [Delete from cache!]
Device Test alpha [Delete from cache!]
from homebridge-knx.
Strange. Have to investigate this evening.
from homebridge-knx.
Did you manage to click twice on the delete
link? Because it got deleted - a second attempt to delete the same accessory will exactly look like your error.
from homebridge-knx.
I don't think I clicked twice, but who knows. Later today during a second try it worked without a crash.
from homebridge-knx.
Maybe I can see to catch that possibility in the code, later this weekend maybe.
from homebridge-knx.
Caught in latest commit - a little nasty with a try-catch block but should suffice for that.
from homebridge-knx.
All devices that were present at startup occur twice in the list - once as read from cache, and once as read from knx_config.json:
from homebridge-knx.
Now you can even restart homebridge - given that you have it running as a systemd service with restart option, or are using forever to restart it if it fails:
It simply throws an exception ("Committed_Suicide") and that kills the node process as all unhandled exceptions kill it.
from homebridge-knx.
Related Issues (20)
- Neuer KNXSceneSelectorSwitch Handler AddIn HOT 3
- no status update on HomeKit HOT 2
- Humidity (9.007) shows wrong in Home.app HOT 4
- Controlling window covering without current and target position information
- ADDIN without reaction HOT 2
- HomeKit Sensor Status HOT 2
- strange issue with Siri voice command. HOT 1
- Question: Possibility to use KNX Address/UUID as Serialnumber HOT 1
- Question: Thermostat - How to red current temperature value with 0.1 degrees step? HOT 2
- Save the state of some lights HOT 1
- Group Address Level-2
- Question: Temperature is updated on start-up only
- How to configure devices for specific rooms HOT 4
- Lastest version of this plugin (0.3.27) can only run on an old version of homebridge >=0.4.28 <= 0.4.53 and Node 10 HOT 1
- GarageDoorOpenerAdvanced Rückmeldung Kontakt funktioniert nicht richtig HOT 12
- Homebridge Crash (AssertionError) after upgrading to v0.4.3 HOT 10
- v0.4.3 Status Jalousien HOT 6
- TypeError: Cannot read properties of undefined (reading 'knxd') HOT 1
- Deleted Property "MinValue" still throws errors after deleting/updating JSON-file. HOT 1
- KNX Typescript support
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from homebridge-knx.