Got it working, although, had to change
output = “”
` to
output = “{”
on line 16 of the python script.
Thanks a lot.
Got it working, although, had to change
output = “”
` to
output = “{”
on line 16 of the python script.
Thanks a lot.
The Hassio Addon ( https://github.com/james-fry/hassio-addons ) is working fine with my Canon MG6400 series Inkjet.
Thanks everybody - this has helped me pluck up the courage to delve into MQTT and Lovelace custom addons which have been dark arts to me so far!!
Great jg.balcombe! But why don’t we just grab it with a command_line sensor?
sensor:
- platform: command_line
name: printer_color
scan_interval: 21600
command: curl -s http://192.168.0.23/DevMgmt/ConsumableConfigDyn.xml | grep -m1 'dd:ConsumablePercentageLevelRemaining' | sed 's/\s*<.*>\(.*\)<.*>/\1/'
- platform: command_line
name: printer_black
scan_interval: 21600
command: curl -s http://192.168.0.23/DevMgmt/ConsumableConfigDyn.xml | grep "dd:ConsumablePercentageLevelRemaining" | sed 's/\s*<.*>\(.*\)<.*>/\1/' | tail +2
- platform: command_line
name: printer_status
scan_interval: 10
command: curl -s http://192.168.0.23/DevMgmt/ProductStatusDyn.xml | grep "pscat:StatusCategory" | sed 's/\s*<.*>\(.*\)<.*>/\1/' | tail +2
- platform: template
sensors:
printer_status_template:
value_template: >-
{% if is_state("sensor.printer_status", "ready") %}
On
{% elif is_state("sensor.printer_status", "inPowerSave") %}
Idle
{% elif is_state("sensor.printer_status", "processing") %}
Printing
{% elif is_state("sensor.printer_status", "") %}
Off
{% else %}
{{ states.sensor.printer_status.state }}
{% endif %}
And it seems like even the printers web server fetches from the xml file
Hi - perfectly fine. At the start of this, I mentioned this was just a hack to get to the information - as previously people were trying to use SNMP to access the levels which weren’t showing.
Lots of good ways to do this, you’ve just shown another.
In fact there’s a thread about a HP Ink level component now, which seems to handle this printer (and others). I actually use that now - as it simplifies my config.
At the end of the day - it’s personal preference.
Regards,
James.
When I incorporated this I didn’t get the ink drop above the percent like was shown earlier in this thread. What makes that show or not? Do you have to define the icon on the entity itself?
With the newest bar-card you’ll need to update your lovelace card for the ink levels like so:
direction: up
entities:
- color: MediumTurquoise
entity: sensor.ink_cyan
- color: MediumOrchid
entity: sensor.ink_magenta
- color: Gold
entity: sensor.ink_yellow
- color: Black
entity: sensor.ink_black
- color: Black
entity: sensor.ink_photoblack
height: 200px
positions:
icon: inside
title: outside
max: 100
min: 0
padding: 2px
target: 20
type: 'custom:bar-card'
unit_of_measurement: '%'
stack: horizontal
title: Canon MX920 Printer Ink
style: |-
bar-card-title {
text-shadow: 1px 1px 5px black;
}
bar-card-value {
text-shadow: 1px 1px 5px black;
}
Sorry but no idea really
Maybe a ha update broke one of the custom cards? Check for updates for the cards
Read my post for the updated format.
Crap. I had it all tweaked the way I wanted and then put one wrong character in for one of my positions values and all my cards vanished. If I refresh the screen I see the cards flash and go away. I’m not using the raw editor.
Note on top of that any other card I create on that page now vanishes as well. If I refresh again I can see it’s there and then goes away.
I’d put money it’s the bar card. Have these everytime I refresh the page:
2020-04-05 20:40:32 ERROR (MainThread) [frontend.js.latest.202003181] <server>:8123/hacsfiles/bar-card/bar-card.js:757:60 Uncaught TypeError: Cannot set property 'textContent' of null
Also for reference without getting into a video. Load the page:
Then while the page is refreshing but not done loading yet
Then when loaded
Use the Raw editor and scroll down to the error and fix it or remove the changes you made. Then save it, should bring everything back.
Yeah but then once you’ve gone to that raw editor that’s your path going forward no? I did fix it but that was to delete the tab and since I document what I do I had it all in a Word document.
No it is not.
Whatever you’re comfortable with
The colors are gone with 3.0.6? I performed an Empty Cache and Hard Reload after the update and now my bars are all green? Anyone else seeing this?
Colors are defined per bar as per documentation and as shown in the examples shown in the thread.
command_line sensor is a great idea!!
What if I need to login into a website? I need to use it for my netro sprinkler @nalipaz
Works fine here colors and all:
I checked this morning again after restarting my PC, the colors are back! Very strange…