Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Command to turn on the machine #5

Closed
bubez81 opened this issue Feb 24, 2023 · 9 comments
Closed

Command to turn on the machine #5

bubez81 opened this issue Feb 24, 2023 · 9 comments

Comments

@bubez81
Copy link

bubez81 commented Feb 24, 2023

Hello, very interesting work!!! One question, it's possibile to only turn on the machine?

@mmastrac
Copy link
Owner

@bubez81 There's not currently a turn-on command, but that's a great idea for a new subcommand.

As a workaround, you can ask for a beverage that requires parameters and not provide them, while also passing the --turn-on flag:

cargo run -- brew --beverage hotwater --device-name [...] --turn-on

@bubez81
Copy link
Author

bubez81 commented Feb 25, 2023

Great, the solution works perfectly.
I was wondering if you also noticed this:
I believe that something has changed for some time, perhaps a firmware update, but in my opinion the machine can no longer receive more than one command at a time.
Let me explain better, before you could have a connection from one device at a time (only the iPhone app or only from the PC) now if the connection from the PC remains open it is not possible to send a second command, so if I am monitoring the machine status I can't send the command to make coffee until I stop the command to monitor (ctrl + C)
es: if I have this
Screenshot 2023-02-25 alle 09 20 03

@mmastrac
Copy link
Owner

FWIW, I have never been able to connect to a machine multiple times w/Bluetooth. I've noticed that the machine will actively refuse a second connection, in fact. Earlier in the development of this project I was stumped a few times by the official app staying connected over bluetooth!

I think that for this particular case, there would need to be some sort of arbitrator process that either re-broadcast a bluetooth signal, or proxied the bluetooth signal to wifi and allowed for network connections instead.

I'd be more than happy to discuss a design for opening up a websockets server from the process and allowing multi-plexing that way!

@mmastrac
Copy link
Owner

@bubez81 I added a new status command that takes --turn-on as a parameter, so you won't need to use the fake brew command. It appears to be working, so I'll close this issue for now!

@bubez81
Copy link
Author

bubez81 commented Feb 25, 2023

Thenk you!! meanwhile i integrated your software into my system in homeassistant ;)
Screenshot 2023-02-25 alle 23 32 38

@mmastrac
Copy link
Owner

That's super-cool. If you open-source it, let me know and I'll link it in the README :)

@bubez81
Copy link
Author

bubez81 commented Feb 27, 2023

Oh it's very simple, in home assistant I add this command_line shell_command:

prepara_espresso: /Users/michele/longshot/target/debug/longshot brew --device-name 8bb8f40d-4437-3e11-9fee-97d8c0584a48 --turn-on --beverage espressocoffee --coffee 30 --taste strong

accendi_delonghi: /Users/michele/longshot/target/debug/longshot brew --beverage hotwater --device-name 8bb8f40d-4437-3e11-9fee-97d8c0584a48 --turn-on

and then I create a card in Lovelace and call the service as a button:

          - type: custom:button-card
            layout: icon_name_state2nd
            tap_action:
              action: call-service
              service: shell_command.accendi_delonghi
              data: {}
              target: {}
            name: Accensione
            show_icon: true
            show_state: true
            icon: mdi:coffee-maker

@mmastrac
Copy link
Owner

Cool! I might link your comment here to the README to demo how you can integrate it into HA if you don't mind. :)

@bubez81
Copy link
Author

bubez81 commented Feb 27, 2023

sure! perfect!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants