Skip to content

Commit

Permalink
Merge 374b322 into 2f04c29
Browse files Browse the repository at this point in the history
  • Loading branch information
bramstroker committed Jan 16, 2023
2 parents 2f04c29 + 374b322 commit 7ede4fe
Show file tree
Hide file tree
Showing 34 changed files with 1,405 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/.gitignore
@@ -0,0 +1 @@
build
20 changes: 20 additions & 0 deletions docs/Makefile
@@ -0,0 +1,20 @@
# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = source
BUILDDIR = build

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help Makefile

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
35 changes: 35 additions & 0 deletions docs/make.bat
@@ -0,0 +1,35 @@
@ECHO OFF

pushd %~dp0

REM Command file for Sphinx documentation

if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set SOURCEDIR=source
set BUILDDIR=build

if "%1" == "" goto help

%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
echo.
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINXBUILD environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.http://sphinx-doc.org/
exit /b 1
)

%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
goto end

:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%

:end
popd
3 changes: 3 additions & 0 deletions docs/source/_static/css/custom.css
@@ -0,0 +1,3 @@
.wy-table-responsive table td, .wy-table-responsive table th {
white-space: inherit;
}
27 changes: 27 additions & 0 deletions docs/source/conf.py
@@ -0,0 +1,27 @@
# -- Project information

project = 'Powercalc'
copyright = '2023, Bram Gerritsen'
author = 'Bramstroker'

# -- Options for HTML output

html_theme = 'sphinx_rtd_theme'

# -- Options for EPUB output
epub_show_urls = 'footnote'

html_static_path = ['_static']

# These paths are either relative to html_static_path
# or fully qualified paths (eg. https://...)
html_css_files = [
'css/custom.css',
]

# make rst_epilog a variable, so you can add other epilog parts to it
rst_epilog = ""
# Read link all targets from file
with open('links.rst') as f:
rst_epilog += f.read()

57 changes: 57 additions & 0 deletions docs/source/configuration/global-configuration.rst
@@ -0,0 +1,57 @@
====================
Global configuration
====================

Powercalc provides some configuration which can be applied on a global level. This means any of this configuration option applies to all sensors created with powercalc.
Any configuration you do on a per sensor basis will override the global setting for that sensor.

You can add these options to `configuration.yaml` under the ``powercalc:`` property, like so:

.. code-block:: yaml
powercalc:
force_update_frequency: 00:01:00 #Each minute
power_sensor_naming: "{} Powersensor"
create_energy_sensors: false
All the possible options are listed below.

+-------------------------------+----------+--------------+-------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Name | Type | Requirement | Default | Description |
+===============================+==========+==============+=========================+=======================================================================================================================================================================================================================================+
| create_domain_groups | list | **Optional** | | Create grouped power sensor aggregating all powercalc sensors of given domains, see :doc:`/group` |
+-------------------------------+----------+--------------+-------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| create_energy_sensors | boolean | **Optional** | true | Let the component automatically create energy sensors (kWh) for every power sensor |
+-------------------------------+----------+--------------+-------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| create_utility_meters | boolean | **Optional** | false | Set to `true` to automatically create utility meters of your energy sensors. See :doc:`/utility-meter` |
+-------------------------------+----------+--------------+-------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| disable_extended_attributes | boolean | **Optional** | false | Set to `true` to disable all extra attributes powercalc adds to the power, energy and group entity states. This will help keep the database size small especially when you have a lot of powercalc sensors and frequent update ratio |
+-------------------------------+----------+--------------+-------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| enable_autodiscovery | boolean | **Optional** | true | Whether you want powercalc to automatically setup power sensors for supported models in your HA instance. |
+-------------------------------+----------+--------------+-------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| energy_sensor_naming | string | **Optional** | {} energy | Change the name of the sensors. Use the `{}` placeholder for the entity name of your appliance. This will also change the entity_id of your sensor |
+-------------------------------+----------+--------------+-------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| energy_sensor_friendly_naming | string | **Optional** | | Change the friendly name of the sensors, Use `{}` placehorder for the original entity name. |
+-------------------------------+----------+--------------+-------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| energy_sensor_category | string | **Optional** | | Category for the created energy sensors. See `HA docs <https://developers.home-assistant.io/docs/core/entity/#generic-properties>`_. |
+-------------------------------+----------+--------------+-------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| energy_integration_method | string | **Optional** | trapezoid | Integration method for the energy sensor. See `HA docs <https://www.home-assistant.io/integrations/integration/#method>`_ |
+-------------------------------+----------+--------------+-------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| energy_sensor_precision | numeric | **Optional** | 4 | Number of decimals you want for the energy sensors. See `HA docs <https://www.home-assistant.io/integrations/integration/#round>`_ |
+-------------------------------+----------+--------------+-------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| energy_sensor_unit_prefix | string | **Optional** | | Unit prefix for the energy sensor. See `HA docs <https://www.home-assistant.io/integrations/integration/#unit_prefix>`_. Set to ``none`` for to create a Wh sensor |
+-------------------------------+----------+--------------+-------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| force_update_frequency | string | **Optional** | 00:10:00 | Interval at which the sensor state is updated, even when the power value stays the same. Format HH:MM:SS |
+-------------------------------+----------+--------------+-------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| ignore_unavailable_state | boolean | **Optional** | false | Set to `true` when you want the power sensor to display a value (0 or ``standby_power``) regardless of whether the source entity is available. |
+-------------------------------+----------+--------------+-------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| power_sensor_naming | string | **Optional** | {} power | Change the name of the sensors. Use the `{}` placeholder for the entity name of your appliance. This will also change the entity_id of your sensor |
+-------------------------------+----------+--------------+-------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| power_sensor_friendly_naming | string | **Optional** | | Change the friendly name of the sensors, Use `{}` placehorder for the original entity name. |
+-------------------------------+----------+--------------+-------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| power_sensor_category | string | **Optional** | | Category for the created power sensors. See `HA docs <https://developers.home-assistant.io/docs/core/entity/#generic-properties>`_. |
+-------------------------------+----------+--------------+-------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| utility_meter_types | list | **Optional** | daily, weekly, monthly | Define which cycles you want to create utility meters for. See `HA docs <https://www.home-assistant.io/integrations/utility_meter/#cycle>`_ |
+-------------------------------+----------+--------------+-------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| utility_meter_tariffs | list | **Optional** | | Define different tariffs. See `HA docs <https://www.home-assistant.io/integrations/utility_meter/#tariffs>`_. |
+-------------------------------+----------+--------------+-------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
31 changes: 31 additions & 0 deletions docs/source/configuration/multiply-factor.rst
@@ -0,0 +1,31 @@
===============
Multiply Factor
===============

This feature allows you to multiply the calculated power.

This can be useful in the following use cases:
- You have a bunch of similar lights which you control as a group and want a single power sensor.
- You are using a LED strip from the LUT models, but you have extended or shortened it.

Let's assume you have a combination of 4 GU10 spots in your ceiling in a light group `light.livingroom_spots`

.. code-block:: yaml
- platform: powercalc
entity_id: light.livingroom_spots
multiply_factor: 4
This will add the power sensor `sensor.livingroom_spots_power` and the measured power will be multiplied by 4, as the original measurements are for 1 spot.

By default the multiply factor will **NOT** be applied to the standby power, you can set the `multiply_factor_standby` to do this.

.. code-block:: yaml
- platform: powercalc
entity_id: light.livingroom_spots
multiply_factor: 4
multiply_factor_standby: true
.. tip::
a multiply_factor lower than 1 will decrease the power. For example 0.5 will half the power.

0 comments on commit 7ede4fe

Please sign in to comment.