Fabio Manganiello
06dfd1a152
Added support for more entities in `switchbot`
2023-02-05 15:34:50 +01:00
Fabio Manganiello
be3b99326f
[WIP] Refactoring `@manages` annotation into a proper `EntityManager` hierarchy
2023-02-02 23:21:12 +01:00
Fabio Manganiello
59eb0742a1
s/warnings/logger.debug/ if publish_entities is called with no engine registered
2023-01-29 21:52:12 +01:00
Fabio Manganiello
8aff181956
Merged `zwave.mqtt` backend into the `zwave.mqtt` plugin
2023-01-29 02:34:48 +01:00
Fabio Manganiello
afdeb91f66
Implemented remaining supported entities for the `smartthings` integration
2023-01-26 22:10:02 +01:00
Fabio Manganiello
147f36c86c
All `Sensor` instances should have `is_read_only=True` by default
2023-01-22 21:05:14 +01:00
Fabio Manganiello
fd76642082
Added `Volume` and `Muted` entities
2023-01-22 21:04:46 +01:00
Fabio Manganiello
dfb13127ee
Added MotionSensor entities
2023-01-21 14:47:18 +01:00
Fabio Manganiello
9a5e2899e8
Support for external_url and image_url on entities
2023-01-15 20:01:47 +01:00
Fabio Manganiello
a58caa17e2
Decreased time of EventQueue (2 -> 1 second) to make entity events more responsive
2023-01-13 23:28:58 +01:00
Fabio Manganiello
38438230d7
The batch of entities currently being processed should have no duplicate keys
2023-01-11 01:22:56 +01:00
Fabio Manganiello
e9c84ff5d4
Support units on dimmer entities
2023-01-09 01:01:05 +01:00
Fabio Manganiello
c32aecece3
Added is_configuration flag to entities
2023-01-03 23:12:27 +01:00
Fabio Manganiello
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
Fabio Manganiello
2feaba7bf4
Add children_ids attribute to entities when converted to JSON
2022-12-18 21:03:12 +01:00
Fabio Manganiello
3615a269fe
Use Float instead of Numeric on NumericSensor table.
...
The Numeric type may have casting/rounding issues with SQLite.
2022-12-18 15:25:22 +01:00
Fabio Manganiello
5763c5e0ba
Don't use the entities cache when upserting entities.
...
This may make things a bit less optimal, but it's probably the only
possible solution that preserves my sanity.
Managing upserts of cached instances that were previously made transient
and expunged from the session is far from easy, and the management of
recursive parent/children relationships only add one more layer of
complexity (and that management is already complex enough in its current
implementation).
2022-12-18 15:13:21 +01:00
Fabio Manganiello
b0464219d3
Large refactor of the entities engine.
2022-12-17 21:41:23 +01:00
Fabio Manganiello
ecba72935f
Check for table metadata existance in `Base.metadata` instead of having a separate entity registry
2022-12-04 16:28:46 +01:00
Fabio Manganiello
abaeabea22
Implemented recursive merges of parent/child relationships in entities
2022-11-30 00:50:53 +01:00
Fabio Manganiello
0edd73690b
Modelling of parent/children relationships on entity level
2022-11-28 21:36:00 +01:00
Fabio Manganiello
78c59f437a
Added support for illuminance sensor entities
2022-11-27 22:38:58 +01:00
Fabio Manganiello
b9e6614b04
Added support for `EnumSensor` entities
2022-11-21 00:04:07 +01:00
Fabio Manganiello
69e097707d
Don't lock read session from the main database
2022-11-12 16:10:57 +01:00
Fabio Manganiello
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
Fabio Manganiello
bfeb0a08c4
Encapsulate `_get_session` in `EntityManager`
2022-11-12 15:14:10 +01:00
Fabio Manganiello
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
Fabio Manganiello
02a4c9f667
Added is_query_disabled attribute to entities
2022-11-11 20:40:36 +01:00
Fabio Manganiello
00a43dd1f8
Implemented `EnumSwitch` entity type
...
Done for `zigbee.mqtt`, other plugins will follow
2022-11-11 01:46:38 +01:00
Fabio Manganiello
801ed05684
Added support for binary sensors (in zigbee.mqtt for now)
2022-11-05 01:47:50 +01:00
Fabio Manganiello
64513be6b8
Initial implementation of sensor entities.
...
Implemented (at least in `zigbee.mqtt`, for now):
- `TemperatureSensor`
- `HumiditySensor`
- `VoltageSensor`
- `CurrentSensor`
- `EnergySensor`
- `PowerSensor`
- `NumericSensor` (generic fallback 1)
- `RawSensor` (generic fallback 2)
- `Sensor` (root class)
2022-11-02 16:38:17 +01:00
Fabio Manganiello
a1cf671334
Added support for link_quality entities to `zigbee.mqtt`
2022-10-30 11:03:22 +01:00
Fabio Manganiello
691d109fb7
Expunge entities after session commit to ensure that the ORM objects can be reused
2022-10-30 11:00:09 +01:00
Fabio Manganiello
d61b053f72
Support for battery entities
2022-10-29 13:38:42 +02:00
Fabio Manganiello
951950c864
Added dimmer entities
2022-10-23 00:30:32 +02:00
Fabio Manganiello
d7278857e5
Ensure that no records with duplicate key exist within an SQLAlchemy session before flushing
2022-10-23 00:28:42 +02:00
Fabio Manganiello
041f64c80f
Dirty workaround to prevent redefinition of SQLAlchemy ORM model classes
2022-10-10 01:38:15 +02:00
Fabio Manganiello
5f09d449f4
`extend_existing=True` for entity tables
2022-10-09 23:15:50 +02:00
Fabio Manganiello
6ec8a991df
Fixed tests
2022-10-08 15:18:26 +02:00
Fabio Manganiello
1df71cb54a
Proper support for light entities on smartthings
2022-05-30 09:23:05 +02:00
Fabio Manganiello
30a024befb
Manage hue/sat/bri/ct light ranges on the light entity object itself
2022-04-30 19:38:50 +02:00
Fabio Manganiello
7df67aca82
updated_at should have utcnow() onupdate, not now()
2022-04-30 01:48:55 +02:00
Fabio Manganiello
975d37c562
Added relevant attributes to `light` entities
2022-04-29 23:29:04 +02:00
Fabio Manganiello
90f067de61
Added `reachable` flag to device entities
2022-04-29 23:27:35 +02:00
Fabio Manganiello
f45df5d4d3
Explictly cast entity IDs to strings when coalescing entity updates
...
Some plugins may represent entity IDs as integers, while the database
maps external IDs to strings. This may result in entities being
incorrectly mapped during merging. Casting to string prevents these
type-related ambiguities.
2022-04-29 23:24:28 +02:00
Fabio Manganiello
47f8520f3b
Added support for description/read_only/write_only on entity level
2022-04-24 22:18:29 +02:00
Fabio Manganiello
ef6b57df31
Added entity info modal and (partial) support for renaming entities
2022-04-23 01:01:14 +02:00
Fabio Manganiello
e6bfa1c50f
Better dynamic entities discovery
2022-04-13 11:25:14 +02:00
Fabio Manganiello
2aa8778078
Do not process EntityUpdateEvents only in case of payload changes
...
The UI relies on these events upon refresh to detect if a device is
still reacheable. Therefore, we shouldn't mask them if we don't detect
any changes with the current entity configuration/state.
2022-04-12 00:41:20 +02:00
Fabio Manganiello
f17245e8c7
Send an EntityUpdateEvent only if an entity has already been persisted
...
If an event comes from an entity that hasn't been persisted yet on the
internal storage then we wait for the entity record to be committed
before firing an event. It's better to wait a couple of seconds for the
database to synchronize rather than dealing with entity events with
incomplete objects.
2022-04-11 00:38:11 +02:00