Skip to content

Instantly share code, notes, and snippets.

View bramstroker's full-sized avatar

Bram Gerritsen bramstroker

View GitHub Profile
@bramstroker
bramstroker / include.py
Last active July 22, 2023 06:28
Debug include area
import logging
from typing import cast
from homeassistant.components.group import DOMAIN as GROUP_DOMAIN
from homeassistant.components.light import DOMAIN as LIGHT_DOMAIN
from homeassistant.components.sensor import SensorDeviceClass
from homeassistant.const import ATTR_ENTITY_ID, CONF_DOMAIN, CONF_ENTITY_ID
from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers import area_registry, device_registry, entity_registry
from homeassistant.helpers.entity import Entity
{
"entry_id": "7084c49423ea2f4ff6c905f4c90738da",
"version": 2,
"domain": "powercalc",
"title": "Lower Bathroom Speaker",
"data": {
"entity_id": "media_player.googlehome8812",
"manufacturer": "google",
"model": "Home Mini (HOA)",
"unique_id": "pc_d67fe854-1aea-8a23-dfda-8df4d4db5f31",
@bramstroker
bramstroker / utility_meter.py
Created January 7, 2023 13:59
Powercalc utility meter, extensive logging
from __future__ import annotations
import inspect
import logging
from typing import cast
import homeassistant.helpers.entity_registry as er
from awesomeversion.awesomeversion import AwesomeVersion
from homeassistant.components.select import DOMAIN as SELECT_DOMAIN
from homeassistant.components.sensor import DOMAIN as SENSOR_DOMAIN
@bramstroker
bramstroker / sensor.py
Created October 16, 2022 13:15
Debug powercalc #1153
"""Platform for sensor integration."""
from __future__ import annotations
import copy
import logging
import uuid
from datetime import timedelta
from typing import Any, Final, NamedTuple, Optional, cast
@bramstroker
bramstroker / supported_models.md
Last active August 13, 2022 14:38
powercalc measure devices

Supported models (159 total)

manufacturer model id name measure_device
anko 42997610 Anko Smart String Lights 42997610 TP-Link Tapo P110
aqara ZNLDP12LM Aqara LED light bulb (tunable white) Shelly Plug E
arlec GLD115HA Arlec Smart R80 9.5W 806lm CCT Bulb TP-Link Tapo P110
@bramstroker
bramstroker / light.py
Created April 1, 2022 20:38
Home Assistant philips JS ambilight issue
"""Component to integrate ambilight for TVs exposing the Joint Space API."""
from __future__ import annotations
import logging
from haphilipsjs import PhilipsTV
from haphilipsjs.typing import AmbilightCurrentConfiguration
from homeassistant.components.light import (
ATTR_BRIGHTNESS,
ATTR_EFFECT,
class OpeningPeriodStrategy implements StrategyInterface, TranslatorAwareInterface
{
use TranslatorAwareTrait;
/**
* @param Campsite $campsite
* @return Information
*/
public function getInformation(Campsite $campsite)
{
Mockery::on(function($a, $b) {
$this->assertEquals('foo', $a);
return true;
});
//Dit werkt wel
$('#js-searchresults-change-data').on('click', function() {
// Append a overlay for the form
$('#main').append('<div id="js-searchresults-form-overlay" class="searchresults-overlay searchresults-overlay--form"></div>');
$('#js-searchresults-form, #js-searchresults-form-overlay').velocity('fadeIn', {duration: 300});
})
//Dit werkt niet
/*$(document).on('click', '#js-searchresults-change-data', function (event) {
class MyResource extends AbstractResourceListener implements ResourceInterface
{
public function fetch($id)
{
$entity = $this->getEntityById($id, false);
if ($entity === null) {
return new ApiProblemResponse(new ApiProblem(404, 'Entity with ID ' . $id . ' not found'));
}
return $entity;