Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:post-factum:monitoring
airco2ntrold
_service:obs_scm:airco2ntrold-src.obscpio
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File _service:obs_scm:airco2ntrold-src.obscpio of Package airco2ntrold
07070100000000000081A400000000000000000000000162B32A87000000DB000000000000000000000000000000000000002600000000airco2ntrold-src/98-airco2ntrol.rulesACTION!="remove", SUBSYSTEMS=="usb", ATTRS{idVendor}=="04d9", ATTRS{idProduct}=="a052", TAG+="systemd", ENV{SYSTEMD_ALIAS}="/sys/subsystem/usb/devices/airco2ntrol", MODE="0660", OWNER="airco2ntrol", GROUP="airco2ntrol" 07070100000001000081A400000000000000000000000162B32A8700000036000000000000000000000000000000000000002600000000airco2ntrold-src/airco2ntrol.sysusersu airco2ntrol - "AIRCO2NTROL" - - g airco2ntrol - - - 07070100000002000081ED00000000000000000000000162B32A87000005E4000000000000000000000000000000000000001E00000000airco2ntrold-src/airco2ntrold#!/usr/bin/env python import logging import os import signal import time import hid from prometheus_client import start_http_server, Gauge, REGISTRY for i in list(REGISTRY._collector_to_names.keys()): REGISTRY.unregister(i) AC_VENDOR = 0x04d9 AC_PRODUCT = 0xa052 AC_BOOTUP_TIME = 15 AC_POLL_INTERVAL = 30 AC_METRICS_PORT = 64906 CLIMATE_CO2_ROOM = Gauge('climate_co2_room', 'Room CO₂ concentration in ppm') device = None logger = logging.getLogger(__name__) logger.setLevel(logging.DEBUG) def open_device(): global device time.sleep(AC_BOOTUP_TIME) device = hid.device() device.open(AC_VENDOR, AC_PRODUCT) device.send_feature_report([ 0x00, 0x00 ]) def poll_device(): co2 = None while co2 is None: data = list(device.read(8, 10000)) key = data[0] value = data[1] << 8 | data[2] if (key == 0x50): co2 = value # for temperature: # key == 0x42 # value / 16.0 - 273.15 CLIMATE_CO2_ROOM.set(co2) def close_device(): device.close() def graceful_exit(): close_device() exit(os.EX_OK) def sigterm_handler(_signo, _stack_frame): graceful_exit() if __name__ == '__main__': signal.signal(signal.SIGINT, sigterm_handler) signal.signal(signal.SIGTERM, sigterm_handler) open_device() ready = False while True: poll_device() if not ready: ready = True start_http_server(AC_METRICS_PORT) time.sleep(AC_POLL_INTERVAL) 07070100000003000081A400000000000000000000000162B32A870000038B000000000000000000000000000000000000002C00000000airco2ntrold-src/airco2ntrold-proxy.service[Unit] Requires=airco2ntrold-proxy.socket After=airco2ntrold-proxy.socket JoinsNamespaceOf=airco2ntrold.service BindsTo=airco2ntrold.service [Service] User=airco2ntrol Group=airco2ntrol CapabilityBoundingSet= RestrictAddressFamilies=AF_INET RestrictNamespaces=true IPAddressAllow=localhost IPAddressDeny=any NoNewPrivileges=true PrivateDevices=true PrivateUsers=true ProtectClock=true ProtectControlGroups=true ProtectHome=true ProtectKernelLogs=true ProtectKernelModules=true ProtectKernelTunables=true ProtectProc=invisible ProcSubset=pid ProtectSystem=strict RestrictSUIDSGID=true SystemCallArchitectures=native SystemCallFilter=@system-service SystemCallFilter=~@privileged @resources RestrictRealtime=true LockPersonality=true MemoryDenyWriteExecute=true RemoveIPC=true UMask=0066 ProtectHostname=true ExecStart=/usr/lib/systemd/systemd-socket-proxyd 127.0.0.1:64906 PrivateTmp=yes PrivateNetwork=yes 07070100000004000081A400000000000000000000000162B32A8700000041000000000000000000000000000000000000002B00000000airco2ntrold-src/airco2ntrold-proxy.socket[Unit] BindsTo=airco2ntrold.service [Socket] ListenStream=64906 07070100000005000081A400000000000000000000000162B32A87000003EC000000000000000000000000000000000000002600000000airco2ntrold-src/airco2ntrold.service[Unit] Description=Poll AITCO2NTROL device and export Prometheus metrics After=sys-subsystem-usb-devices-airco2ntrol.device BindsTo=sys-subsystem-usb-devices-airco2ntrol.device Requires=airco2ntrold-proxy.socket [Service] User=airco2ntrol Group=airco2ntrol RemoveIPC=true CapabilityBoundingSet= NoNewPrivileges=true ProtectKernelLogs=true ProtectControlGroups=true ProtectKernelModules=true PrivateMounts=true SystemCallArchitectures=native MemoryDenyWriteExecute=true RestrictNamespaces=true RestrictSUIDSGID=true ProtectHostname=true LockPersonality=true ProtectKernelTunables=true RestrictAddressFamilies=AF_INET AF_NETLINK RestrictRealtime=true ProtectSystem=strict ProtectProc=invisible ProcSubset=pid ProtectHome=true PrivateNetwork=true IPAddressAllow=localhost IPAddressDeny=any PrivateUsers=true PrivateTmp=true SystemCallFilter=@system-service SystemCallFilter=~@resources @privileged UMask=0066 ExecStart=/usr/bin/airco2ntrold [Install] WantedBy=sys-subsystem-usb-devices-airco2ntrol.device 07070100000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000B00000000TRAILER!!!10 blocks
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor