Commit graph

2940 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
72c55c03f2
[WIP] Refactoring/extending models and parsers for Bluetooth entities. 2023-03-03 02:10:11 +01:00
a688e7102e
Changed default poll_interval for RunnablePlugin.
30 -> 15 seconds.
2023-03-03 02:00:48 +01:00
ead4513915
Added optional unit column to RawSensor entity. 2023-03-03 01:59:27 +01:00
94c4e52154
Mock PyOBEX.client in readthedocs conf.py 2023-03-03 01:58:32 +01:00
7be55e446f
Convert UUID objects to strings when serializing to JSON. 2023-03-02 21:58:26 +01:00
15fadb93bb
Added stand-alone connect and disconnect actions to bluetooth. 2023-02-25 01:59:35 +01:00
70d1bb893c
A cleaner way of calculating the success response attribute. 2023-02-25 01:58:09 +01:00
2dfb389630
Added remaining bluetooth entity types in _mappers.py. 2023-02-23 21:20:41 +01:00
a0556d3a42
Added PresenceSensor entities. 2023-02-23 01:42:26 +01:00
886b930e2f
Support for bluetooth devices with multiple temperature sensors. 2023-02-23 01:27:31 +01:00
56d693032a
Added DewPointSensor entities. 2023-02-23 01:23:04 +01:00
d212276247
Added PressureSensor entities. 2023-02-23 01:12:27 +01:00
dd3f683006
Added unit to bluetooth mappers whenever available. 2023-02-23 01:04:33 +01:00
d961e2a997
Added TimeDurationSensor entity. 2023-02-23 01:02:13 +01:00
c3e16f9f9d
Added support for heart rate sensor entities. 2023-02-23 00:55:55 +01:00
3dab94c346
Added StepsSensor detection to bluetooth. 2023-02-23 00:50:06 +01:00
e1b3d52706
Added StepsSensor entity. 2023-02-23 00:45:58 +01:00
dcab766cef
Only scan for the configured Bluetooth service UUIDs. 2023-02-22 03:36:16 +01:00
d8c429f4a8
Major improvements on the entities engine.
- Better logic to recursively link parent/children entities, so partial
  updates won't get lost.

- Removed `EntitiesCache` - it was too much to maintain while keeping
  consistent with the ORM, and it was a perennial fight against
  SQLAlchemy's own cache.

- Removed `EntityNotifier` - with no need to merge cached entities, the
  `notify` method has become much simpler and it's simply been merged
  in the `EntitiesRepository`.
2023-02-22 02:53:45 +01:00
9776921836
Better way of handling with RawSensor in bluetooth integration. 2023-02-22 02:26:51 +01:00
a5a923a752
Added BluetoothDeviceNewDataEvent.
These events handle the case where a Bluetooth device only publishes new
service data without advertising any additional updated properties.
2023-02-22 02:23:11 +01:00
dc7cbe743d
Refactored/improved RawSensor entity.
It will now automatically deal with most of the native types and convert
them to strings on the db.
2023-02-22 02:19:19 +01:00
b2ffc08c89
s/MultiValueSensor/CompositeSensor/g on smartthings 2023-02-22 02:18:12 +01:00
340fd08064
Removed some old type: ignore comments. 2023-02-22 01:29:51 +01:00
cf219d5a48
Added some more docstrings to entities. 2023-02-22 01:02:26 +01:00
7fa545d7f8
Merge branch 'master' into 29-generic-entities-support 2023-02-22 00:46:33 +01:00
c645ce6bb8
Bump version: 0.24.4 → 0.24.5 2023-02-22 00:32:57 +01:00
2b8a5fee88
Updated CHANGELOG 2023-02-22 00:32:39 +01:00
26d9aaa5b1
(Temporarily) specify sqlalchemy<2.0.0.
SQLAlchemy 2 has introduced several breaking changes that can break
several things in the application - especially where the code uses
`connection.execute()` with raw SQL statements.

We need to temporarily force the installation of versions from the 1.x
branch, while migrating the existing code to the new version.
2023-02-22 00:25:57 +01:00
bbc9647cb0
s/MultiValueSensor/CompositeSensor/g 2023-02-21 23:14:10 +01:00
2fa45fc5a3
Documentation and LINT fixes for sensor entities. 2023-02-21 23:10:05 +01:00
b4627ecd04 Removed deprecated use_unicode parameter from MPDClient 2023-02-20 20:35:33 +01:00
aa0b909fff
Use the TheengsDecoder to parse Bluetooth packets and map services to native entities. 2023-02-20 20:27:17 +01:00
73bf2446bd
Wrap bluetooth.connect in a per-device locked section. 2023-02-19 23:11:19 +01:00
9112239ac3
Better exception management in AsyncRunnablePlugin.
Exceptions that cause the termination of the plugin's loop should always
be logged as such, unless the plugin is supposed to stop and various
exceptions may occur upon teardown.
2023-02-19 23:03:27 +01:00
a6c36fa1c1
Added brand, model and model_id columns to BluetoothDevice. 2023-02-19 23:02:04 +01:00
68e6b271c1
Updated dist files 2023-02-19 22:58:20 +01:00
cb9b01c89f
Added raw_sensor metadata 2023-02-19 22:57:50 +01:00
72a9a9dfcf
LINT/type fixes 2023-02-19 22:56:45 +01:00
8aedc3c233
Recursively normalize child entities in EntityManager._normalize_entities 2023-02-18 17:51:57 +01:00
613e32e7c1
Extended number of supported events and data fields in Bluetooth integration. 2023-02-18 01:15:10 +01:00
7adae272a4
Merge branch 'master' into 29-generic-entities-support 2023-02-15 22:24:41 +01:00
08553f84b9
Added timeout parameter to websocket.send. 2023-02-15 22:23:15 +01:00
45664be44b
Removed deprecated backend.bluetooth.scanner.
Scan capabilities are now implemented on the `bluetooth` plugin itself.
2023-02-13 23:13:51 +01:00
471bc1fd3d
Updated dist files 2023-02-13 23:13:32 +01:00