-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 7fd64bd
Showing
106 changed files
with
34,208 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Sphinx build info version 1 | ||
# This file records the configuration used when building these files. When it is not found, a full rebuild will be done. | ||
config: f8e806c09f03c7e4fb9b5f205359f136 | ||
tags: 645f666f9bcd5a90fca523b33c5a78b7 |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,180 @@ | ||
|
||
|
||
<!DOCTYPE html> | ||
<html class="writer-html5" lang="en" data-content_root="../"> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>homematicip — HomematicIP-Rest-API 0.0.post1.dev1 documentation</title> | ||
<link rel="stylesheet" type="text/css" href="../_static/pygments.css?v=80d5e7a1" /> | ||
<link rel="stylesheet" type="text/css" href="../_static/css/theme.css?v=e59714d7" /> | ||
|
||
|
||
<script src="../_static/jquery.js?v=5d32c60e"></script> | ||
<script src="../_static/_sphinx_javascript_frameworks_compat.js?v=2cd50e6c"></script> | ||
<script src="../_static/documentation_options.js?v=42336cb0"></script> | ||
<script src="../_static/doctools.js?v=9bcbadda"></script> | ||
<script src="../_static/sphinx_highlight.js?v=dc90522c"></script> | ||
<script src="../_static/js/theme.js"></script> | ||
<link rel="index" title="Index" href="../genindex.html" /> | ||
<link rel="search" title="Search" href="../search.html" /> | ||
</head> | ||
|
||
<body class="wy-body-for-nav"> | ||
<div class="wy-grid-for-nav"> | ||
<nav data-toggle="wy-nav-shift" class="wy-nav-side"> | ||
<div class="wy-side-scroll"> | ||
<div class="wy-side-nav-search" > | ||
|
||
|
||
|
||
<a href="../index.html" class="icon icon-home"> | ||
HomematicIP-Rest-API | ||
</a> | ||
<div role="search"> | ||
<form id="rtd-search-form" class="wy-form" action="../search.html" method="get"> | ||
<input type="text" name="q" placeholder="Search docs" aria-label="Search docs" /> | ||
<input type="hidden" name="check_keywords" value="yes" /> | ||
<input type="hidden" name="area" value="default" /> | ||
</form> | ||
</div> | ||
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu"> | ||
<p class="caption" role="heading"><span class="caption-text">Getting started</span></p> | ||
<ul> | ||
<li class="toctree-l1"><a class="reference internal" href="../gettingstarted.html">Getting Started</a></li> | ||
</ul> | ||
<p class="caption" role="heading"><span class="caption-text">API Documentation</span></p> | ||
<ul> | ||
<li class="toctree-l1"><a class="reference internal" href="../api_introduction.html">API Introduction</a></li> | ||
<li class="toctree-l1"><a class="reference internal" href="../modules.html">homematicip</a></li> | ||
</ul> | ||
|
||
</div> | ||
</div> | ||
</nav> | ||
|
||
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" > | ||
<i data-toggle="wy-nav-top" class="fa fa-bars"></i> | ||
<a href="../index.html">HomematicIP-Rest-API</a> | ||
</nav> | ||
|
||
<div class="wy-nav-content"> | ||
<div class="rst-content"> | ||
<div role="navigation" aria-label="Page navigation"> | ||
<ul class="wy-breadcrumbs"> | ||
<li><a href="../index.html" class="icon icon-home" aria-label="Home"></a></li> | ||
<li class="breadcrumb-item"><a href="index.html">Module code</a></li> | ||
<li class="breadcrumb-item active">homematicip</li> | ||
<li class="wy-breadcrumbs-aside"> | ||
</li> | ||
</ul> | ||
<hr/> | ||
</div> | ||
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article"> | ||
<div itemprop="articleBody"> | ||
|
||
<h1>Source code for homematicip</h1><div class="highlight"><pre> | ||
<span></span><span class="c1"># coding=utf-8</span> | ||
<span class="kn">import</span> <span class="nn">configparser</span> | ||
<span class="kn">import</span> <span class="nn">os</span> | ||
<span class="kn">import</span> <span class="nn">platform</span> | ||
<span class="kn">from</span> <span class="nn">collections</span> <span class="kn">import</span> <span class="n">namedtuple</span> | ||
|
||
<span class="n">HmipConfig</span> <span class="o">=</span> <span class="n">namedtuple</span><span class="p">(</span> | ||
<span class="s2">"HmipConfig"</span><span class="p">,</span> <span class="p">[</span><span class="s2">"auth_token"</span><span class="p">,</span> <span class="s2">"access_point"</span><span class="p">,</span> <span class="s2">"log_level"</span><span class="p">,</span> <span class="s2">"log_file"</span><span class="p">,</span> <span class="s2">"raw_config"</span><span class="p">]</span> | ||
<span class="p">)</span> | ||
|
||
|
||
<div class="viewcode-block" id="find_and_load_config_file"> | ||
<a class="viewcode-back" href="../homematicip.html#homematicip.find_and_load_config_file">[docs]</a> | ||
<span class="k">def</span> <span class="nf">find_and_load_config_file</span><span class="p">()</span> <span class="o">-></span> <span class="n">HmipConfig</span><span class="p">:</span> | ||
<span class="k">for</span> <span class="n">f</span> <span class="ow">in</span> <span class="n">get_config_file_locations</span><span class="p">():</span> | ||
<span class="k">try</span><span class="p">:</span> | ||
<span class="k">return</span> <span class="n">load_config_file</span><span class="p">(</span><span class="n">f</span><span class="p">)</span> | ||
<span class="k">except</span> <span class="ne">FileNotFoundError</span><span class="p">:</span> | ||
<span class="k">pass</span> | ||
<span class="k">return</span> <span class="kc">None</span></div> | ||
|
||
|
||
|
||
<div class="viewcode-block" id="load_config_file"> | ||
<a class="viewcode-back" href="../homematicip.html#homematicip.load_config_file">[docs]</a> | ||
<span class="k">def</span> <span class="nf">load_config_file</span><span class="p">(</span><span class="n">config_file</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="n">HmipConfig</span><span class="p">:</span> | ||
<span class="w"> </span><span class="sd">"""Loads the config ini file.</span> | ||
<span class="sd"> :raises a FileNotFoundError when the config file does not exist."""</span> | ||
<span class="n">expanded_config_file</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">expanduser</span><span class="p">(</span><span class="n">config_file</span><span class="p">)</span> | ||
<span class="n">config</span> <span class="o">=</span> <span class="n">configparser</span><span class="o">.</span><span class="n">ConfigParser</span><span class="p">()</span> | ||
<span class="k">with</span> <span class="nb">open</span><span class="p">(</span><span class="n">expanded_config_file</span><span class="p">,</span> <span class="s2">"r"</span><span class="p">)</span> <span class="k">as</span> <span class="n">fl</span><span class="p">:</span> | ||
<span class="n">config</span><span class="o">.</span><span class="n">read_file</span><span class="p">(</span><span class="n">fl</span><span class="p">)</span> | ||
<span class="n">logging_filename</span> <span class="o">=</span> <span class="n">config</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"LOGGING"</span><span class="p">,</span> <span class="s2">"FileName"</span><span class="p">,</span> <span class="n">fallback</span><span class="o">=</span><span class="s2">"hmip.log"</span><span class="p">)</span> | ||
<span class="k">if</span> <span class="n">logging_filename</span> <span class="o">==</span> <span class="s2">"None"</span><span class="p">:</span> | ||
<span class="n">logging_filename</span> <span class="o">=</span> <span class="kc">None</span> | ||
|
||
<span class="n">_hmip_config</span> <span class="o">=</span> <span class="n">HmipConfig</span><span class="p">(</span> | ||
<span class="n">config</span><span class="p">[</span><span class="s2">"AUTH"</span><span class="p">][</span><span class="s2">"AuthToken"</span><span class="p">],</span> | ||
<span class="n">config</span><span class="p">[</span><span class="s2">"AUTH"</span><span class="p">][</span><span class="s2">"AccessPoint"</span><span class="p">],</span> | ||
<span class="nb">int</span><span class="p">(</span><span class="n">config</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"LOGGING"</span><span class="p">,</span> <span class="s2">"Level"</span><span class="p">,</span> <span class="n">fallback</span><span class="o">=</span><span class="mi">30</span><span class="p">)),</span> | ||
<span class="n">logging_filename</span><span class="p">,</span> | ||
<span class="n">config</span><span class="o">.</span><span class="n">_sections</span><span class="p">,</span> | ||
<span class="p">)</span> | ||
<span class="k">return</span> <span class="n">_hmip_config</span></div> | ||
|
||
|
||
|
||
<div class="viewcode-block" id="get_config_file_locations"> | ||
<a class="viewcode-back" href="../homematicip.html#homematicip.get_config_file_locations">[docs]</a> | ||
<span class="k">def</span> <span class="nf">get_config_file_locations</span><span class="p">()</span> <span class="o">-></span> <span class="p">[]:</span> | ||
<span class="n">search_locations</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"./config.ini"</span><span class="p">]</span> | ||
|
||
<span class="n">os_name</span> <span class="o">=</span> <span class="n">platform</span><span class="o">.</span><span class="n">system</span><span class="p">()</span> | ||
|
||
<span class="k">if</span> <span class="n">os_name</span> <span class="o">==</span> <span class="s2">"Windows"</span><span class="p">:</span> | ||
<span class="n">appdata</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">getenv</span><span class="p">(</span><span class="s2">"appdata"</span><span class="p">)</span> | ||
<span class="n">programdata</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">getenv</span><span class="p">(</span><span class="s2">"programdata"</span><span class="p">)</span> | ||
<span class="n">search_locations</span><span class="o">.</span><span class="n">append</span><span class="p">(</span> | ||
<span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">appdata</span><span class="p">,</span> <span class="s2">"homematicip-rest-api</span><span class="se">\\</span><span class="s2">config.ini"</span><span class="p">)</span> | ||
<span class="p">)</span> | ||
<span class="n">search_locations</span><span class="o">.</span><span class="n">append</span><span class="p">(</span> | ||
<span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">programdata</span><span class="p">,</span> <span class="s2">"homematicip-rest-api</span><span class="se">\\</span><span class="s2">config.ini"</span><span class="p">)</span> | ||
<span class="p">)</span> | ||
<span class="k">elif</span> <span class="n">os_name</span> <span class="o">==</span> <span class="s2">"Linux"</span><span class="p">:</span> | ||
<span class="n">search_locations</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="s2">"~/.homematicip-rest-api/config.ini"</span><span class="p">)</span> | ||
<span class="n">search_locations</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="s2">"/etc/homematicip-rest-api/config.ini"</span><span class="p">)</span> | ||
<span class="k">elif</span> <span class="n">os_name</span> <span class="o">==</span> <span class="s2">"Darwin"</span><span class="p">:</span> <span class="c1"># MAC</span> | ||
<span class="c1"># are these folders right?</span> | ||
<span class="n">search_locations</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="s2">"~/Library/Preferences/homematicip-rest-api/config.ini"</span><span class="p">)</span> | ||
<span class="n">search_locations</span><span class="o">.</span><span class="n">append</span><span class="p">(</span> | ||
<span class="s2">"/Library/Application Support/homematicip-rest-api/config.ini"</span> | ||
<span class="p">)</span> | ||
<span class="k">return</span> <span class="n">search_locations</span></div> | ||
|
||
</pre></div> | ||
|
||
</div> | ||
</div> | ||
<footer> | ||
|
||
<hr/> | ||
|
||
<div role="contentinfo"> | ||
<p>© Copyright 2024, Thomas Hahn.</p> | ||
</div> | ||
|
||
Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a | ||
<a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a> | ||
provided by <a href="https://readthedocs.org">Read the Docs</a>. | ||
|
||
|
||
</footer> | ||
</div> | ||
</div> | ||
</section> | ||
</div> | ||
<script> | ||
jQuery(function () { | ||
SphinxRtdTheme.Navigation.enable(true); | ||
}); | ||
</script> | ||
|
||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,131 @@ | ||
|
||
|
||
<!DOCTYPE html> | ||
<html class="writer-html5" lang="en" data-content_root="../../"> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>homematicip.EventHook — HomematicIP-Rest-API 0.0.post1.dev1 documentation</title> | ||
<link rel="stylesheet" type="text/css" href="../../_static/pygments.css?v=80d5e7a1" /> | ||
<link rel="stylesheet" type="text/css" href="../../_static/css/theme.css?v=e59714d7" /> | ||
|
||
|
||
<script src="../../_static/jquery.js?v=5d32c60e"></script> | ||
<script src="../../_static/_sphinx_javascript_frameworks_compat.js?v=2cd50e6c"></script> | ||
<script src="../../_static/documentation_options.js?v=42336cb0"></script> | ||
<script src="../../_static/doctools.js?v=9bcbadda"></script> | ||
<script src="../../_static/sphinx_highlight.js?v=dc90522c"></script> | ||
<script src="../../_static/js/theme.js"></script> | ||
<link rel="index" title="Index" href="../../genindex.html" /> | ||
<link rel="search" title="Search" href="../../search.html" /> | ||
</head> | ||
|
||
<body class="wy-body-for-nav"> | ||
<div class="wy-grid-for-nav"> | ||
<nav data-toggle="wy-nav-shift" class="wy-nav-side"> | ||
<div class="wy-side-scroll"> | ||
<div class="wy-side-nav-search" > | ||
|
||
|
||
|
||
<a href="../../index.html" class="icon icon-home"> | ||
HomematicIP-Rest-API | ||
</a> | ||
<div role="search"> | ||
<form id="rtd-search-form" class="wy-form" action="../../search.html" method="get"> | ||
<input type="text" name="q" placeholder="Search docs" aria-label="Search docs" /> | ||
<input type="hidden" name="check_keywords" value="yes" /> | ||
<input type="hidden" name="area" value="default" /> | ||
</form> | ||
</div> | ||
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu"> | ||
<p class="caption" role="heading"><span class="caption-text">Getting started</span></p> | ||
<ul> | ||
<li class="toctree-l1"><a class="reference internal" href="../../gettingstarted.html">Getting Started</a></li> | ||
</ul> | ||
<p class="caption" role="heading"><span class="caption-text">API Documentation</span></p> | ||
<ul> | ||
<li class="toctree-l1"><a class="reference internal" href="../../api_introduction.html">API Introduction</a></li> | ||
<li class="toctree-l1"><a class="reference internal" href="../../modules.html">homematicip</a></li> | ||
</ul> | ||
|
||
</div> | ||
</div> | ||
</nav> | ||
|
||
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" > | ||
<i data-toggle="wy-nav-top" class="fa fa-bars"></i> | ||
<a href="../../index.html">HomematicIP-Rest-API</a> | ||
</nav> | ||
|
||
<div class="wy-nav-content"> | ||
<div class="rst-content"> | ||
<div role="navigation" aria-label="Page navigation"> | ||
<ul class="wy-breadcrumbs"> | ||
<li><a href="../../index.html" class="icon icon-home" aria-label="Home"></a></li> | ||
<li class="breadcrumb-item"><a href="../index.html">Module code</a></li> | ||
<li class="breadcrumb-item"><a href="../homematicip.html">homematicip</a></li> | ||
<li class="breadcrumb-item active">homematicip.EventHook</li> | ||
<li class="wy-breadcrumbs-aside"> | ||
</li> | ||
</ul> | ||
<hr/> | ||
</div> | ||
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article"> | ||
<div itemprop="articleBody"> | ||
|
||
<h1>Source code for homematicip.EventHook</h1><div class="highlight"><pre> | ||
<span></span><span class="c1"># by Michael Foord http://www.voidspace.org.uk/python/weblog/arch_d7_2007_02_03.shtml#e616</span> | ||
|
||
|
||
<div class="viewcode-block" id="EventHook"> | ||
<a class="viewcode-back" href="../../homematicip.html#homematicip.EventHook.EventHook">[docs]</a> | ||
<span class="k">class</span> <span class="nc">EventHook</span><span class="p">:</span> | ||
<span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> | ||
<span class="bp">self</span><span class="o">.</span><span class="n">__handlers</span> <span class="o">=</span> <span class="p">[]</span> | ||
|
||
<span class="k">def</span> <span class="fm">__iadd__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">handler</span><span class="p">):</span> | ||
<span class="bp">self</span><span class="o">.</span><span class="n">__handlers</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">handler</span><span class="p">)</span> | ||
<span class="k">return</span> <span class="bp">self</span> | ||
|
||
<span class="k">def</span> <span class="fm">__isub__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">handler</span><span class="p">):</span> | ||
<span class="bp">self</span><span class="o">.</span><span class="n">__handlers</span><span class="o">.</span><span class="n">remove</span><span class="p">(</span><span class="n">handler</span><span class="p">)</span> | ||
<span class="k">return</span> <span class="bp">self</span> | ||
|
||
<div class="viewcode-block" id="EventHook.fire"> | ||
<a class="viewcode-back" href="../../homematicip.html#homematicip.EventHook.EventHook.fire">[docs]</a> | ||
<span class="k">def</span> <span class="nf">fire</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">keywargs</span><span class="p">):</span> | ||
<span class="k">for</span> <span class="n">handler</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">__handlers</span><span class="p">:</span> | ||
<span class="n">handler</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">keywargs</span><span class="p">)</span></div> | ||
</div> | ||
|
||
</pre></div> | ||
|
||
</div> | ||
</div> | ||
<footer> | ||
|
||
<hr/> | ||
|
||
<div role="contentinfo"> | ||
<p>© Copyright 2024, Thomas Hahn.</p> | ||
</div> | ||
|
||
Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a | ||
<a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a> | ||
provided by <a href="https://readthedocs.org">Read the Docs</a>. | ||
|
||
|
||
</footer> | ||
</div> | ||
</div> | ||
</section> | ||
</div> | ||
<script> | ||
jQuery(function () { | ||
SphinxRtdTheme.Navigation.enable(true); | ||
}); | ||
</script> | ||
|
||
</body> | ||
</html> |
Oops, something went wrong.