HA scripting: Are real scripting languages possible? What are the performance differences?

You must be doing it wrong then. Rock-solid and dependable for years here.

Once-per-second polling is your better alternative?!

I don’t dispute that offloading very complex stuff might be preferable in certain situations, but in general this doesn’t sound like a great idea.

This isn’t me railing against tools I don’t know, either: I’ve written thousands of lines of JS, node.js projects etc.

You must be doing it wrong then.

Well, easy assumption but as engineer who’s spent the last 7 years writing machine code, developing industrial automation systems from the ground up for municipal water treatment, oil refineries and other industries and being intimately familiar with the electronics, software and mechanical aspects of industrial automation. I’m completely baffled and underwhelmed with the experience I’ve had, particularly the performance and reliability of the automations and I didn’t expect much to begin with.

Maybe the types of automations your doing aren’t plagued by the out of order sequencing issues i cant resolve given the available tools in the GUI. Or maybe im just clueless, but if I cant get anywhere with automations for my use-case, then im definitely not alone.

Once-per-second polling is your better alternative?!

This simple test has now become the ThingWerks IoT Framework, a general purpose industrial control system that can integrate with Home Assistant using its native websocket API.

1 Like

I’m sure the experts here could help with the issues you’re finding. I exclusively use YAML rather than the UI, which undoubtably helps.

AppDaemon is another alternative. API connection and Python scripting:

https://appdaemon.readthedocs.io/en/latest/HASS_TUTORIAL.html

1 Like

The issues im having are partly a result of the HA core being multi threaded and that alone is presenting a huge coding challenge just to deal with and doing it in YAML doesnt alleviate that caveat. Also the implementation leaves a lot to be desired for in terms of state management and logic which makes overcoming the aforementioned challenges all the more difficult. It’s a far better approach to use NodeJS for the logic but i agree fetching once a second isn’t particularly elegant and might not work for some use cases.

I think the possibility of using NodeJS seamlessly with HA using a more elegant API that uses websocket for example is very exciting. I never used python in automation because i just dont trust it when a lot of money is on the line (go figure) but purely as a GUI i think is where HA and python really shine.

If anyone can provide an example of using NodeJS with websocket and HA please share.

1 Like

Persons interested in writing automations in JavaScript or using NodeJS, have a look at the TWIT Framework.

To discuss this further, go to this topic.

Or get more information from the source: