Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

PHAL Sensors

This plugin reads sensor data from an OVOS device and sends it to other systems. It supports three outputs:

  • Messagebus events
  • Home Assistant
  • MQTT

Each sensor gets a unique identifier in the format sensor.ovos_{name}_{sensor_id}.

imagem

Install

pip install ovos-PHAL-sensors

Some sensors need extra packages:

  • pulseaudio sensors: pip install pulsectl
  • screen sensors: pip install screen-brightness-control
  • bluetooth sensors: pip install pybluez2
  • the MQTT sensor logger: pip install ha-mqtt-discoverable

Config

{
  "PHAL": {
    "ovos-PHAL-sensors": {
      "name": "my_phal_device",
      "time_between_checks": 15,
      "screen_sensors": true,
      "battery_sensors": true,
      "cpu_sensors": true,
      "memory_sensors": true,
      "network_sensors": true,
      "fan_sensors": true,
      "os_sensors": true,
      "apps_sensors": true,
      "pulseaudio_sensors": true,
      "bluetooth_sensors": true,
      "disable_bus": false,
      "disable_ha": false,
      "disable_filelog": true,
      "mqtt_config": {"host":  "192.168.1.8", "port": 1883},
      "ha_host": "http://192.168.1.8:8123",
      "ha_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiI2NGZmODYxY2M3ZDE0ZDZmODQ5..."
    }
  }
}
  • name: the device name the sensors belong to
  • time_between_checks: time to wait between sensor readings
  • disable_bus: set to true to stop sending readings to the messagebus
  • disable_ha: set to true to stop sending readings to Home Assistant
  • disable_filelog: set to true to stop logging readings to a file
  • ha_host (optional): the Home Assistant URL. Defaults to the host set in ovos-PHAL-plugin-homeassistant, if configured there.
  • ha_token (optional): the Home Assistant long-lived access token. Defaults to the token set in ovos-PHAL-plugin-homeassistant, if configured there.
  • mqtt_config (optional):
        host: str
        port: Optional[int] = 1883
        username: Optional[str] = None
        password: Optional[str] = None
        client_name: Optional[str] = None
        tls_key: Optional[str] = None
        tls_certfile: Optional[str] = None
        tls_ca_cert: Optional[str] = None

        discovery_prefix: str = "homeassistant"
        """The root of the topic tree where HA is listening for messages"""
        state_prefix: str = "hmd"
        """The root of the topic tree ha-mqtt-discovery publishes its state messages"""

Sensor loggers

The plugin ships four sensor data loggers:

  • HomeAssistant HTTP: sends readings to Home Assistant when ha_host and ha_token are set
  • Messagebus: emits readings as bus messages
  • FileLogger: saves readings to ~/.local/state/sensors/readings.log
  • MQTT: sends readings to MQTT, compatible with Home Assistant. Use this instead of the HA logger.
Message("ovos.phal.sensor",
         {"state": sensor.value,
          "sensor_id": f"{name}_{unique_id}",
          "device_name": name,
          "name": unique_id,
          "attributes": sensor.attrs})

Message("ovos.phal.binary_sensor",
         {"state": sensor.value,
          "sensor_id": f"{name}_{unique_id}",
          "device_name": name,
          "name": unique_id,
          "attributes": sensor.attrs})

Sensors

PulseAudio

PAHostnameSensor
PAVersionSensor
PAChannelCountSensor
PAPlaybackSensor
PABluezActiveSensor
PABluezConnectedSensor
PANowPlayingSensor
PADefaultSourceSensor
PADefaultSinkSensor
PAAudioPlayingSensor

OS Info

OSNameSensor
OSSystemSensor
BootTimeSensor
ReleaseSensor
MachineSensor
ArchitectureSensor

Running Applications

SystemdSensor
DBUSDaemonSensor
KDEConnectSensor
PipewireSensor
PlasmaShellSensor
PulseAudioSensor
FirefoxSensor
SpotifySensor
MiniDLNASensor
UPMPDCliSensor

Memory Usage

MemoryTotalSensor
MemoryUsageSensor
SwapUsageSensor
SwapTotalSensor
DiskUsageSensor
DiskPercentSensor
DiskTotalSensor

CPU Usage

CPUTemperatureSensor
CPUUsageSensor
CPUCountSensor

Network Sensors

LocalIPSensor
ExternalIPSensor

Screen Sensors

ScreenBrightnessSensor

Battery Sensors

BatterySensor
BatteryChargeSensor
BatteryCurrentSensor
BatteryStoredEnergySensor
BatteryPowerSensor
BatteryStatusSensor
BatteryVoltageSensor

Fan Sensors

CpuFanSensor
GpuFanSensor

BluetoothSensors

BluetoothDevicePresence
BluetoothDeviceName
BluetoothSpeakerConnected

Related projects

License

Apache-2.0

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ovos_phal_sensors-0.0.0a19.tar.gz (20.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ovos_phal_sensors-0.0.0a19-py3-none-any.whl (26.2 kB view details)

Uploaded Python 3

File details

Details for the file ovos_phal_sensors-0.0.0a19.tar.gz.

File metadata

  • Download URL: ovos_phal_sensors-0.0.0a19.tar.gz
  • Upload date:
  • Size: 20.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for ovos_phal_sensors-0.0.0a19.tar.gz
Algorithm Hash digest
SHA256 0aa7d30316d7546668f3f8a5df8c49660941708d2aaf384d666d4bc1dc0cddc8
MD5 0e03c736dbb4b78009b337ea8ca9183f
BLAKE2b-256 d63581ede9b4887f2284acecae4f63defd1ae6c3231dd2da1535ff472d9a534a

See more details on using hashes here.

File details

Details for the file ovos_phal_sensors-0.0.0a19-py3-none-any.whl.

File metadata

File hashes

Hashes for ovos_phal_sensors-0.0.0a19-py3-none-any.whl
Algorithm Hash digest
SHA256 ee94dbf17a048913bd2e710653c04b0adcca2ca320c8d23de907fa3f609e2547
MD5 de69b1ee638ec03b461a533c2ef2307c
BLAKE2b-256 efd71f4e9a323b619a28fcb055447d3630666b37f414ce9cdcba6150a0469343

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page