Skip to content

Instantly share code, notes, and snippets.

View ohadlevy's full-sized avatar

Ohad Levy ohadlevy

  • Red Hat
  • Israel
View GitHub Profile
@ohadlevy
ohadlevy / capture_commands.py
Created October 12, 2025 13:53
c1000x capture
#!/usr/bin/env python3
"""Capture MQTT commands sent by mobile app to understand C1000X control protocol."""
import asyncio
import json
import logging
from datetime import datetime
from pathlib import Path
from aiohttp import ClientSession
# Template sensor for values of power import (active_power > 0)
charging_amps:
friendly_name: "desired charging amps "
unit_of_measurement: 'A'
value_template: >-
{%- set min = 0 -%}
{%- set amps = min -%}
{%- set max = 13 -%}
{%- set voltage = ((states('sensor.tesla_charger_voltage') |float )) -%}
{%- set export = ((states('sensor.power_export') |float) / voltage ) -%}
#! /bin/sh -ex
IMG_URL=$1
IMAGE='/tmp/image.iso'
BASE_URL='http://192.168.2.160:8080'
IPXE_DIR='/tmp/ipxe'
KERNEL_OPTS='random.trust_cpu=on rd.luks.options=discard ignition.firstboot ignition.platform.id=metal console=tty0 console=ttyS0,115200n8'
ISO_MNT=`mktemp -d`
mkdir -p $IPXE_DIR
#! /bin/sh -e
URL=$1
MOUNT='mount -o loop,ro image'
KERNEL='images/vmlinuz'
INITRD='images/initramfs.img'
KERNEL_ARG='mitigations=auto,nosmt systemd.unified_cgroup_hierarchy=0 coreos.liveiso=fedora-coreos-31.20200319.dev.1 rd.neednet=1 ip=dhcp ignition.firstboot ignition.platform.id=metal'
TMP=`mktemp -d`
SELinux is preventing 11-dhclient from add_name access on the directory ntp.conf.predhclient.wlp58s0.
***** Plugin catchall (100. confidence) suggests **************************
If you believe that 11-dhclient should be allowed add_name access on the ntp.conf.predhclient.wlp58s0 directory by default.
Then you should report this as a bug.
You can generate a local policy module to allow this access.
Do
allow this access for now by executing:
# ausearch -c '11-dhclient' --raw | audit2allow -M my-11dhclient
react-dom.production.min.js:187 Error: No translation key found.
at p.dcnpgettext (jed.js:260)
at p.gettext (jed.js:172)
at t.translate (I18n.js:62)
at LayoutHelper.js:38
at Array.forEach (<anonymous>)
at t.combineMenuItems (LayoutHelper.js:30)
at LayoutActions.js:31
at index.js:8
at bindActionCreators.js:3
+----------------------+--------+--------+---------+---------+-----+-------+
| Name | Lines | LOC | Classes | Methods | M/C | LOC/M |
+----------------------+--------+--------+---------+---------+-----+-------+
| Controllers | 14427 | 11896 | 131 | 1357 | 10 | 6 |
| Helpers | 4824 | 4133 | 1 | 520 | 520 | 5 |
| Jobs | 85 | 73 | 4 | 9 | 2 | 6 |
| Models | 20714 | 16022 | 173 | 2230 | 12 | 5 |
| Mailers | 185 | 152 | 5 | 15 | 3 | 8 |
| JavaScripts | 3797 | 3355 | 0 | 265 | 0 | 10 |
| Libraries | 6551 | 5300 | 95 | 498 | 5 | 8 |
019-08-26T08:31:30 [I|app|27292dbf] Started GET "/audits" for 10.35.2.167 at 2019-08-26 08:31:30 +0100
2019-08-26T08:31:30 [I|app|27292dbf] Processing by AuditsController#index as HTML
2019-08-26T08:31:36 [I|app|27292dbf] Rendering audits/index.html.erb within layouts/react_application
2019-08-26T08:31:39 [I|app|27292dbf] Rendered audits/index.html.erb within layouts/react_application (2634.7ms)
2019-08-26T08:31:39 [W|app|27292dbf] Action failed
| ActionView::Template::Error: Mysql2::Error::ConnectionError: MySQL server has gone away: SELECT `audits`.* FROM `audits` WHERE (((`audits`.`auditable_type` IN ('Architecture', 'Bookmark', 'ComputeAttribute', 'ConfigGroup', 'ConfigGroupClass', 'HostClass', 'HostConfigGroup', 'HostgroupClass', 'Image', 'JobInvocation', 'LookupKey', 'LookupValue', 'Model', 'Nic::Bridge', 'Nic::Managed', 'Operatingsystem', 'PuppetclassLookupKey', 'Setting', 'SshKey', 'Taxonomy', 'Template', 'Usergroup', 'VariableLookupKey') OR `audits`.`auditable_type` IN ('AuthSource', 'ComputeRe
{
"manufacturer": "Electra",
"supportedModels": ["RC-3 Remote"],
"supportedController": "Broadlink",
"commandsEncoding": "Base64",
"minTemperature": 16.0,
"maxTemperature": 30.0,
"precision": 1.0,
"operationModes": ["heat", "cool"],
"fanModes": ["auto", "mid", "high", "low"],