113 lines
12 KiB
JSON
113 lines
12 KiB
JSON
[
|
|
{
|
|
"id": "ePaper - Waste collection",
|
|
"automation": "- alias: ePaper - Waste collection\n description: Based on MuddyRock's code, minor adjustments/improvements made by github.com/svenove.\n Supports unlimited number of wastes and displays the 4 next ones in order.\n triggers:\n - at: 05:30:00\n trigger: time\n conditions: []\n actions:\n - variables:\n bins: \"{% set bins_list = [\\n {'entity_id': 'sensor.waste_food', 'days': states('sensor.waste_food')\\\n \\ | default(0) | float }, \\n {'entity_id': 'sensor.waste_plastic', 'days':\\\n \\ states('sensor.waste_food') | default(0) | float },\\n {'entity_id': 'sensor.waste_glass_metal',\\\n \\ 'days': states('sensor.waste_glass_metal') | default(0) | float }, \\n {'entity_id':\\\n \\ 'sensor.waste_general', 'days': states('sensor.waste_general') | default(0)\\\n \\ | float }, \\n {'entity_id': 'sensor.waste_paper', 'days': states('sensor.waste_paper')\\\n \\ | default(0) | float }] %}\\n{% set sorted_list=bins_list | sort(attribute='days')\\\n \\ | map(attribute='entity_id') | list %} {{ sorted_list }}\"\n dark_mode: false\n translation_today: Today\n translation_tonight: Tomorrow\n translation_days: days\n translation_unknown: Unknown\n timeformat: '%H:%M'\n weekdays:\n - Mon\n - Tue\n - Wed\n - Thu\n - Fri\n - Sat\n - Sun\n alias: Define config variables (edit to your needs)\n - variables:\n trash1_sensor: '{{translation_unknown if bins is undefined else bins[0]}}'\n trash1_days: '{%if trash1_sensor == translation_unknown or states(''''''''~trash1_sensor)\n == None or states(''''''''~trash1_sensor) == ''unknown'' %}999{%else%}{{states(''''''''~trash1_sensor)}}{%endif%}'\n trash1_name: '{{translation_unknown if trash1_sensor is undefined else state_attr(trash1_sensor,\n ''friendly_name'') }}'\n trash2_sensor: '{{translation_unknown if bins is undefined else bins[1]}}'\n trash2_days: '{%if trash2_sensor == translation_unknown or states(''''''''~trash2_sensor)\n == None or states(''''''''~trash2_sensor) == ''unknown'' %}999{%else%}{{states(''''''''~trash2_sensor)}}{%endif%}'\n trash2_name: '{{translation_unknown if trash2_sensor is undefined else state_attr(trash2_sensor,\n ''friendly_name'') }}'\n trash3_sensor: '{{translation_unknown if bins is undefined else bins[2]}}'\n trash3_days: '{%if trash3_sensor == translation_unknown or states(''''''''~trash3_sensor)\n == None or states(''''''''~trash3_sensor) == ''unknown'' %}999{%else%}{{states(''''''''~trash3_sensor)}}{%endif%}'\n trash3_name: '{{translation_unknown if trash3_sensor is undefined else state_attr(trash3_sensor,\n ''friendly_name'') }}'\n trash4_sensor: '{{translation_unknown if bins is undefined else bins[3]}}'\n trash4_days: '{%if trash4_sensor == translation_unknown or states(''''''''~trash4_sensor)\n == None or states(''''''''~trash4_sensor) == ''unknown'' %}999{%else%}{{states(''''''''~trash4_sensor)}}{%endif%}'\n trash4_name: '{{translation_unknown if trash4_sensor is undefined else state_attr(trash4_sensor,\n ''friendly_name'') }}'\n off_day_background: '{{''black'' if dark_mode else ''white''}}'\n on_day_background: red\n off_day_text: '{{''white'' if dark_mode else ''black''}}'\n on_day_text: white\n alias: Create variables needed later (no need to change manually)\n - action: open_epaper_link.drawcustom\n metadata: {}\n data:\n background: '{{ off_day_background }}'\n rotate: 0\n dry-run: false\n ttl: 60\n payload:\n - type: line\n fill: red\n width: 3\n x_start: 5\n y_start: 56\n x_end: 121\n y_end: 56\n - type: line\n fill: red\n width: 3\n x_start: 168\n y_start: 56\n x_end: 290\n y_end: 56\n - type: line\n fill: red\n width: 3\n x_start: 148\n y_start: 3\n x_end: 148\n y_end: 34\n - type: line\n fill: red\n width: 3\n x_start: 148\n y_start: 60\n x_end: 148\n y_end: 110\n - type: rectangle\n outline: '{{off_day_background}}'\n fill: '{{off_day_background if trash1_days | int > 1 else on_day_background\n }}'\n width: 1\n x_start: 5\n y_start: 3\n x_end: 144\n y_end: 52\n - type: text\n value: '{{trash1_name}}'\n font: ppb.ttf\n x: 10\n y: 8\n size: 18\n color: '{{off_day_text if trash1_days == \"unknown\" or trash1_days > 1 else\n on_day_text }}'\n - type: text\n value: '{% if trash1_days | int == 999 %}{{translation_unknown}}{% elif trash1_days\n | int == 0 %}{{translation_today}}{% elif trash1_days | int == 1 %}{{translation_tonight}}{%\n else %}{{trash1_days}} {{translation_days}}{% endif %}'\n font: ppb.ttf\n x: 8\n y: 33\n size: 18\n color: '{{off_day_text if trash1_days == \"unknown\" or trash1_days > 1 else\n on_day_text }}'\n - type: rectangle\n outline: '{{off_day_background}}'\n fill: '{{off_day_background if trash2_days | int > 1 else on_day_background\n }}'\n width: 1\n x_start: 152\n y_start: 3\n x_end: 290\n y_end: 52\n - type: text\n value: '{{trash2_name}}'\n font: ppb.ttf\n x: 180\n y: 8\n size: 18\n color: '{{off_day_text if trash2_days == \"unknown\" or trash2_days > 1 else\n on_day_text }}'\n - type: text\n value: '{% if trash2_days | int == 999 %}{{translation_unknown}}{% elif trash2_days\n | int == 0 %}{{translation_today}}{% elif trash2_days | int == 1 %}{{translation_tonight}}{%\n else %}{{trash2_days}} {{translation_days}}{% endif %}'\n font: ppb.ttf\n x: 180\n y: 33\n size: 18\n color: '{{off_day_text if trash2_days == ''unknown'' or trash2_days > 1 else\n on_day_text }}'\n - type: rectangle\n outline: '{{off_day_background}}'\n fill: '{{off_day_background if trash3_days | int > 1 else on_day_background\n }}'\n width: 1\n x_start: 5\n y_start: 60\n x_end: 144\n y_end: 107\n - type: text\n value: '{{trash3_name}}'\n font: ppb.ttf\n x: 10\n y: 70\n size: 18\n color: '{{off_day_text if trash3_days == ''unknown'' or trash3_days > 1 else\n on_day_text }}'\n - type: text\n value: '{% if trash3_days | int == 999 %}{{translation_unknown}}{% elif trash3_days\n | int == 0 %}{{translation_today}}{% elif trash3_days | int == 1 %}{{translation_tonight}}{%\n else %}{{trash3_days}} {{translation_days}}{% endif %}'\n font: ppb.ttf\n x: 10\n y: 90\n size: 18\n color: '{{off_day_text if trash3_days == ''unknown'' or trash3_days > 1 else\n on_day_text }}'\n - type: rectangle\n outline: '{{off_day_background}}'\n fill: '{{off_day_background if trash4_days | int > 1 else on_day_background\n }}'\n width: 1\n x_start: 152\n y_start: 60\n x_end: 290\n y_end: 107\n - type: text\n value: '{{trash4_name}}'\n font: ppb.ttf\n x: 180\n y: 70\n size: 18\n color: '{{off_day_text if trash4_days == ''unknown'' or trash4_days > 1 else\n on_day_text }}'\n - type: text\n value: '{% if trash4_days | int == 999 %}{{translation_unknown}}{% elif trash4_days\n | int == 0 %}{{translation_today}}{% elif trash4_days | int == 1 %}{{translation_tonight}}{%\n else %}{{trash4_days}} {{translation_days}}{% endif %}'\n font: ppb.ttf\n x: 180\n y: 90\n size: 18\n color: '{{off_day_text if trash4_days == ''unknown'' or trash4_days > 1 else\n on_day_text }} '\n - type: icon\n value: circle\n x: 113\n y: 20\n size: 70\n color: '{{off_day_background}}'\n - type: icon\n value: trash-can\n x: 123\n y: 30\n size: 50\n color: '{{ ''red'' if (([trash1_days,trash2_days,trash3_days,trash4_days ])\n | min ) | int < 2 else off_day_text }}'\n - type: text\n value: '{{weekdays[now().weekday()]}} {{(now()|as_timestamp)|timestamp_custom(timeformat,\n True) }}'\n font: ppb.ttf\n x: 118\n y: 116\n size: 11\n color: '{{''white'' if dark_mode else ''black''}}'\n target:\n device_id: ba56e483633928becad9345c18321a0d\n mode: restart",
|
|
"config": [
|
|
{
|
|
"name": "waste food sensor",
|
|
"room": null,
|
|
"type": "sensor",
|
|
"id": {
|
|
"entity_id": "sensor.waste_food",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "waste plastic sensor",
|
|
"room": null,
|
|
"type": "sensor",
|
|
"id": {
|
|
"entity_id": "sensor.waste_plastic",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "waste glass metal sensor",
|
|
"room": null,
|
|
"type": "sensor",
|
|
"id": {
|
|
"entity_id": "sensor.waste_glass_metal",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "waste general sensor",
|
|
"room": null,
|
|
"type": "sensor",
|
|
"id": {
|
|
"entity_id": "sensor.waste_general",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "waste paper sensor",
|
|
"room": null,
|
|
"type": "sensor",
|
|
"id": {
|
|
"entity_id": "sensor.waste_paper",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "ePaper device",
|
|
"room": null,
|
|
"type": "device",
|
|
"id": {
|
|
"entity_id": null,
|
|
"device_id": "ba56e483633928becad9345c18321a0d"
|
|
}
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"id": "Update Bins Tag",
|
|
"automation": "- alias: Update Bins Tag\n description: ''\n trigger:\n - platform: time\n at: 02:00:00\n condition: []\n action:\n - service: script.bins_tag\n data:\n tag_mac: 0000021B4DA53B17\n trash_sensor1: sensor.black_bin_schedule\n trash1_name: Black\n trash_sensor2: sensor.blue_bin_schedule\n trash2_name: Blue\n trash_sensor3: sensor.brown_bin_schedule\n trash3_name: Brown\n trash_sensor4: sensor.green_bin_schedule\n trash4_name: Green\n dark_mode: true\n translation_today: Today\n translation_tonight: Tonight\n translation_days: days\n translation_unknown: Unknown\n mode: single",
|
|
"config": [
|
|
{
|
|
"name": "black bin schedule sensor",
|
|
"room": null,
|
|
"type": "sensor",
|
|
"id": {
|
|
"entity_id": "sensor.black_bin_schedule",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "blue bin schedule sensor",
|
|
"room": null,
|
|
"type": "sensor",
|
|
"id": {
|
|
"entity_id": "sensor.blue_bin_schedule",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "brown bin schedule sensor",
|
|
"room": null,
|
|
"type": "sensor",
|
|
"id": {
|
|
"entity_id": "sensor.brown_bin_schedule",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "green bin schedule sensor",
|
|
"room": null,
|
|
"type": "sensor",
|
|
"id": {
|
|
"entity_id": "sensor.green_bin_schedule",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "Bins Tag",
|
|
"room": null,
|
|
"type": "script",
|
|
"id": {
|
|
"entity_id": "script.bins_tag",
|
|
"device_id": null
|
|
}
|
|
}
|
|
]
|
|
}
|
|
] |