usda-hass-config/automations.yaml

1405 lines
33 KiB
YAML

- id: 4c9a1a4d2ded4dbeac71ee63ef297de2
alias: Update Height
trigger:
- platform: state
entity_id:
- input_number.jc_pecan_grade
- input_number.jc_crush_amount
action:
- data:
topic: /jc/height
payload: '{{ ((states(''input_number.jc_pecan_grade'') | int) - (states(''input_number.jc_crush_amount'')
| float)) | int }}'
action: mqtt.publish
- id: '1705938099970'
alias: Experiment Duration
description: Run the vibratory conveyor for 15 second intervals
trigger:
- platform: device
type: turned_on
device_id: bdc5f90b963bab0edf03bfeeff494858
entity_id: f2132fd3b40e6062062421b5a7923067
domain: switch
condition:
- condition: state
entity_id: switch.jc_limit_feed_duration
state: 'on'
action:
- delay:
seconds: '{{ states(''number.jc_feed_time'') | float }}'
- type: turn_off
device_id: bdc5f90b963bab0edf03bfeeff494858
entity_id: f2132fd3b40e6062062421b5a7923067
domain: switch
mode: single
- id: '1714686528002'
alias: Tag bin4b is scanned
description: ''
trigger:
- platform: tag
tag_id: 1DD6A704
condition: []
action:
- service: mqtt.publish
metadata: {}
data_template:
qos: '1'
retain: true
topic: /sheller/bin4
payload: '{{ states(''sensor.sheller_scale'') | float - 3.92 | round(2) }}'
mode: single
- id: '1714691006075'
alias: Tag bin4a is scanned
description: ''
trigger:
- platform: tag
tag_id: 1699DD04
condition: []
action:
- service: mqtt.publish
metadata: {}
data_template:
qos: '1'
retain: true
topic: /sheller/bin4
payload: '{{ states(''sensor.sheller_scale'') | float - 4.0 | round(2) }}'
mode: single
- id: '1714691234056'
alias: Tag bin3a is scanned
description: ''
trigger:
- platform: tag
tag_id: 17D18B04
condition: []
action:
- service: mqtt.publish
metadata: {}
data_template:
qos: '1'
retain: true
topic: /sheller/bin3
payload: '{{ states(''sensor.sheller_scale'') | float - 7.23 | round(2) }}'
mode: single
- id: '1714691252744'
alias: Tag bin3b is scanned
description: ''
trigger:
- platform: tag
tag_id: 1B9E6204
condition: []
action:
- service: mqtt.publish
metadata: {}
data_template:
qos: '1'
retain: true
topic: /sheller/bin3
payload: '{{ states(''sensor.sheller_scale'') | float - 7.13 | round(2) }}'
mode: single
- id: '1714691270889'
alias: Tag bin2a is scanned
description: ''
trigger:
- platform: tag
tag_id: 72F8A704
condition: []
action:
- service: mqtt.publish
metadata: {}
data_template:
qos: '1'
retain: true
topic: /sheller/bin2
payload: '{{ states(''sensor.sheller_scale'') | float - 7.02 | round(2) }}'
mode: single
- id: '1714691288523'
alias: Tag bin2b is scanned
description: ''
trigger:
- platform: tag
tag_id: 1A414204
condition: []
action:
- service: mqtt.publish
metadata: {}
data_template:
qos: '1'
retain: true
topic: /sheller/bin2
payload: '{{ states(''sensor.sheller_scale'') | float - 7.0 | round(2) }}'
mode: single
- id: '1714691306464'
alias: Tag bin1a is scanned
description: ''
trigger:
- platform: tag
tag_id: 1AECA004
condition: []
action:
- service: mqtt.publish
metadata: {}
data_template:
qos: '1'
retain: true
topic: /sheller/bin1
payload: '{{ states(''sensor.sheller_scale'') | float - 5.69 | round(2) }}'
mode: single
- id: '1714691321231'
alias: Tag bin1b is scanned
description: ''
trigger:
- platform: tag
tag_id: 1983D704
condition: []
action:
- service: mqtt.publish
metadata: {}
data_template:
qos: '1'
retain: true
topic: /sheller/bin1
payload: '{{ states(''sensor.sheller_scale'') | float - 5.52 | round(2) }}'
mode: single
- id: '1715008110813'
alias: Tag take-general-mass-sample is scanned
description: ''
trigger:
- platform: tag
tag_id: 1ADE4304
condition: []
action:
- service: input_select.select_option
target:
entity_id: input_select.mass_sample_mode
data:
option: General Yield Sample
mode: single
- id: '1715008192820'
alias: Tag take-halves-mass-sample is scanned
description: ''
trigger:
- platform: tag
tag_id: 1B983A04
condition: []
action:
- service: input_select.select_option
target:
entity_id: input_select.mass_sample_mode
data:
option: Half Yield Sample
mode: single
- id: '1716233507175'
alias: Cup 1 Scanned
description: ''
trigger:
- platform: tag
tag_id: '11275204'
condition: []
action:
- service: input_select.select_option
metadata: {}
data:
option: '1'
target:
entity_id: input_select.activecup
mode: single
- id: '1716233528548'
alias: Cup 2 Scanned
description: ''
trigger:
- platform: tag
tag_id: 123E8904
condition: []
action:
- service: input_select.select_option
metadata: {}
data:
option: '2'
target:
entity_id: input_select.activecup
mode: single
- id: '1716233545612'
alias: Cup 3 Scanned
description: ''
trigger:
- platform: tag
tag_id: 1FD4D704
condition: []
action:
- service: input_select.select_option
metadata: {}
data:
option: '3'
target:
entity_id: input_select.activecup
mode: single
- id: '1716233563052'
alias: Cup 4 Scanned
description: ''
trigger:
- platform: tag
tag_id: '12619704'
condition: []
action:
- service: input_select.select_option
metadata: {}
data:
option: '4'
target:
entity_id: input_select.activecup
mode: single
- id: '1716233589077'
alias: Cup 5 Scanned
description: ''
trigger:
- platform: tag
tag_id: 105B1904
condition: []
action:
- service: input_select.select_option
metadata: {}
data:
option: '5'
target:
entity_id: input_select.activecup
mode: single
- id: '1716233604589'
alias: Cup 6 Scanned
description: ''
trigger:
- platform: tag
tag_id: 10A49304
condition: []
action:
- service: input_select.select_option
metadata: {}
data:
option: '6'
target:
entity_id: input_select.activecup
mode: single
- id: '1716233621036'
alias: Cup 7 Scanned
description: ''
trigger:
- platform: tag
tag_id: 1145FB04
condition: []
action:
- service: input_select.select_option
metadata: {}
data:
option: '7'
target:
entity_id: input_select.activecup
mode: single
- id: '1716233634788'
alias: Cup 8 Scanned
description: ''
trigger:
- platform: tag
tag_id: '11866104'
condition: []
action:
- service: input_select.select_option
metadata: {}
data:
option: '8'
target:
entity_id: input_select.activecup
mode: single
- id: '1716233649980'
alias: Cup 9 Scanned
description: ''
trigger:
- platform: tag
tag_id: 1FBCF604
condition: []
action:
- service: input_select.select_option
metadata: {}
data:
option: '9'
target:
entity_id: input_select.activecup
mode: single
- id: '1716233677941'
alias: Cup 10 Scanned
description: ''
trigger:
- platform: tag
tag_id: 11261C04
condition: []
action:
- service: input_select.select_option
metadata: {}
data:
option: '10'
target:
entity_id: input_select.activecup
mode: single
- id: '1716233694725'
alias: Cup 11 Scanned
description: ''
trigger:
- platform: tag
tag_id: 116CE504
condition: []
action:
- service: input_select.select_option
metadata: {}
data:
option: '11'
target:
entity_id: input_select.activecup
mode: single
- id: '1716233716972'
alias: Cup 12 Scanned
description: ''
trigger:
- platform: tag
tag_id: '10192204'
condition: []
action:
- service: input_select.select_option
metadata: {}
data:
option: '12'
target:
entity_id: input_select.activecup
mode: single
- id: '1716233734357'
alias: Cup 13 Scanned
description: ''
trigger:
- platform: tag
tag_id: 1051FF04
condition: []
action:
- service: input_select.select_option
metadata: {}
data:
option: '13'
target:
entity_id: input_select.activecup
mode: single
- id: '1716233749157'
alias: Cup 14 Scanned
description: ''
trigger:
- platform: tag
tag_id: 10E1A404
condition: []
action:
- service: input_select.select_option
metadata: {}
data:
option: '14'
target:
entity_id: input_select.activecup
mode: single
- id: '1716233763405'
alias: Cup 15 Scanned
description: ''
trigger:
- platform: tag
tag_id: 1FB63C04
condition: []
action:
- service: input_select.select_option
metadata: {}
data:
option: '15'
target:
entity_id: input_select.activecup
mode: single
- id: '1716233790021'
alias: Cup 16 Scanned
description: ''
trigger:
- platform: tag
tag_id: 10F61E04
condition: []
action:
- service: input_select.select_option
metadata: {}
data:
option: '16'
target:
entity_id: input_select.activecup
mode: single
- id: '1716234851972'
alias: Virtual Scale Weigh
description: ''
triggers:
- entity_id:
- sensor.precision_scale
above: 0
trigger: numeric_state
conditions:
- condition: not
conditions:
- condition: state
entity_id: input_select.activecup
state: None
actions:
- variables:
cup_entity_prefix: sensor.cup_{{ states('input_select.activecup') }}
cup_tare_entity: '{{cup_entity_prefix + ''_tare_weight''}}'
cup_general_entity: '{{cup_entity_prefix + ''_general_sample_weight''}}'
cup_half_entity: '{{cup_entity_prefix + ''_half_sample_weight''}}'
- choose:
- conditions:
- condition: state
entity_id: input_select.mass_sample_mode
state: Tare
sequence:
- metadata: {}
data_template:
topic: /scale/cup{{ states('input_select.activecup') }}/tare
payload: '{{ states(''sensor.precision_scale'') }}'
retain: true
action: mqtt.publish
- conditions:
- condition: state
entity_id: input_select.mass_sample_mode
state: General Yield Sample
sequence:
- metadata: {}
data_template:
topic: /scale/cup{{ states('input_select.activecup') }}/general
payload: '{{ states(''sensor.precision_scale'') | float - states(cup_tare_entity)
| float if states(''sensor.precision_scale'') > states(cup_tare_entity)
else 0 }}'
retain: true
action: mqtt.publish
- metadata: {}
data_template:
topic: /scale/cup{{ states('input_select.activecup') }}/half
payload: 0
retain: true
action: mqtt.publish
- conditions:
- condition: state
entity_id: input_select.mass_sample_mode
state: Half Yield Sample
sequence:
- metadata: {}
data_template:
topic: /scale/cup{{ states('input_select.activecup') }}/half
payload: '{{ states(''sensor.precision_scale'') | float - states(cup_tare_entity)
| float if states(''sensor.precision_scale'') > states(cup_tare_entity)
else 0 }}'
retain: true
action: mqtt.publish
- delay:
hours: 0
minutes: 0
seconds: 2
milliseconds: 0
- metadata: {}
data_template:
topic: /half_yield
payload: '{{ states(cup_half_entity) | float / states(cup_general_entity)
| float * 100 }}'
retain: true
action: mqtt.publish
default: []
- target:
entity_id: input_select.activecup
data:
option: None
action: input_select.select_option
- action: media_player.play_media
target:
entity_id: media_player.pecan_station
data:
media_content_id: media-source://media_source/local/positive_beeps-85504.mp3
media_content_type: audio/mpeg
metadata:
title: positive_beeps-85504.mp3
thumbnail:
media_class: music
children_media_class:
navigateIds:
- {}
- media_content_type: app
media_content_id: media-source://media_source
mode: single
- id: '1717534824373'
alias: Drum PID
description: ''
triggers:
- trigger: time_pattern
seconds: /5
conditions:
- condition: or
conditions:
- condition: numeric_state
entity_id: sensor.drum_rpm_error
above: 0
- condition: numeric_state
entity_id: sensor.drum_rpm_error
below: -0.2
- condition: state
entity_id: switch.shellyplus1_cc7b5c0d0eb4_switch_0
state: 'on'
actions:
- variables:
error: '{{ states(''sensor.drum_rpm_error'') | float }}'
prev_error: '{{ states(''input_number.sheller_drum_prev_rpm_error'') | float
}}'
setpoint: '{{ states(''input_number.sheller_drum_rpm'') | float }}'
derivative: '{{ error - prev_error | float }}'
prev_adjustment: '{{ states(''input_number.sheller_drum_prev_adjustment'') }}'
adjustment: '{{ prev_adjustment | float + error | float }}'
- action: input_number.set_value
metadata: {}
data:
value: '{{ error }}'
target:
entity_id: input_number.sheller_drum_prev_rpm_error
- metadata: {}
data:
brightness: '{% set min_rpm = 23 %} {% set max_rpm = 37 %} {% set min_dimmer
= 40 %} {% set max_dimmer = 255 %} {{ (( setpoint + adjustment | float - min_rpm)
/ (max_rpm - min_rpm)) * (max_dimmer - min_dimmer) }}
'
target:
entity_id: light.shellyplus010v_e86beae4d350_light_0
action: light.turn_on
- action: input_number.set_value
metadata: {}
data:
value: '{{ adjustment }}'
target:
entity_id: input_number.sheller_drum_prev_adjustment
mode: single
- id: '1717535056368'
alias: Paddle PID
description: ''
trigger:
- platform: state
entity_id:
- sensor.paddle_pid
condition: []
action:
- service: light.turn_on
metadata: {}
data:
brightness: '{{ states(''sensor.paddle_pid'') | int }}'
target:
entity_id: light.shellyplus010v_e86beae4df24_light_0
mode: single
- id: '1721673617742'
alias: Turn on Lights for Motion Events
description: ''
trigger:
- platform: state
entity_id:
- switch.tp_link_power_strip_d7c1_vibratory_conveyor
to: 'on'
condition: []
action:
- service: light.turn_on
metadata: {}
data: {}
target:
entity_id: light.tp_link_power_strip_d7c1_zima_board
mode: single
- id: '1721673662507'
alias: Turn off Lights with no Motion Detection
description: ''
trigger:
- platform: state
entity_id:
- switch.tp_link_power_strip_d7c1_vibratory_conveyor
to: 'off'
condition: []
action:
- service: light.turn_off
target:
entity_id:
- light.tp_link_power_strip_d7c1_zima_board
data: {}
mode: single
- id: '1724078394290'
alias: Link Vibratory Conveyors
description: ''
trigger:
- platform: state
entity_id:
- switch.shellyplus1pm_c049ef8c7310_switch_0
from: 'off'
to: 'on'
condition: []
action:
- service: switch.turn_on
target:
entity_id:
- switch.tp_link_power_strip_d7c1_vibratory_conveyor
data: {}
mode: single
- alias: Set theme at startup
trigger:
platform: homeassistant
event: start
action:
service: frontend.set_theme
data:
name: Dawg
id: 8f5ec804474f40538ae8a5306eecfdc0
- id: '1728929017048'
alias: Tag Sample 1 is scanned
description: ''
triggers:
- trigger: tag
tag_id: 126AC504
conditions: []
actions:
- action: input_select.select_option
target:
entity_id:
- input_select.activesample
data:
option: '1'
mode: single
- id: '1728929036148'
alias: Tag Sample 2 is scanned
description: ''
triggers:
- trigger: tag
tag_id: 1FD56B04
conditions: []
actions:
- action: input_select.select_option
metadata: {}
data:
option: '2'
target:
entity_id: input_select.activesample
mode: single
- id: '1728929057048'
alias: Tag Sample 3 is scanned
description: ''
triggers:
- trigger: tag
tag_id: 128DD104
conditions: []
actions:
- action: input_select.select_option
metadata: {}
data:
option: '3'
target:
entity_id: input_select.activesample
mode: single
- id: '1728929082331'
alias: Tag Sample 4 is scanned
description: ''
triggers:
- trigger: tag
tag_id: 12A61104
conditions: []
actions:
- action: input_select.select_option
metadata: {}
data:
option: '4'
target:
entity_id: input_select.activesample
mode: single
- id: '1728929105354'
alias: Tag Sample 5 is scanned
description: ''
triggers:
- trigger: tag
tag_id: 12123E04
conditions: []
actions:
- action: input_select.select_option
metadata: {}
data:
option: '5'
target:
entity_id: input_select.activesample
mode: single
- id: '1728929118007'
alias: Tag Sample 6 is scanned
description: ''
triggers:
- trigger: tag
tag_id: 1174DD04
conditions: []
actions:
- action: input_select.select_option
metadata: {}
data:
option: '6'
target:
entity_id: input_select.activesample
mode: single
- id: '1728929133990'
alias: Tag Sample 7 is scanned
description: ''
triggers:
- trigger: tag
tag_id: 11A35B04
conditions: []
actions:
- action: input_select.select_option
metadata: {}
data:
option: '7'
target:
entity_id: input_select.activesample
mode: single
- id: '1728929160789'
alias: Tag Sample 8 is scanned
description: ''
triggers:
- trigger: tag
tag_id: '10113604'
conditions: []
actions:
- action: input_select.select_option
metadata: {}
data:
option: '8'
target:
entity_id: input_select.activesample
mode: single
- id: '1728929174388'
alias: Tag Sample 9 is scanned
description: ''
triggers:
- trigger: tag
tag_id: 11397F04
conditions: []
actions:
- action: input_select.select_option
metadata: {}
data:
option: '9'
target:
entity_id: input_select.activesample
mode: single
- id: '1728929188975'
alias: Tag Sample 10 is scanned
description: ''
triggers:
- trigger: tag
tag_id: 124B4E04
conditions: []
actions:
- action: input_select.select_option
metadata: {}
data:
option: '10'
target:
entity_id: input_select.activesample
mode: single
- id: '1728929202238'
alias: Tag Sample 11 is scanned
description: ''
triggers:
- trigger: tag
tag_id: 11D64604
conditions: []
actions:
- action: input_select.select_option
metadata: {}
data:
option: '11'
target:
entity_id: input_select.activesample
mode: single
- id: '1728929213847'
alias: Tag Sample 12 is scanned
description: ''
triggers:
- trigger: tag
tag_id: 10CC6C04
conditions: []
actions:
- action: input_select.select_option
metadata: {}
data:
option: '12'
target:
entity_id: input_select.activesample
mode: single
- id: '1728929227899'
alias: Tag Sample 13 is scanned
description: ''
triggers:
- trigger: tag
tag_id: 112BB904
conditions: []
actions:
- action: input_select.select_option
metadata: {}
data:
option: '13'
target:
entity_id: input_select.activesample
mode: single
- id: '1728929238344'
alias: Tag Sample 14 is scanned
description: ''
triggers:
- trigger: tag
tag_id: 1C997304
conditions: []
actions:
- action: input_select.select_option
metadata: {}
data:
option: '14'
target:
entity_id: input_select.activesample
mode: single
- id: '1728929253313'
alias: Tag Sample 15 is scanned
description: ''
triggers:
- trigger: tag
tag_id: 101BF204
conditions: []
actions:
- action: input_select.select_option
metadata: {}
data:
option: '15'
target:
entity_id: input_select.activesample
mode: single
- id: '1728929267064'
alias: Tag Sample 16 is scanned
description: ''
triggers:
- trigger: tag
tag_id: 10C8FE04
conditions: []
actions:
- action: input_select.select_option
metadata: {}
data:
option: '16'
target:
entity_id: input_select.activesample
mode: single
- id: '1728929278862'
alias: Tag Sample 17 is scanned
description: ''
triggers:
- trigger: tag
tag_id: 11AADF04
conditions: []
actions:
- action: input_select.select_option
metadata: {}
data:
option: '17'
target:
entity_id: input_select.activesample
mode: single
- id: '1728929289534'
alias: Tag Sample 18 is scanned
description: ''
triggers:
- trigger: tag
tag_id: '12359604'
conditions: []
actions:
- action: input_select.select_option
metadata: {}
data:
option: '18'
target:
entity_id: input_select.activesample
mode: single
- id: '1728929301457'
alias: Tag Sample 19 is scanned
description: ''
triggers:
- trigger: tag
tag_id: 1CF2EB04
conditions: []
actions:
- action: input_select.select_option
metadata: {}
data:
option: '19'
target:
entity_id: input_select.activesample
mode: single
- id: '1728929312681'
alias: Tag Sample 20 is scanned
description: ''
triggers:
- trigger: tag
tag_id: 1252B404
conditions: []
actions:
- action: input_select.select_option
metadata: {}
data:
option: '20'
target:
entity_id: input_select.activesample
mode: single
- id: '1728929325332'
alias: Tag Sample 21 is scanned
description: ''
triggers:
- trigger: tag
tag_id: 128BC104
conditions: []
actions:
- action: input_select.select_option
metadata: {}
data:
option: '21'
target:
entity_id: input_select.activesample
mode: single
- id: '1728929338982'
alias: Tag Sample 22 is scanned
description: ''
triggers:
- trigger: tag
tag_id: 12923C04
conditions: []
actions:
- action: input_select.select_option
metadata: {}
data:
option: '22'
target:
entity_id: input_select.activesample
mode: single
- id: '1728929350023'
alias: Tag Sample 23 is scanned
description: ''
triggers:
- trigger: tag
tag_id: 111E5704
conditions: []
actions:
- action: input_select.select_option
metadata: {}
data:
option: '23'
target:
entity_id: input_select.activesample
mode: single
- id: '1728929364629'
alias: Tag Sample 24 is scanned
description: ''
triggers:
- trigger: tag
tag_id: 107D4B04
conditions: []
actions:
- action: input_select.select_option
metadata: {}
data:
option: '24'
target:
entity_id: input_select.activesample
mode: single
- id: '1728930660121'
alias: Virtual Scale Moisture
description: ''
triggers:
- entity_id:
- sensor.precision_scale
above: 0
trigger: numeric_state
conditions:
- condition: not
conditions:
- condition: state
entity_id: input_select.activesample
state: None
actions:
- variables:
cup_entity_prefix: sensor.sample_{{ states('input_select.activesample') }}
cup_tare_entity: '{{cup_entity_prefix + ''_tare_weight''}}'
cup_wet_entity: '{{cup_entity_prefix + ''_wet_weight''}}'
cup_dry_entity: '{{cup_entity_prefix + ''_dry_weight''}}'
- choose:
- conditions:
- condition: state
entity_id: input_select.mass_sample_mode
state: Tare
sequence:
- metadata: {}
data_template:
topic: /scale/sample{{ states('input_select.activesample') }}/tare
payload: '{{ states(''sensor.precision_scale'') }}'
retain: true
action: mqtt.publish
- conditions:
- condition: state
entity_id: input_select.mass_sample_mode
state: Wet Mass Sample
sequence:
- metadata: {}
data_template:
topic: /scale/sample{{ states('input_select.activesample') }}/wet
payload: '{{ states(''sensor.precision_scale'') | float - states(cup_tare_entity)
| float if states(''sensor.precision_scale'') > states(cup_tare_entity)
else 0 }}'
retain: true
action: mqtt.publish
- metadata: {}
data_template:
topic: /scale/sample{{ states('input_select.activesample') }}/dry
payload: 0
retain: true
action: mqtt.publish
- conditions:
- condition: state
entity_id: input_select.mass_sample_mode
state: Dry Mass Sample
sequence:
- metadata: {}
data_template:
topic: /scale/sample{{ states('input_select.activesample') }}/dry
payload: '{{ states(''sensor.precision_scale'') | float - states(cup_tare_entity)
| float if states(''sensor.precision_scale'') > states(cup_tare_entity)
else 0 }}'
retain: true
action: mqtt.publish
- delay:
hours: 0
minutes: 0
seconds: 2
milliseconds: 0
- metadata: {}
data_template:
topic: /moisture_sample
payload: "{{ ( ( states(cup_wet_entity) | float - states(cup_dry_entity)
| float ) / ( states(cup_wet_entity) | float ) )\n * 100 }}"
retain: true
action: mqtt.publish
default: []
- data:
option: None
action: input_select.select_option
target:
entity_id: input_select.activesample
mode: single
- id: '1729607423592'
alias: Ding on Scan
description: ''
triggers:
- trigger: state
entity_id:
- input_select.activecup
- trigger: state
entity_id:
- input_select.activesample
- trigger: state
entity_id:
- input_select.mass_sample_mode
conditions: []
actions:
- action: media_player.play_media
target:
entity_id: media_player.pecan_station
data:
media_content_id: media-source://media_source/local/positive_beeps-85504.mp3
media_content_type: audio/mpeg
metadata:
title: positive_beeps-85504.mp3
thumbnail:
media_class: music
children_media_class:
navigateIds:
- {}
- media_content_type: app
media_content_id: media-source://media_source
mode: single
- id: '1731439152625'
alias: Meyer Motor Speed
description: ''
triggers:
- trigger: state
entity_id:
- input_number.meyer_motor_speed
to:
conditions: []
actions:
- variables:
setpoint: '{{ (trigger.to_state.state | int - 30) | float / 30 * 5000 }}
'
- action: modbus.write_register
metadata: {}
data:
hub: Meyer VFD
slave: 1
address: 2002
value: '{{ setpoint }}'
mode: single
- id: '1731519710475'
alias: JC Freq
description: ''
triggers:
- trigger: state
entity_id:
- input_number.jc_plate_frequency
to:
conditions: []
actions:
- variables:
setpoint: '{{ (trigger.to_state.state | int ) | float / 30 * 4096 | int }}
'
- action: modbus.write_register
metadata: {}
data:
hub: JC VFD
slave: 1
address: 683
value: '{{ setpoint }}'
mode: single
- id: '1732547615605'
alias: Meyer Position Setpoint
description: ''
triggers:
- trigger: state
entity_id:
- input_number.meyer_screw_displacement
conditions: []
actions:
- action: script.mqtt_pos
metadata: {}
data:
pos: '{{ ( states(''input_number.meyer_screw_displacement'') | float * 10 )
| int }}'
mode: single
- id: '1732564689642'
alias: Paddle PID
description: ''
triggers:
- trigger: time_pattern
seconds: /5
conditions:
- condition: or
conditions:
- condition: numeric_state
entity_id: sensor.paddle_rpm_error
above: 4.9
- condition: numeric_state
entity_id: sensor.paddle_rpm_error
below: -5
- condition: state
entity_id: switch.shellyplus1_cc7b5c0d316c_switch_0
state: 'on'
actions:
- variables:
error: '{{ states(''sensor.paddle_rpm_error'') | float }}'
prev_error: '{{ states(''input_number.sheller_paddle_prev_rpm_error'') | float
}}'
setpoint: '{{ states(''input_number.sheller_paddle_rpm'') | float }}'
derivative: '{{ error - prev_error | float }}'
prev_adjustment: '{{ states(''input_number.sheller_paddle_prev_adjustment'')
}}'
adjustment: '{{ prev_adjustment | float + error / 2 | float }}'
- action: input_number.set_value
metadata: {}
data:
value: '{{ error }}'
target:
entity_id: input_number.sheller_paddle_prev_rpm_error
- metadata: {}
data:
brightness: '{% set min_rpm = 250 %} {% set max_rpm = 900 %} {% set min_dimmer
= 1 %} {% set max_dimmer = 255 %} {{ (( setpoint + adjustment | float - min_rpm)
/ (max_rpm - min_rpm)) * (max_dimmer - min_dimmer) }}
'
target:
entity_id: light.shellyplus010v_e86beae4df24_light_0
action: light.turn_on
- action: input_number.set_value
metadata: {}
data:
value: '{{ adjustment }}'
target:
entity_id: input_number.sheller_paddle_prev_adjustment
mode: single
- id: '1734115928951'
alias: Set JC Feed Rate
description: ''
triggers:
- trigger: state
entity_id:
- sensor.jc_pi_controller_output
- trigger: state
entity_id:
- sensor.jc_throughput_count
conditions: []
actions:
- action: light.turn_on
target:
entity_id: light.shellyplus010v_e86beae47374_light_0
data:
brightness: '{{ ((states(''input_number.jc_feeder_frequency'') | float - 30)
/ 60) * 255 }}'
mode: single
- id: '1740078087509'
alias: JC Turn On Feed
description: ''
triggers:
- trigger: state
entity_id:
- switch.shellyplus1pm_c049ef8c7310_switch_0
to: 'on'
conditions: []
actions:
- action: mqtt.publish
metadata: {}
data:
evaluate_payload: true
qos: 0
retain: false
topic: /jc/feedrate/
payload: '{{ states(''number.jc_feedrate_setpoint'') }}'
mode: single
- id: '1740078120525'
alias: JC Turn Off Feed
description: ''
triggers:
- trigger: state
entity_id:
- switch.shellyplus1pm_c049ef8c7310_switch_0
to: 'off'
- trigger: time_pattern
seconds: /5
conditions:
- condition: state
entity_id: switch.shellyplus1pm_c049ef8c7310_switch_0
state: 'off'
actions:
- action: mqtt.publish
metadata: {}
data:
qos: 0
retain: false
topic: /jc/feedrate/
payload: '0'
mode: single
- id: '1740082446497'
alias: JC Pecan Count Update
description: ''
triggers:
- trigger: numeric_state
entity_id:
- sensor.jc_throughput_count
above: 0
conditions:
- condition: state
entity_id: switch.shellyplus1pm_c049ef8c7310_switch_0
state: 'on'
actions:
- action: light.turn_on
metadata: {}
data:
brightness_pct: '{{ ((states(''sensor.jc_pi_controller_output'') | float - 30
) / 60 ) * 100 }}
'
target:
entity_id: light.shellyplus010v_e86beae47374_light_0
mode: single
- id: '1740082605296'
alias: JC Pecan Count Reset
description: ''
triggers:
- trigger: state
entity_id:
- switch.shellyplus1pm_c049ef8c7310_switch_0
to: 'off'
conditions: []
actions:
- action: input_number.set_value
metadata: {}
data:
value: 0
target:
entity_id: input_number.jc_rolling_pecan_sum
mode: single
- id: '1740084721805'
alias: JC Pecan Rate PI Controller
description: ''
triggers:
- trigger: time_pattern
seconds: /5
conditions:
- condition: or
conditions:
- condition: numeric_state
entity_id: sensor.jc_pecan_rate_error
above: 0.5
- condition: numeric_state
entity_id: sensor.jc_pecan_rate_error
below: -0.5
- condition: state
entity_id: switch.shellyplus1pm_c049ef8c7310_switch_0
state: 'on'
actions:
- variables:
error: '{{ states(''sensor.jc_pecan_rate_error'') | float }}'
prev_error: '{{ states(''input_number.jc_rate_prev_error'') | float }}'
setpoint: '{{ states(''number.jc_feedrate_setpoint'') | float }}'
derivative: '{{ error - prev_error | float }}'
prev_adjustment: '{{ states(''input_number.jc_rate_prev_adjustment'') }}'
adjustment: '{{ prev_adjustment | float + error | float }}'
- action: input_number.set_value
metadata: {}
data:
value: '{{ error }}'
target:
entity_id: input_number.jc_rate_prev_error
- metadata: {}
data:
brightness: '{% set min_rate = 12 %} {% set max_rate = 38 %} {% set min_dimmer
= 0 %} {% set max_dimmer = 255 %} {{ (( setpoint + adjustment | float - min_rpm)
/ (max_rate - min_rate)) * (max_dimmer - min_dimmer) }}
'
target:
entity_id: light.shellyplus010v_e86beae47374_light_0
action: light.turn_on
- action: input_number.set_value
metadata: {}
data:
value: '{{ adjustment }}'
target:
entity_id: input_number.sheller_drum_prev_adjustment
mode: single
- id: '1741462567167'
alias: Update Meyer Screw Slider
description: ''
triggers:
- trigger: state
entity_id:
- sensor.meyer_position_raw
conditions: []
actions:
- action: input_number.set_value
metadata: {}
data_template:
value: '{{ states(''sensor.meyer_position_raw'') }}
'
target:
entity_id: input_number.meyer_screw_displacement
mode: single