matthew wall <[email protected]> writes:

> i often wish that a driver could be standalone, i.e., not require
> weewx in order to run, test, and do useful things.  we typically write
> drivers now so that they have *some* of this independence, e.g., a
> hardware abstraction that talks to the driver and does things without
> weewx, even though weewx is required to actually load the driver file
> (because of the python dependencies).
>
> maybe weewx could use the home assistant interface for its drivers
> instead of the weewx api?  or maybe someone has defined a better, more
> generic way to talk to hardware?


That's sort of what I'm trying to suggest, separating into

  python module that lets (some python code)
  open/read/get-backfill/configure/etc., basically making the device
  interface pythonic but not really trying to change it.  This code
  would not be part of weewx, and could be used by other python
  programs.

  weewx driver, that adapts the device behavior to the weewx
  database/API


I don't think it would help to use the HA internal API.    It's all
about creating "entities", such as "sensor" which has a value and unit,
and then HA internally stores those in a DB and prunes them.  They have
whatever names the integration wants to call them, sort of
sensor.outside_temperature or switch.living_room_lamp.  Sensor values
are stored as they arrive.

weewx has a always-keep database, with a concept of archive records, and
a fixed schema into which data is put, because the skin layer and
general interop wants things organized the same way.  Plus, HA is
~entirely 'async def'.

So I was merely suggesting adopting the concept of splitting code into
"make the hardware look pythonic" and "adapt semantics to weewx".  I
suspect there is mostly that split in existing drivers, and am arguing
that forcing that harder by module separation would help abstraction,
understanding, maintainabilty and reuse.

-- 
You received this message because you are subscribed to the Google Groups 
"weewx-development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/weewx-development/rmi5x8zrp0u.fsf%40s1.lexort.com.

Reply via email to