Skip to content
This repository was archived by the owner on May 1, 2024. It is now read-only.

Commit 2609ca1

Browse files
author
Dan Greco
committed
Update screenshots
1 parent b25e306 commit 2609ca1

File tree

13 files changed

+119
-29
lines changed

13 files changed

+119
-29
lines changed

README.md

Lines changed: 35 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
## Home Asssistant card for 3D printers (via OctoPrint integration)
44

55

6-
![Screenshot](https://github.com/dangreco/threedy/raw/master/screenshot.png)
6+
![Featured](https://github.com/dangreco/threedy/raw/master/screenshots/active.png)
77

88

99

@@ -25,31 +25,61 @@
2525
## Config
2626
---
2727

28+
### Required
29+
2830
- ```type``` — Always ```'custom:threedy-card'```
2931
- ```base_entity``` — Take the beginning of one of the OctoPrint sensors of your printer. Example: for ```sensor.ender_3_v2_current_state``` it would be ```sensor_ender_3_v2```.
3032
- ```name``` — Can be whatever you want!
33+
- ```printer_type``` — Use a printer style: ```'I3' | 'Cantilever' | 'Boxy' | 'Delta' ```
34+
- ```monitored``` — A list of values to monitor throughout the print; gets displayed to the right of the printer.
35+
36+
### Optional
37+
3138
- ```theme``` — Theme of the card: ```'Default' | 'Material' | 'Neumorphic' ```. Screenshots listed below.
39+
- ```font``` — Specify the font used in the card. By default it is ```sans-serif```.
3240
- ```scale``` — The scale factor of the animated 3D printer view. Try different values until you find one you like.
33-
- ```printer_type``` — Use a printer style: ```'I3' | 'Cantilever' | 'Boxy' | 'Delta' ```
41+
- ```round``` — Specify whether to round decimal numbers in the card. Defaults to true. ```true | false```
3442
- ```printer_config``` — Use in with ```printer_type``` to set a custom printer style. If omitted, the default for the type will be used. Use [this tool](https://google.com) to create a custom value.
35-
- ```monitored``` — A list of values to monitor throughout the print; gets displayed to the right of the printer.
3643

3744
## Example Config
3845
---
3946

4047
```yaml
48+
# required
4149
type: 'custom:threedy-card'
4250
base_entity: 'sensor.ender_3_v2'
4351
name: 'Ender 3 v2'
44-
theme: 'Default'
45-
scale: 0.5
4652
printer_type: I3
4753
monitored:
4854
- Status
4955
- ETA
5056
- Elapsed
5157
- Hotend
5258
- Bed
59+
# optionals
60+
theme: 'Default'
61+
font: 'Roboto'
62+
scale: 0.5
63+
round: false
5364
```
5465
5566
67+
## Screenshots
68+
---
69+
70+
### Active Print
71+
72+
![Active](https://github.com/dangreco/threedy/raw/master/screenshots/active.png)
73+
74+
### Idle
75+
76+
![Idle](https://github.com/dangreco/threedy/raw/master/screenshots/idle.png)
77+
78+
### Printer Offline
79+
80+
![Offline](https://github.com/dangreco/threedy/raw/master/screenshots/offline.png)
81+
82+
### Show/Hide Animation
83+
84+
![ShowHide](https://media.giphy.com/media/14VgtFSulJkOaRiZFo/giphy.gif)
85+

dist/bundle.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,11 @@
4444
type: 'custom:threedy-card',
4545
base_entity: 'sensor.ender_3_v2',
4646
name: "Ender 3 v2",
47-
theme: "Neumorphic",
47+
theme: "Default",
4848
scale: 1,
4949
printer_type: 'I3',
50+
round: false,
51+
font: 'Assistant',
5052
monitored: [
5153
"Status",
5254
"Hotend",

screenshot.png

-21.6 KB
Binary file not shown.

screenshots/active.png

79.9 KB
Loading

screenshots/idle.png

30 KB
Loading

screenshots/offline.png

30.5 KB
Loading

src/Components/Card/index.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,16 @@ const Card = ({ }) => {
1919
const state = hass.states[`${config.base_entity}_current_state`].state
2020
const hidden = state !== 'Printing'
2121
const statusColor = state === 'Printing' ? "#4caf50" : state === "Unknown" ? "#f44336" : state === "Operational" ? "#00bcd4" : "#ffc107"
22+
const borderRadius = styles[theme].borderRadius;
2223

2324
return (
2425
<motion.div
25-
animate={{ borderRadius: hidden ? 16 : 32 }}
26+
animate={{ borderRadius: hidden ? borderRadius : borderRadius * 2 }}
2627
transition={{ ease: "easeInOut", duration: 0.25 }}
2728
style={{
2829
...styles.Card,
29-
...styles[theme]
30+
...styles[theme],
31+
fontFamily: config.font || 'sans-serif'
3032
}}
3133
>
3234
<div style={{ ...styles.Root }}>
@@ -47,7 +49,7 @@ const Card = ({ }) => {
4749
<div style={{ ...styles.Section }}>
4850
<PrinterView />
4951
</div>
50-
<div style={{ ...styles.Section, paddingLeft: 32, paddingRight: 32 }}>
52+
<div style={{ ...styles.Section, paddingLeft: 16, paddingRight: 32 }}>
5153
<Stats />
5254
</div>
5355
</motion.div>

src/Components/Card/styles.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ const styles = {
1515
padding: '0 16px 32px 16px'
1616
},
1717
Default: {
18-
borderRadius: 'var(--ha-card-border-radius, 4px)',
18+
borderRadius: 4,
1919
boxShadow: 'var( --ha-card-box-shadow, 0px 2px 1px -1px rgba(0, 0, 0, 0.2), 0px 1px 1px 0px rgba(0, 0, 0, 0.14), 0px 1px 3px 0px rgba(0, 0, 0, 0.12) )',
2020
color: 'var(--primary-text-color)'
2121
},
2222
Neumorphic: {
23-
borderRadius: 32,
23+
borderRadius: 16,
2424
boxShadow: '20px 20px 60px #d9d9d9, -20px -20px 60px #ffffff',
2525
margin: 24
2626
},

src/Components/Stats/index.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ const Stat = ({ condition }) => {
1616
config
1717
} = useContext(ThreedyContext);
1818

19+
const round = config.round === undefined ? true : config.round;
20+
1921
const entityEnding = (() => {
2022
switch (condition) {
2123
case 'Status':
@@ -56,9 +58,9 @@ const Stat = ({ condition }) => {
5658
case 'Elapsed':
5759
return format_seconds_elapsed(entity.state)
5860
case 'Hotend':
59-
return `${entity.state}${entity.attributes.unit_of_measurement}`
61+
return `${round ? Math.round(entity.state) : entity.state}${entity.attributes.unit_of_measurement}`
6062
case 'Bed':
61-
return `${entity.state}${entity.attributes.unit_of_measurement}`
63+
return `${round ? Math.round(entity.state) : entity.state}${entity.attributes.unit_of_measurement}`
6264
default:
6365
return '<unknown>'
6466
}
@@ -80,12 +82,14 @@ const Stats = () => {
8082
config,
8183
} = useContext(ThreedyContext);
8284

85+
const round = config.round === undefined ? true : config.round
86+
8387
const percentComplete = hass.states[`${config.base_entity}_job_percentage`].state;
8488

8589
return (
8690
<div style={{ ...styles.Stats }}>
8791
<div style={{ ...styles.Percent }}>
88-
<p style={{ ...styles.PercentText }}>{ percentComplete }%</p>
92+
<p style={{ ...styles.PercentText }}>{ round ? Math.round(percentComplete) : percentComplete }%</p>
8993
</div>
9094
<div style={{ ...styles.Monitored }}>
9195
{

0 commit comments

Comments
 (0)