Announcement: AppDaemon 1.5.2

A bijou little release with some PEP8 compliant formatting changes and a couple of minor feature additions - enjoy!

1.5.2 (2017-02-04)


  • Code formatted to PEP8, various code optimizations - contributed by yawor
  • Version check for WebSockets now understands dev versions - contributed by yawor
  • turn_off() will now call turn_on() for scenes since turning a scene off makes no sense, to allow extra flexibility
  • Restored the ability to use __line__, __module__ and __function__ in log messages. Recoded to prevent errors in non-compatible Python versions if the templates are not used.



Breaking Changes



Holy hell @yawor that was fast, and insanely well written (if everything’s working fine :wink:). Huge props!

Yes, he certainly knows his way around Python. I learned a few things :wink:

Andrew, please, please, please, if you make a new announcement from an update here on the forum, try to explain the changes so that we all can understand it. (then you can do this kind of things on the github :wink: )

i have no idea what to think when i see PEP8, no idea what to think about websockets and why we would love it( if you introduce it it must be something good :wink: )
i dont know what kind of dev versions you mean (the versions from my apps?)

were the things like line not possible in logs anymore? and why and why do we want them back?

dont forget you invited a lot off noobs on board. :wink:

1 Like

@aimc, @SupahNoob I’ve worked with Python for more than 5 years now. I certainly can’t say I know everything about Python but I’m comfortable with it :). Also having good tools helps a lot. I’m using PyCharm (Pro version, but Community is also great). It has advanced editing features that helped a lot with rewrite (it would take a lot more time if I had to use VIM for example :P).

@aimc: It’s great if that also helped you learn something about Python :). I’m still learning something new about that language from time to time. Not long ago I’ve switched my focus to Python 3 and I’m in love with asyncio :). HASS has been my first real experience with asyncio (I’m implementing a new platform to support wireless smart home system from Polish company Zamel and it’s 100% async). To be honest, your AppDaemon inspired me to try writing my own application runner for HASS which is also 100% async and uses websockets. It’s still not very usable and all my automation is implemented in AppDaemon right now :).

1 Like


  • PEP in general means Python Enhancement Proposal. It’s a series of documents, which are submitted by Python developers and describe new features or guidelines for next Python releases.
  • PEP8 is a set of coding standard guidelines for Python programmers. It describes how the Python code should be formatted when writing. Of course the code still works when not following PEP8, so it’s not a hard requirement, but it’s considered a good practice.
  • WebSockets is a web standard and a protocol which allows applications to connect to remote HTTP server with WebSocket support and keep the connection open and the server then can push data to the clients even when not requested. It’s for example what Home Assistant default Web Panel uses, so when an entity state changes you immediately see the change in the panel, because HASS sends the info to the application about the change (app in this case is a HTML/JavaScript app running in the browser). Previously AppDaemon used HTTP streaming connection (long running HTTP connection constantly feeding some data so neither the client nor the server break the connection).
  • Dev version mentioned in the release description refers to development version of HomeAssistant. Since AppDaemon release 1.5.1, it checks the version number of HASS instance it connects to, to check what protocol to use (HTTP streaming for older than 0.34 and WebSockets for 0.34 and up). The problem was in the version checking logic, which didn’t support non-numeric version numbers, and development version of HASS has word dev in it’s version string.

I hope that satisfy your need of knowledge :).


thanks Marcin,

you are fast with answering :wink: so fast that i havent looked things up yet, so i dont need to google now :wink:
i can see from your answers that you are a real programmer :wink:

i hope Andrew will write it somehow like this in his future releases:

Thanks to @yawor is our code now optimized to the PEP8. PEP8 is a code standard guideline which will (hopefully) help to keep the amount of bugs as low as possible.
In the last edition i introduced websockets into AppDaemon which is a better way to keep an open connection with HASS, but to be backwards compatible appdaemon has to check the version from HASS that is running. that was working but not for those who are running a developersversion from HASS. thats fixed now.

i know that Andrew isnt a noob, but he is able to keep up that appearance, and noobs feel closer to noobs :wink:

Thanks for the explanation @yawor :slight_smile:

Regarding the logging piece, it’s a story of 3 parts that played out in the release notes:

in 1.5.0:

  • Logging can now take placeholder strings for line number, function and module which will be appropriately expanded in the actual message

in 1.5.1:

  • Functionality to substitute line numbers and module names in log statements temporarily removed

in 1.5.2:

  • Restored the ability to use line, module and function in log messages. Recoded to prevent errors in non-compatible Python versions if the templates are not used.

You can check the latest version of to see what they actually do.

The long story is that I made some changes in 1.5.0 that only worked in Python v3.5 and broke AppDaemon for anyone using python v3.4 or earlier. As I was just about to go on a business trip and didn’t have time to figure it out, I pushed out 1.5.1 that disabled the functionality. Yesterday I (hopefully) fixed it in version 1.5.2.

I will try and make better explanations in my announcement posts in future :slight_smile:

1 Like

another request Andrew. :wink:

can you after future updates from the API take up the head of the changed part in the history?
I have read the API about 1000 times and it is hard to search for changes in there, but if i dont read the changes (like in this case the changes in i miss part of the development.

Not sure what you mean - can you explain further?

probably a terrible translation from my side :wink:

i mean the title from the changed topic.

like in this case: “writing to logfiles”

so something like:

sorry wrong links :wink: but they were as example anyway :wink:

OK, I get - it yes, I can do that - you can grade me out of 10 for my next release notes :slight_smile:

1 Like

i can only give you grades between 10 and 20 for everything you do :wink:

1 Like

its not that you do anything wrong, but it hard to keep up with you if you get up to speed, you need to leave a few more breadcrumbs for us to let us follow your trail, without losing direction :wink:

1 Like

Nice addition with PEP8! So now that you have a known standard, next thing is to add automatic linting check in Travis and tox, to check that new additions follow the standard.

Thanks to Rene for saying what some of us noobs may be too embarrassed to say. I would also add that this helps to break the perception that AD is only for “l33t h4xors” that keeps some people form using it more.

Thanks for the suggestions, I’ll take a look :slight_smile:

for WHAT? :confused:

is everyone starting to speak chinese this weekeend?

“l33t h4xors” = “elite hackers”

It’s known as “leet speak”

1 Like