Commit graph

29 commits

Author SHA1 Message Date
7e92d5f244
Added recursive .copy() method to Entity. 2023-03-09 22:35:31 +01:00
9f9ee575f1
Added _import_error_ignored_modules.
ImportErrors on these entity modules will be ignored when dynamically
loading them, since they have optional external dependencies and we
shouldn't throw an error if we can't import them.
2023-03-09 01:40:35 +01:00
c4efec6832
Several fixes and improvements on the entities engine.
- Support for an optional callback on `publish_entities` to get notified
  when the published object are flushed to the db.

- Use `lazy='selectin'` for the entity parent -> children relationship -
  it is more efficient and it ensures that all the data the application
  needs is loaded upfront.

- `Entity.entity_key` rolled back to `<external_id, plugin>`. The
  fallback logic on `<id, plugin>` created more problems than those it
  as supposed to solve.

- Added `expire_on_commit=False` to the entities engine session to make
  sure that we don't get errors on detached/expired instances.
2023-03-09 01:16:04 +01:00
1781a19a79
s/Entity.to_json/Entity.to_dict/g
stuff
2023-03-06 23:46:33 +01:00
b9efa9fa30
entity_key should coalesce (entity.external_id or entity.id) 2023-03-06 16:54:02 +01:00
9a5e2899e8
Support for external_url and image_url on entities 2023-01-15 20:01:47 +01:00
c32aecece3
Added is_configuration flag to entities 2023-01-03 23:12:27 +01:00
1c811a490f
Don't serialize children_ids in Entity.to_json()
Serializing both children_ids and parent_id can result in nasty
SQLAlchemy bugs, especially when handling objects that haven't been
flushed yet.
2023-01-01 12:47:15 +01:00
2feaba7bf4
Add children_ids attribute to entities when converted to JSON 2022-12-18 21:03:12 +01:00
b0464219d3
Large refactor of the entities engine. 2022-12-17 21:41:23 +01:00
0edd73690b
Modelling of parent/children relationships on entity level 2022-11-28 21:36:00 +01:00
86edd70d93
Fixed session/concurrency management on the main SQLite db
- The `declarative_base` instance should be shared
- Database `session_locks` should be stored at module, not instance
  level
- Better isolation of scoped sessions
- Enclapsulated `get_session` method in `UserManager`
2022-11-12 15:36:17 +01:00
6b7933cd33
Using a different SQLite database for entities
This prevents multiprocessing/concurrency issues when modifying the same
database file both from the main process and from the web server process
2022-11-12 02:00:55 +01:00
02a4c9f667
Added is_query_disabled attribute to entities 2022-11-11 20:40:36 +01:00
041f64c80f
Dirty workaround to prevent redefinition of SQLAlchemy ORM model classes 2022-10-10 01:38:15 +02:00
5f09d449f4
extend_existing=True for entity tables 2022-10-09 23:15:50 +02:00
6ec8a991df
Fixed tests 2022-10-08 15:18:26 +02:00
1df71cb54a
Proper support for light entities on smartthings 2022-05-30 09:23:05 +02:00
7df67aca82
updated_at should have utcnow() onupdate, not now() 2022-04-30 01:48:55 +02:00
47f8520f3b
Added support for description/read_only/write_only on entity level 2022-04-24 22:18:29 +02:00
f52b556219
- icon_class should not be part of the backend model
- Interaction with entities should occur through the `entities.action`
  method, not by implementing native methods on each of the model
  objects
2022-04-08 16:49:47 +02:00
947b50b937
Added meta as a JSON field on the Entity table
Metadata attributes can now be defined and overridden on the object
itself, as well as on the database. Note that db settings will always
take priority in case of value conflicts.
2022-04-07 22:11:31 +02:00
db7c2095ea
Implemented meta property for entities (for now it only include icon_class) 2022-04-07 18:09:25 +02:00
44707731a8
Normalize UTC timezone on all the entity timestamps 2022-04-07 01:13:29 +02:00
2eeb1d4fea
Entity objects are now JSON-able 2022-04-07 00:21:54 +02:00
061268cdaf
Support for direct actions on native entities [WIP] 2022-04-05 23:22:54 +02:00
fe0f3202fe
columns should be a property of the Entity object 2022-04-05 23:04:19 +02:00
8a70f1d38e
Replaced deprecated sqlalchemy.ext.declarative with sqlalchemy.orm 2022-04-05 22:47:44 +02:00
4ee7e4db29
Basic support for entities on the local db and implemented support for switch entities on the tplink plugin 2022-04-04 16:50:17 +02:00