Just finished setting up the OP’s version of the Ink Custom Component on Home Assistant 0.98.5 and figured I’d provide an updated set of installation instructions. I am running HA in a venv on an Ubuntu 18.04 VM in ESXi 6.0. My printer is a Canon MX922
Please note, these steps are NOT for HASSIO. They also assume you have a basic understanding of working with linux and linux file permissions.
- SSH into your HA instance
- Install the Ink command
sudo apt install ink -Y
- Navigate to /<your-ha-root-directory/custom_components/ (Note: For a venv, the default root folder location for HA is /home/homeassistant/.homeassistant/)
- Create a 0.92 compatible folder for the Ink component.
sudo mkdir ink/
- Download the Custom Component from the OP’s github. The link below is the correct link to the raw version of the file.
sudo wget https://raw.githubusercontent.com/nalipaz/home-assistant-config/master/custom_components/sensor/ink.py
- Rename ink.py to sensor.py. (Note: This was the only way I could get the Ink component to load in my environment.)
sudo mv ink.py sensor.py
- Create and edit manifest.json
sudo touch manifest.json
sudo nano manifest.json
- Copy/Paste the following into manifest.json exactly as shown. Spacing is important!
{
"domain": "ink",
"name": "Ink",
"documentation": "https://github.com/nalipaz/home-assistant-config/blob/cc688694f96e60783917197613a9e24224eb05ae/custom_components/sensor/ink.py",
"dependencies": [],
"codeowners": ["@nalipaz"],
"requirements": []
}
- Save the file and exit.
Control+X, then Y, then Enter/Return
- Verify that the
ink
subfolder, and the manifest.json
and sensor.py
files are owned by the home assistant user/service account.
- Tail (i.e. watch) the home-assistant.log file to ensure the component loads correctly when executing step 12.
tail -f /<your HA directory>/home-assistant.log | grep ink
- Restart Home Assistant via the Home Assistant UI
If you see messages similar to the following, you know you’ve set up the Custom Component correctly.
2019-09-09 10:43:02 WARNING (MainThread) [homeassistant.loader] You are using a custom integration for ink which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you do experience issues with Home Assistant.
2019-09-09 10:43:03 INFO (MainThread) [homeassistant.components.sensor] Setting up sensor.ink
The next step is to configure your printer in sensor.yaml as outlined in the first post of this thread. Be aware that if you have logging (i.e. logger:
) enabled in your configuration.yaml, you will flood home-assistant.log with an error for each and every color listed under resources:
that is not supported by your printer. These errors will repeat at every scan interval. In this case, you will want to cull your list of supported colors quickly to avoid crashing HA.
For those of you with a Canon MX922, here is the sensor.yaml config that worked for me.
- platform: ink
host: <your-ip-here>
scan_interval: 120
resources:
- black
- cyan
- magenta
- yellow
- photoblack
Once you’ve added the entry in sensor.yaml, Check your Config via the HA UI, then Restart HA once more if everything checks out. Once the reboot is complete, you should see new sensor entries in your entities list similar to the ones in the screenshot below.
Hopefully this will helps others. Let me know if you encounter any errors with these instructions.
And a Big Thanks to @curt7000 for pointing out the new manifest.json requirement that was added in 0.92.0.