Coder Social home page Coder Social logo

example-custom-config's Introduction

Examples of Home Assistant custom config

Home Assistant can be extended in many different ways. This repository contains a collection of examples how to customize Home Assistant. This repository is organized like your config directory, copying any file to your config directory in the same path as it is in this repo will allow you to use it. Refer to the header of each example for further instructions how to get started.

  • Custom components: these are components that Home Assistant can load by being referenced from configuration.yaml just like built-in components.
  • Panels: these are custom panels that can be included in the frontend using the panel_custom component.

example-custom-config's People

Contributors

balloob avatar benshen98 avatar christophcaina avatar davidjb avatar dependabot[bot] avatar emontnemery avatar ernst79 avatar eyseman avatar fabaff avatar gjohansson-st avatar jcgoette avatar lordmike avatar ludeeus avatar martinhjelmare avatar marvin-w avatar oldshaterhan avatar pattyland avatar peddamat avatar rniemand avatar schnabel avatar shannonfritz avatar shanx avatar sillyfrog avatar thecode avatar wrt54g avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

example-custom-config's Issues

Contradiction with 0.93 docs

The example_load_platform contains the sensor.py in the same directory as the __init__.py

https://github.com/home-assistant/example-custom-config/tree/master/custom_components/example_load_platform

This appears to contradict what is described here:

Platforms can no longer be in the directory of the entity component, like light/my_platform.py. Instead, create a new my_platform folder in your custom_components, create an empty init.py file and move light/my_platform.py to my_platform/light.py.

Does that mean example_load_platform/sensor.py should be located in sensor/example_load_platform.py ?

Undefined name 'hass' in counter.py and count_people_home.py

flake8 testing of https://github.com/home-assistant/example-custom-config on Python 3.7.1

$ flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics

./python_scripts/counter.py:1:11: F821 undefined name 'hass'
counter = hass.states.get('sensor.my_counter')
          ^
./python_scripts/counter.py:8:1: F821 undefined name 'hass'
hass.states.set('sensor.my_counter', value + 1)
^
./python_scripts/count_people_home.py:2:18: F821 undefined name 'hass'
for entity_id in hass.states.entity_ids('device_tracker'):
                 ^
./python_scripts/count_people_home.py:3:13: F821 undefined name 'hass'
    state = hass.states.get(entity_id)
            ^
