github-custom-component-tutorial icon indicating copy to clipboard operation
github-custom-component-tutorial copied to clipboard

Tutorial seems from 2020, how much has changed?

Open chbndrhnns opened this issue 3 years ago • 4 comments

Hi there,

I wanted to dig into custom components a bit and found your extensive tutorial. As it has a timestamp of 2020, I am wondering how much has changed in the meantime? Would you say the concepts still apply and it's a solid starting point?

Bye, Jo

chbndrhnns avatar Nov 12 '22 18:11 chbndrhnns

I've tried to do my best to update both this repository and the blog post(s) as things change. There are definitely some best practices that are new that I haven't added (specifically around unit testing, see https://developers.home-assistant.io/docs/development_testing#writing-tests-for-integrations).

I'd say it's still a good foundation, as the integration this builds does indeed work in the latest version of HA (as of writing it's 2022.11.2 )

boralyl avatar Nov 12 '22 19:11 boralyl

I am lost already at this section:

  • In which file does this need to go? (Edit: clear from looking at the diff)
  • PLATFORM_SCHEMA seems not importable for me from anywhere
  • what does the alias (?) cv stand for? (edit: clear from looking at the diff)

chbndrhnns avatar Nov 13 '22 12:11 chbndrhnns

* `PLATFORM_SCHEMA` seems not importable for me from anywhere

I don't have much information to go on about your setup but it's imported here in the diff: https://github.com/boralyl/github-custom-component-tutorial/compare/feature/bare-repo...feature/part1?expand=1#diff-255aba5fb48c0aa31b860458cce10c3034d30602391ff77dbe42d0529322b6afR13

boralyl avatar Nov 13 '22 18:11 boralyl

  • PLATFORM_SCHEMA seems not importable for me from anywhere

Sorry for the noise, PyCharm did not find the symbol although it exists. I trusted PyCharm more than the sources.

chbndrhnns avatar Nov 13 '22 18:11 chbndrhnns