fribse
(Kenneths Teknik)
January 21, 2020, 7:37am
1
First off, this is NOT my work, I’m just so impressed so I wanted to show the result of it.
@Bieniu created the Brother Printer integration, and @Gluwc made the bar card, and these in combination makes it completely lala
This is the result of it, and it is just great, thankyou for the excellent work @Bieniu and @Gluwc
The sensor names have been changed in customizations.
This is the card config:
cards:
- entities:
- entity: sensor.fribert_stuen_status
- entity: sensor.fribert_stuen_uptime
- entity: sensor.fribert_stuen_page_counter
- entity: sensor.fribert_stuen_b_w_counter
- entity: sensor.fribert_stuen_color_counter
type: entities
- entities:
- color: black
entity: sensor.fribert_stuen_black_toner_remaining
- color: magenta
entity: sensor.fribert_stuen_magenta_toner_remaining
- color: yellow
entity: sensor.fribert_stuen_yellow_toner_remaining
- color: cyan
entity: sensor.fribert_stuen_cyan_toner_remaining
- entity: sensor.fribert_stuen_belt_unit_remaining_life
severity:
- color: red
value: 10
- color: yellow
value: 20
- color: green
value: 100
- entity: sensor.fribert_stuen_fuser_remaining_life
severity:
- color: red
value: 10
- color: yellow
value: 20
- color: green
value: 100
- entity: sensor.fribert_stuen_pf_kit_1_remaining_life
severity:
- color: red
value: 10
- color: yellow
value: 20
- color: green
value: 100
title_position: inside
type: 'custom:bar-card'
title: Brother DCP-9020CDW Printer
type: vertical-stack
6 Likes
My printer seems to disappear often and gets listed as “Unavailable”. It’s using ethernet and not Wifi. Anyone have ideas on why it would do this?
fribse
(Kenneths Teknik)
January 21, 2020, 7:54pm
3
fixed ip?
firmware updates?
my printer is a quite old model, but its very stable.
Yep. It’s got a static lease. I’ve never looked at firmware updates, though
dwinnn
January 25, 2020, 11:17pm
6
Thanks for this example and thanks @Bieniu for creating this component. I have a Brother HL-L2380DW all-in-one printer and it was automatically detected by the integration.
2 Likes
eggman
(bertie basset)
February 8, 2020, 7:10pm
7
great integration - thanks guys.
- type: entities
title: Laser Printer
show_header_toggle: false
entities:
- type: custom:hui-horizontal-stack-card
cards:
- type: custom:hui-horizontal-stack-card
cards:
{% for color in colors %}
- type: custom:bar-card
entity: sensor.hl_l8250cdn_{{ color }}_toner_remaining
color: {{ color }}
title_position: 'off'
unit_of_measurement: '%'
direction: up
indicator: auto-vertical
width: 3em
height: 8em
rounding: 10px
style: |
ha-card {
border-radius: 0;
box-shadow: none;
background: transparent;
}
{% endfor %}
- type: picture-elements
image: /local/images/short-empty.png
elements:
- type: image
image: /local/images/printer.png
style:
top: 140%
left: 50%
width: 100%
filter: drop-shadow(2px 2px 5px rgb(100, 100, 100, 1)
style: |
ha-card {
border-radius: 0;
box-shadow: none;
background: transparent;
height: 100%;
}
- type: custom:hui-horizontal-stack-card
cards:
- type: entities
show_header_toggle: false
entities:
- entity: sensor.hl_l8250cdn_page_counter
name: Pages
- entity: sensor.hl_l8250cdn_color_counter
name: Colour
- entity: sensor.hl_l8250cdn_b_w_counter
name: B&W
theme: no-shadow
- type: entities
show_header_toggle: false
entities:
- entity: sensor.hl_l8250cdn_belt_unit_remaining_life
name: Belt
- entity: sensor.hl_l8250cdn_drum_remaining_life
name: Drum
- entity: sensor.hl_l8250cdn_fuser_remaining_life
name: Fuser
theme: no-shadow
P.S. The code depends on lovelace_gen so I don’t repeat the setup for the colors, easy enough to do a section for each color if preferred. Otherwise you’d need to add lovelace_gen and the following:
{% set colors = ['cyan', 'magenta', 'yellow', 'black'] %}
4 Likes
fribse
(Kenneths Teknik)
February 10, 2020, 12:10pm
8
So, as far as I can see, you are using two custom items.
hui-horizontal-stack-card
lovelace_gen
and you’ve placed them in a entities card.
The hui-horizontal-stack-card is not in HACS, right? Or is it called something weird.
eggman
(bertie basset)
February 10, 2020, 4:48pm
9
Lovelace_gen isn’t really a card, more a way to build your config programmatically. I wouldn’t install it just for this, but I use it for more complex views, so it’s already there.
I put everything into an entities card so they end up looking like a single card. You can use other cards as rows in entity cards. But if you do you have to refer to them as custom:hui-card-name-card. So, I’m just using the standard horizontal-stack card.
1 Like
fribse
(Kenneths Teknik)
February 16, 2020, 9:11am
10
Hi Bertie
I finally got some time to look into this, it is very enlightening with the way to use horizontal/vertical cards.
I used it on my ‘alarms’ card, that I wasn’t satisfied with, and it looks much better now.
I’m changing my printercard to match yours, it’s simply prettier
One thing I can’t figure out, in the ‘pictures-elements’ card inside, where it shows the printer, you use a
image: /local/images/short-empty.png
What is that? A transparent picture of a certain size, or what does it do?
eggman
(bertie basset)
February 16, 2020, 9:29am
11
Yes, exactly that.
I used picture-elements here to give me control over positioning the printer image.
TBH looking at all this, it might have been easier to do the whole thing in a picture-elements card, and use the positioning options in that to place things (rather than all the horizontal / vertical stacks).
I often set off in one direction, find issues and fix them. I’m not so good at looking back at it and rethinking at the end, to see if it could have been done more simply.
fribse
(Kenneths Teknik)
February 16, 2020, 9:49am
12
Hmm, yes, it might be true, but I have the exact same problem, if it works, I’ll leave it Otherwise I could keep changing stuff as I learn.
I’m trying to position the image, but I can’t make it look right, what’s the size of the printer picture compared to the short-empty???
Mine looks like this at the moment??? :
Have you got those images available somewhere?
fribse
(Kenneths Teknik)
February 16, 2020, 5:22pm
14
Ahh, got a lot closer, it looks almost correct now.
Still need to try and make the printer a bit smaller.
But below the edit window I see this message (it still works):
Expected a value of type {entity,name,icon} | entity-id
for entities.0.type
but received "custom:hui-horizontal-stack-card"
.
myle
(StePhan McKillen (Other kiwi Here))
February 16, 2020, 6:28pm
15
Is the ipaddress changing
myle
(StePhan McKillen (Other kiwi Here))
February 16, 2020, 6:30pm
16
Could u post your lovelace code
Thanks
eggman
(bertie basset)
February 16, 2020, 6:54pm
17
looking good, if you want the printer smaller, just change the width and the height will scale
hard to say what the error might be unless you post your yaml
fribse
(Kenneths Teknik)
February 16, 2020, 7:35pm
18
The yaml looks like this (it’s quite long)
No, the IP is the same.
type: entities
title: Brother DCP9020-CDW
show_header_toggle: false
entities:
- type: 'custom:hui-horizontal-stack-card'
cards:
- type: 'custom:hui-horizontal-stack-card'
cards:
- type: 'custom:bar-card'
entity: sensor.fribert_stuen_black_toner_remaining
color: black
title_position: 'off'
unit_of_measurement: '%'
direction: up
indicator: auto-vertical
width: 3em
height: 14em
rounding: 10px
style: |
ha-card {
border-radius: 0;
box-shadow: none;
background: transparent;
}
icon_position: 'off'
saturation: 50%
animation: auto
speed: 1000
delay: 5000
min: 0
max: 100
padding: 4px
align: center
tap_action: info
show_value: true
limit_value: false
show_minmax: false
title: false
severity: false
target: false
attribute: false
icon: false
charge_entity: false
card_style: false
icon_style: false
title_style: false
value_style: false
minmax_style: false
background_style: false
visibility: false
decimal: false
entities:
- entity: sensor.fribert_stuen_black_toner_remaining
- type: 'custom:bar-card'
entity: sensor.fribert_stuen_cyan_toner_remaining
color: cyan
title_position: 'off'
unit_of_measurement: '%'
direction: up
indicator: auto-vertical
width: 3em
height: 14em
rounding: 10px
style: |
ha-card {
border-radius: 0;
box-shadow: none;
background: transparent;
}
icon_position: 'off'
saturation: 50%
animation: auto
speed: 1000
delay: 5000
min: 0
max: 100
padding: 4px
align: center
tap_action: info
show_value: true
limit_value: false
show_minmax: false
title: false
severity: false
target: false
attribute: false
icon: false
charge_entity: false
card_style: false
icon_style: false
title_style: false
value_style: false
minmax_style: false
background_style: false
visibility: false
decimal: false
entities:
- entity: sensor.fribert_stuen_cyan_toner_remaining
- type: 'custom:bar-card'
entity: sensor.fribert_stuen_magenta_toner_remaining
color: magenta
title_position: 'off'
unit_of_measurement: '%'
direction: up
indicator: auto-vertical
width: 3em
height: 14em
rounding: 10px
style: |
ha-card {
border-radius: 0;
box-shadow: none;
background: transparent;
}
icon_position: 'off'
saturation: 50%
animation: auto
speed: 1000
delay: 5000
min: 0
max: 100
padding: 4px
align: center
tap_action: info
show_value: true
limit_value: false
show_minmax: false
title: false
severity: false
target: false
attribute: false
icon: false
charge_entity: false
card_style: false
icon_style: false
title_style: false
value_style: false
minmax_style: false
background_style: false
visibility: false
decimal: false
entities:
- entity: sensor.fribert_stuen_magenta_toner_remaining
- type: 'custom:bar-card'
entity: sensor.fribert_stuen_yellow_toner_remaining
color: yellow
title_position: 'off'
unit_of_measurement: '%'
direction: up
indicator: auto-vertical
width: 3em
height: 14em
rounding: 10px
style: |
ha-card {
border-radius: 0;
box-shadow: none;
background: transparent;
}
icon_position: 'off'
saturation: 50%
animation: auto
speed: 1000
delay: 5000
min: 0
max: 100
padding: 4px
align: center
tap_action: info
show_value: true
limit_value: false
show_minmax: false
title: false
severity: false
target: false
attribute: false
icon: false
charge_entity: false
card_style: false
icon_style: false
title_style: false
value_style: false
minmax_style: false
background_style: false
visibility: false
decimal: false
entities:
- entity: sensor.fribert_stuen_yellow_toner_remaining
- type: picture-elements
image: /local/printer/short-empty.png
elements:
- type: image
image: /local/printer/brotherdcp9020cdw2.png
style:
top: 50%
left: 50%
width: 100%
filter: 'drop-shadow(2px 2px 5px rgb(100, 100, 100, 1)'
style: |
ha-card {
border-radius: 0;
box-shadow: none;
background: transparent;
height: 100%;
}
- cards:
- entities:
- entity: sensor.fribert_stuen_page_counter
name: Sider
- entity: sensor.fribert_stuen_color_counter
name: Farveprint
- entity: sensor.fribert_stuen_b_w_counter
name: Sort/Hvid print
show_header_toggle: false
theme: no-shadow
type: entities
- entities:
- entity: sensor.fribert_stuen_belt_unit_remaining_life
name: Belt
- entity: sensor.fribert_stuen_pf_kit_1_remaining_life
name: PF Kit
- entity: sensor.fribert_stuen_fuser_remaining_life
name: Fuser
show_header_toggle: false
theme: no-shadow
type: entities
type: 'custom:hui-horizontal-stack-card'
Bieniu
(Maciek)
February 25, 2020, 10:06am
19
Guys I need some help to add some new sensors for the integration. If someone has a color printer with a small amount of color (not black) toner, this can do for me:
pip install --upgrade git+https://github.com/bieniu/brother@dev
curl https://raw.githubusercontent.com/bieniu/brother/dev/example.py -o example.py
python3 example.py <PRINTER_IP>
As a result, the text RAW data: {...}
will appear. I need thit data from {...}
with information which toner is low in the printer.
fribse
(Kenneths Teknik)
February 25, 2020, 7:54pm
20
I have a yellow with 21% is that low enough?
How would I go about doing this, just via the ssh addon?
Bieniu
(Maciek)
February 25, 2020, 8:16pm
21
I’m not sure, I think that has to be below 11%. On the printer’s www panel should be information about low toner
.