./python_scripts/count_people_home.py:7:1: F821 undefined name 'hass'
hass.states.set('sensor.people_home', home, {
^
5     F821 undefined name 'hass'
5

Provide code for example_sensor/__init__.py

When I try to add the example_sensor example to my HA instance, I get the following error after restarting:
Screenshot 2023-04-07 at 22 04 18

The init.py file in the example is empty. What do I have to add for the example to work?

Cannot setup mqtt_basic_async

Steps to reproduce.

  • Clone repo
  • Move example-custom-config/custom_components/mqtt_basic_async to custom_components
  • Restart HA
  • Add below to configuration.yaml
mqtt_basic_async:
  topic: "home-assistant/mqtt_example"
  • Go to Developer Tools and click check configuration to get:
Invalid config for [mqtt_basic_async]: [default_config] is an invalid option for [mqtt_basic_async]. Check: mqtt_basic_async->default_config. (See /config/configuration.yaml, line 29).

which is the 1st line in my configuration.yaml file.

Any ideas? I want to listen to some topics and update some sensors, already have these in sensors.yaml and they work fine, but I would like to develop a more complex integration, and this would be my 1st step :D

Error in mqtt async example

I get the following error when running the async mqtt example:

Exception in message_received when handling msg on 'home-assistant/mqtt_example': 'payload_text' TypeError: async_setup.<locals>.message_received() missing 2 required positional arguments: 'payload' and 'qos'

Any ideas?
TIA

Include example with config_flow

It would be helpful to have an example that implements a config_flow that allows home-assistant users to configure the integration using the home-assistant gui.

Recommendations for a async polling example

@balloob : further to the async push example you helped me with, I'm looking to do the same (as discussed) with a polling implementation.

I'm still new to HA, so please excuse the newbie questions :)

Do you have any thoughts as to which way I should go for the example, "Coordinated" or "Separate" (as per here: https://developers.home-assistant.io/docs/integration_fetching_data/#coordinated-single-api-poll-for-data-for-all-entities )? Just wrapping my head around it, and the implementation of the two I think will end up quite different.

Cheers.

Error when adding Example sensor

Hello,
I would like to try out the example sensor to build on it but when I copy the folder over to custom_components/example_sensor/ and add the following lines to my config:

# Example configuration.yaml entry
sensor:
  - platform: example_sensor

my config check fails with:
Invalid config for [sensor]: required key not provided @ data['platform']. Got None. (See /config/configuration.yaml, line 44).

Am I missing something?

Cannot setup example_light

I think the example configuration for example_light still uses an old identifier:

https://github.com/home-assistant/example-custom-config/blame/master/custom_components/example_light/README.md#L18

should be:

  • platform: example_light

I this is correct, I can create an PR but even with this change, I can't get it to work. in the logs I see this:

Unable to install package awesomelights==1.2.3: ERROR: Could not find a version that satisfies the requirement awesomelights==1.2.3 (from versions: none) ERROR: No matching distribution found for awesomelights==1.2.3 WARNING: You are using pip version 19.3; however, version 19.3.1 is available. You should consider upgrading via the 'pip install --upgrade pip' command.
1:21 util/package.py (ERROR) - message first occurred at 1:19 and shows up 2 times
Platform error: light - Requirements for example_light not found: ['awesomelights==1.2.3'].
1:19 config.py (ERROR)
You are using a custom integration for example_light which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you do experience issues with Home Assistant.
1:19 loader.py (WARNING)

detailed_hello_world_push example is unclear

I'd be happy to update the readme if I can get some help understanding how to use this example.

I copied the example to config/custom_components, started hass, went to Settings -> Devices and Services -> Add Integration -> Detailed Hello World Push.

image

It is unclear what is supposed to be entered into this field. I entered "foo" and I get an error saying "Failed to set up". I assume this is the not expected behavior, but that is also unclear.
image

Complete the example sensor please

It would be nice if the example sensor is enriched with how to update the value of the sensor. That would complete this snippet. Only then will you have a complete working example.

Integration error: hello_world - Integration 'hello_world' not found

I copied everything from Home Assistant's own hello_world example, and still get the error message "Integration error: hello_world - Integration 'hello_world' not found." when I click [Check Configuration]
I used HA's own File editor plugin to create the file /config/custom_components/hello_world/__init__.py, and pasted the contents from GitHub into it. Same for /config/custom_components/hello_world/manifest.json
Then, per the instructions, I edited /config/configuration.yaml to add a single new line near the top:
hello_world:

Cannot set up example mqtt_basic

Hi all,
I had tried to integrate the MQTT basic to home assistant. I copied folder mqtt_basic to my config custom_components, and modify configuration.yaml like guidlines. I got error log:

2019-04-16 02:50:42 ERROR (MainThread) [homeassistant.config] Invalid config for [mqtt_basic]: [homeassistant] is an invalid option for [mqtt_basic]. C heck: mqtt_basic->homeassistant. (See /home/trung/work/my-ha/configuration.yaml, line 87). Please check the docs at https://home-assistant.io/compon ents/mqtt_basic/
2019-04-16 02:50:42 ERROR (MainThread) [homeassistant.setup] Setup failed for mqtt_basic: Invalid config.

Would you like to give a advise for this issue?
Thank you very much.
I attached my configuration.yaml. I just rename the extension file to upload.

configuration.yaml.txt

howto "add" detailed_hello_world_push example with UI

Hi,

in #26 the solution is "There is no YAML configuration available for that example, as that example uses UI based configuration."

My problem: I cannot find the UI to add detailed_hello_world_push to my setup :(

Howto reproduce:

git clone https://github.com/home-assistant/core.git ha-core
git clone https://github.com/home-assistant/example-custom-config
(cd ha-core && ./script/setup)
cd  ha-core/homeassistant/components &&  ln -fs $(realpath ../../../example-custom-config/custom_components/detailed_hello_world_push) .
cd ../../..
source ha-core/venv/bin/activate
cd ha-core && hass -c config --debug -v --log-file hass.log

I then use firefox losthost:8123 , answer the onboarding questions, then click

  • Settings -> Devices & Services and there "+ Add Integration"

I hoped that the "Detailed Hello World Push" would appear there, but cannot find it.

remove hass.config_entries.async_setup_platforms

I had problem running the detailed_hello_world_push example.

After some search, I found it's because hass.config_entries.async_setup_platforms was removed in the recent version. It's suggested from the blog, I should replace it with hass.config_entries.async_forward_entry_setups or hass.config_entries.async_forward_entry_setup?

Could someone provide a hint on how to do it? I'm still new to develop HA, so a guide to fix the example would be extermly useful to people like me.

https://github.com/home-assistant/example-custom-config/blob/master/custom_components/detailed_hello_world_push/__init__.py#L23

Is example_sensor out of date

Looking to build on the example sensor and when I copy the three files to config/custom_components/example_sensor and add

sensor:
  - platform: example_sensor

to configuration.yaml all I get when checking the yaml is

Platform error sensor.example_sensor - Integration 'example_sensor' not found.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.