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

File List #65

Open
willpuckett opened this issue Apr 6, 2021 · 4 comments
Open

File List #65

willpuckett opened this issue Apr 6, 2021 · 4 comments
Assignees
Labels
documentation Improvements or additions to documentation

Comments

@willpuckett
Copy link

First, thanks for one of the best, most powerful plugins in the Octoprint ecosystem, as well as the superb documentation for it (especially the safe shutdown script and automation). It's truly transformative.

Is it feasible to be able to display a list of the files in Octoprint's uploads folder and be able to launch jobs via Homeassistant?

thanks again!

@willpuckett
Copy link
Author

willpuckett commented Apr 7, 2021

So, I continued digging and on the way also thought it would be nice to be able to send arbitrary gcode via Home Assistant.

Installing text-input-row (community discussion here), I came up with:

entities:
  - entity: input_text.gcode
    type: 'custom:text-input-row'
  - action_name: Send Gcode...
    icon: 'mdi:keyboard'
    name: ' '
    service: mqtt.publish
    service_data:
      topic: octoPrint/hassControl/commands
      payload_template: "{{ states('input_text.gcode') }}"
    type: call-service
type: entities

But am getting a variable not found kind of thing when I reference input_text.gcode, so I'm obviously doing it slightly wrong... Trying to sort through templates now...

@willpuckett
Copy link
Author

willpuckett commented Apr 8, 2021

I haven't worked out adding a file list, but I did get a terminal field put together today.

In Lovelace config:

views:
  - title: Printers
    path: printers
    badges: []
    cards: []
cards:
  - card:
      type: picture-entity
      entity: camera.axon
    conditions:
      - entity: binary_sensor.axon_printing
        state_not: unavailable
    type: conditional
  - cards:
      - entity: input_text.gcode
        type: 'custom:text-input-row'
      - name: Send...
        tap_action:
          action: call-service
          service: mqtt.publish
          service_data:
            topic: Axon/hassControl/commands
            payload_template: '{{ states("input_text.gcode") }}'
        type: button
    type: horizontal-stack

You'll have to install text-input-row and then add your variable to Home Assistant's configuration.yaml like:

input_text: !include input_text.yaml

And then create an input_text.yaml file with:

gcode:
  icon: 'mdi:keyboard'

Thanks again!

@cmroche
Copy link
Owner

cmroche commented Apr 8, 2021

Thanks for sharing this. I'll leave the issue open and test this myself soon (this weekend if I can find the time) and if it works I'll add it to the examples.

@cmroche cmroche self-assigned this Apr 8, 2021
@cmroche cmroche added the documentation Improvements or additions to documentation label Apr 8, 2021
@willpuckett
Copy link
Author

willpuckett commented Apr 8, 2021

I hope it's helpful!

Here's a screenshot:
IMG_4362

The only caveat I've found is that to update the input_text variable, I either have to press return after typing it BEFORE pressing the send button, or click outside the field (but not on the send button) to set the variable, and then click send. Of course, I would prefer to be able to simply type the gcode and press enter to have it send, so maybe some more attention this weekend could be useful....

I'm happy to provide better instructions if my earlier ramblings prove uninterpretable 🙃

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

No branches or pull requests

2 participants