I have hassio in Docker on UbuntuServer and on ubuntu server I see printer. But how to install that in hassio?
How would i go about installing this in a docker image on unraid?
Thanks.
Inside the docker image i ran pip install ink
and that has installed the ink addon i think.
My printer is a HP Laserjet M451dn, and after waiting 15 minutes or so, I still have no levels.-
I have just seen above that only ink printers are supported, not laserjets.
Been using ink for some time.
I’ve already moved ink to its own directory as a result of 0.91, to /custom_components/ink . But, just updated to 0.92 and ink as a custom component is now broken.
Read the recent migration brief https://developers.home-assistant.io/blog/2019/04/12/new-integration-structure.html , is there anything I should do to make this work?
Solved!
Just add a manifest.json file with contents per the instructions provided below in your directory /custom_components/ink
I really liked the idea of your custom component, but as I use hassio I dont think it will work since ink needs to be installed in the homeassistant docker container.
So instead I took the approach to create a hassio addon that will run ink periodically, parse the output into JSON and sent it to HA via MQTT.
Its very much a hack job (esp the shell script that calls ink and mosquitto client for MQTT) but it works great for my Canon Pixma 5300, and supports HA MQTT autodiscovery - albeit in a very hard coded way
You can find it in my hassio addons repo:
To get other printers working you will probably need to edit the ink2mqtt.sh script.
Here is my lovelace card to show ink levels using the superb custom cards bar-card and vertical-stack-in-card:
type: 'custom:vertical-stack-in-card'
title: Canon MG5300 Printer Ink
cards:
- type: 'custom:bar-card'
columns: 5
direction: up
entities:
- color: MediumTurquoise
entity: sensor.canon_mg5300_cyan_ink_level
- color: MediumOrchid
entity: sensor.canon_mg5300_magenta_ink_level
- color: Gold
entity: sensor.canon_mg5300_yellow_ink_level
- color: Black
entity: sensor.canon_mg5300_black_ink_level
- color: Black
entity: sensor.canon_mg5300_photoblack_ink_level
height: 200px
max: 100
min: 0
padding: 2px
target: 20
title_position: bottom
icon_position: inside
unit_of_measurement: '%'
width: 100%
Hope it helps someone…
Thank you!
It tried this but after starting the addon, I see this in the log:
/bin/ash: /ink2mqtt.sh: not found
It is not clear to me what I need to edit in the /config/ink2mqtt/ink2mqtt.sh file?
Actually, you have commented out the MQTT-code in the sh-file, so how is this supposed to work?
Hi @bouwew
Sorry for the delay to reply - Ive been away on vacation.
Looks like I screwed up when copying the addon from my local addons dir to github.
I have updated the ink2mqtt.sh file in the repo now. Please d/l the file and copy it to \config\ink2mqtt\ink2mqtt.sh
Thanks! Unfortunately, it is still not working.
I wonder whether the installation of the add-on is executed correctly on my system (hassio)?
For instance, the file /ink2mqtt.sh is not there after it placed the ink2mqtt.sh file from the repo in \config\ink2mqtt\ink2mqtt.sh and reinstalled the add-on. I also wonder whether ink is installed?
When I issue the command “ink” at the command-line, it says: “-bash: ink: command not found”.
Hi @bouwew
The ink executable is in the hassio addon’s container.
When you install the addon it runs all the commands in the dockerfile to download the source code for libinklevel and ink and then compile them.
(This is why it takes a long time to install the addon vs than with the precompiled images like most addons have)
I only tested the addon on x86 since my hassio is running on an intel architecture VM.
The install procedure should be:
- Install the addon from my repo
- Download/copy the ink2mqtt.sh file from the repo to /config/ink2mqtt (subfolder in the hassio config dir that you will need to make)
When the addon starts it will copy the ink2mqtt.sh from the config folder into the container. If you see in the dockerfile this is the final line.
With one of my other addons (rtl433tomqtt) that works in the same way - by coying the control script from config dir - users reported issues if they created the .sh file via samba.
What do you get in the hassio system log when you install the addon?
What do you get in the addon log when you (try to) start the addon?
Yeah, that did the trick, I downloaded the ink2mqtt.sh via wget on the command-line.
Now I’m seeing good stuff in the log!
Thanks for the support!
Now, I’m trying to adapt the sh-file to my printer, a Canon MG 7500…
great news. good luck!
Fully working now
Great news!
If you want to, please share your ink2mqtt.sh script.
Alternatively submit a PR against my repo and ill add it as an example for your printer type.
i have a HP envy, also interested in this addon, since i am also running HassOS
bit if i scroll above, seems for HP, HPLIB needs to be installed? is this also included?
HPlib is not included in the ink2mqtt hassio addons dockerfile currently, but no reason it cannot be added.
The problem here is that I don’t have a HP envy printer to test with.
My suggestion would be to clone my ink2mqtt addon to your hassio local addons dir and to work our how to install hplib as part of the image creation. You can see in the dockerfile what I needed to install/compile for ink.
You’ll presumably also need to change the shell script that calls ink to call the HP executable and parse its output.
thnx, but i have not much experience with docker/coding/compiling,
just a regular HA user
i have asked on github HassOS, to maybe include INK & HPLIB in next HassOS releases , much easier then?
That is not how a HA add-on works, each add-on runs in its own container, independent from the HA main container, that’s at least how I understood it.
Please note: the printer add-on by hijinx has been improved somewhat, it should now be easier to install and configure: https://github.com/james-fry/hassio-addons
Please note 2: only for printers that work with ink
.