Hi All, new to Home Assistant and the forums, tried searching around for an answer to this and feel like it should be simple but i dont know where to start, some topics go way too technical for my level of knowledge.
Im running HA on Virtualbox, which is running on a Windows machine. On the Windows machine i want to print 4 x Word documents automatically using an Echo Dot to trigger the behaviour. “Alexa, print out my forms” should print all four documents on a HP deskjet printer.
About a year ago i managed to get the Alexa devices in the house working with NodeRed but i lost some interest and am now back on the horse, so i think i would be able to figure out that part again but i wondered if anyone can steer me on how to do the printing from either HA or NodeRed.
The printer in question has been auto-discovered by HA, and has a load of tcp ports open (443, 8080, 80, 9220, 5355, 3910, 9100, 3911 631 to be precise).
Everywhere I start leads to a rabbit hole of other protocols, language constructs, and lots of reading which although i dont mind i dont really have time to learn everything, hence automation to make my life a bit easier.
Thanks in advance!
I would start by creating a script file in Windows that is able to print your forms. The following is a very basic, old-school VBScript example (a more modern example would use PowerShell):
set oWord = createobject("Word.Application")
set oFile = oWord.documents.open("c:\path to your Word document")
Anyway, the goal is to create something that, when executed, prints your forms. The next step is to call the script from Home Assistant. What comes to mind is to use the Command line integration. However, the challenge you have created for yourself is the fact you are using a virtual machine. Applications running in a VM aren’t normally allowed to reach out beyond their VM and interact with the host operating system (Windows, in your case). Someone with more VM experience than me will need to assess the feasibility of this approach.
Maybe you don’t even need Home Assistant to achieve your goal. There’s an Alexa skill for Cortana. This is pure speculation but maybe there is a way to ask Alexa to tell Cortana to ‘print my forms’ (assuming it’s possible to assign custom tasks to Cortana).
Thanks, im quite handy with Python when i get to grips with it again, i forget it as quick as i learn but it comes quicker than others, been 20 years since i touched VB. Any suggestions around Python? could i not create a network share and issue the script through that?
The choice of programming language isn’t the issue. After you create the script/app/whatever that prints the documents, your challenge is to execute it within Windows when called by Home Assistant running in a docker container within Linux in a virtual machine within Windows.
I know Home Assistant in a docker container can execute a script on its host operating system (linux). You want it to reach through one more abstraction layer, namely out of linux within the VM and into the VM’s host OS (Windows). If you believe that it’s only matter of creating an appropriate network share then give it a shot. Make a simple script in Windows (perhaps have it play a sound file) then try to call it from Home Assistant.