pjarbit

Template Sensors

Oct 25th, 2024 (edited)
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 18.53 KB | None | 0 0
  1. - sensor:
  2. - name: "All Conditions Met"
  3. state: >
  4. {% set conditions = [
  5. states('lock.pja1_lock') == 'locked',
  6. states('binary_sensor.pja1_tire_warning') == 'off',
  7. states('binary_sensor.pja1_low_wash_water_warning') == 'off',
  8. states('binary_sensor.pja1_low_brake_fluid_warning') == 'off',
  9. states('sensor.pja1_sunroof_status') == '0',
  10. states('sensor.pja1_front_left_window') == '2',
  11. states('sensor.pja1_front_right_window') == '2',
  12. states('sensor.pja1_rear_left_window') == '2',
  13. states('sensor.pja1_rear_right_window') == '2',
  14. states('binary_sensor.pja1_front_left_door_open') == 'off',
  15. states('binary_sensor.pja1_front_right_door_open') == 'off',
  16. states('binary_sensor.pja1_rear_left_door_open') == 'off',
  17. states('binary_sensor.pja1_rear_right_door_open') == 'off',
  18. states('binary_sensor.pja1_decklid_open') == 'off',
  19. states('binary_sensor.pja1_hood_open') == 'off',
  20. states('binary_sensor.pja1_preclimate_status') == "off",
  21.  
  22. (states('lock.fpa1_lock') == 'locked' or states('device_tracker.fpa1_device_tracker') == 'home'),
  23. states('binary_sensor.fpa1_tire_warning') == 'off',
  24. states('binary_sensor.fpa1_low_wash_water_warning') == 'off',
  25. states('binary_sensor.fpa1_low_brake_fluid_warning') == 'off',
  26. states('binary_sensor.fpa1_low_coolant_fluid_warning') == 'off',
  27. states('sensor.fpa1_sunroof_status') == '0',
  28. states('sensor.fpa1_front_left_window') == '2',
  29. states('sensor.fpa1_front_right_window') == '2',
  30. states('sensor.fpa1_rear_left_window') == '2',
  31. states('sensor.fpa1_rear_right_window') == '2',
  32. states('binary_sensor.fpa1_front_right_door_open') == 'off',
  33. states('binary_sensor.fpa1_rear_left_door_open') == 'off',
  34. states('binary_sensor.fpa1_rear_right_door_open') == 'off',
  35. states('binary_sensor.fpa1_decklid_open') == 'off',
  36. states('binary_sensor.fpa1_hood_open') == 'off',
  37.  
  38. states('binary_sensor.kitchen_door_wall_sensor_2') == 'off',
  39. states('binary_sensor.generac_1057423_is_connected') == 'on',
  40. states('binary_sensor.garage_fridge_2') == 'off',
  41. states('cover.smart_garage_door_23100870148e1e9dd4521_garage_1') == 'closed',
  42. states('cover.smart_garage_door_231008778410148e1e9dd4521_garage_2') == 'closed'
  43. ] %}
  44.  
  45. {{ conditions | reject('equalto', false) | list | count == 0 }}
  46.  
  47. - name: "Unmet Conditions List"
  48. state: >
  49. {% set unmet_conditions = [] %}
  50.  
  51. {% if states('lock.pja1_lock') != 'locked' %}
  52. {% set unmet_conditions = unmet_conditions + ['PJA1 Lock'] %}
  53. {% endif %}
  54. {% if states('binary_sensor.pja1_tire_warning') != 'off' %}
  55. {% set unmet_conditions = unmet_conditions + ['PJA1 Tire Warning'] %}
  56. {% endif %}
  57. {% if states('binary_sensor.pja1_low_wash_water_warning') != 'off' %}
  58. {% set unmet_conditions = unmet_conditions + ['PJA1 Low Wash Water Warning'] %}
  59. {% endif %}
  60. {% if states('binary_sensor.pja1_low_brake_fluid_warning') != 'off' %}
  61. {% set unmet_conditions = unmet_conditions + ['PJA1 Low Brake Fluid Warning'] %}
  62. {% endif %}
  63. {% if states('sensor.pja1_sunroof_status') != '0' %}
  64. {% set unmet_conditions = unmet_conditions + ['PJA1 Sunroof Status'] %}
  65. {% endif %}
  66. {% if states('sensor.pja1_front_left_window') != '2' %}
  67. {% set unmet_conditions = unmet_conditions + ['PJA1 Front Left Window'] %}
  68. {% endif %}
  69. {% if states('sensor.pja1_front_right_window') != '2' %}
  70. {% set unmet_conditions = unmet_conditions + ['PJA1 Front Right Window'] %}
  71. {% endif %}
  72. {% if states('sensor.pja1_rear_left_window') != '2' %}
  73. {% set unmet_conditions = unmet_conditions + ['PJA1 Rear Left Window'] %}
  74. {% endif %}
  75. {% if states('sensor.pja1_rear_right_window') != '2' %}
  76. {% set unmet_conditions = unmet_conditions + ['PJA1 Rear Right Window'] %}
  77. {% endif %}
  78. {% if states('binary_sensor.pja1_front_left_door_open') != 'off' %}
  79. {% set unmet_conditions = unmet_conditions + ['PJA1 Front Left Door'] %}
  80. {% endif %}
  81. {% if states('binary_sensor.pja1_front_right_door_open') != 'off' %}
  82. {% set unmet_conditions = unmet_conditions + ['PJA1 Front Right Door'] %}
  83. {% endif %}
  84. {% if states('binary_sensor.pja1_rear_left_door_open') != 'off' %}
  85. {% set unmet_conditions = unmet_conditions + ['PJA1 Rear Left Door'] %}
  86. {% endif %}
  87. {% if states('binary_sensor.pja1_rear_right_door_open') != 'off' %}
  88. {% set unmet_conditions = unmet_conditions + ['PJA1 Rear Right Door'] %}
  89. {% endif %}
  90. {% if states('binary_sensor.pja1_decklid_open') != 'off' %}
  91. {% set unmet_conditions = unmet_conditions + ['PJA1 Trunk Open'] %}
  92. {% endif %}
  93. {% if states('binary_sensor.pja1_engine_hood_open') != 'off' %}
  94. {% set unmet_conditions = unmet_conditions + ['PJA1 Hood'] %}
  95. {% endif %}
  96.  
  97. {% if states('lock.fpa1_lock') != 'locked' and states('device_tracker.fpa1_device_tracker') != 'home' %}
  98. {% set unmet_conditions = unmet_conditions + ['FPA1 Lock'] %}
  99. {% endif %}
  100. {% if states('binary_sensor.fpa1_tire_warning') != 'off' %}
  101. {% set unmet_conditions = unmet_conditions + ['FPA1 Tire Warning'] %}
  102. {% endif %}
  103. {% if states('binary_sensor.fpa1_low_wash_water_warning') != 'off' %}
  104. {% set unmet_conditions = unmet_conditions + ['FPA1 Low Wash Water Warning'] %}
  105. {% endif %}
  106. {% if states('binary_sensor.fpa1_low_brake_fluid_warning') != 'off' %}
  107. {% set unmet_conditions = unmet_conditions + ['FPA1 Low Brake Fluid Warning'] %}
  108. {% endif %}
  109. {% if states('binary_sensor.fpa1_low_coolant_level_warning').strip() != 'off' %}
  110. {% set unmet_car_conditions = unmet_car_conditions + ['FPA1 Low Coolant Fluid Warning'] %}
  111. {% endif %}
  112. {% if states('sensor.fpa1_sunroof_status') != '0' %}
  113. {% set unmet_conditions = unmet_conditions + ['FPA1 Sunroof Status'] %}
  114. {% endif %}
  115. {% if states('sensor.fpa1_front_left_window') != '2' %}
  116. {% set unmet_conditions = unmet_conditions + ['FPA1 Front Left Window'] %}
  117. {% endif %}
  118. {% if states('sensor.fpa1_front_right_window') != '2' %}
  119. {% set unmet_conditions = unmet_conditions + ['FPA1 Front Right Window'] %}
  120. {% endif %}
  121. {% if states('sensor.fpa1_rear_left_window') != '2' %}
  122. {% set unmet_conditions = unmet_conditions + ['FPA1 Rear Left Window'] %}
  123. {% endif %}
  124. {% if states('sensor.fpa1_rear_right_window') != '2' %}
  125. {% set unmet_conditions = unmet_conditions + ['FPA1 Rear Right Window'] %}
  126. {% endif %}
  127. {% if states('binary_sensor.fpa1_front_left_door_open') != 'off' %}
  128. {% set unmet_conditions = unmet_conditions + ['FPA1 Front Left Door'] %}
  129. {% endif %}
  130. {% if states('binary_sensor.fpa1_front_right_door_open') != 'off' %}
  131. {% set unmet_conditions = unmet_conditions + ['FPA1 Front Right Door'] %}
  132. {% endif %}
  133. {% if states('binary_sensor.fpa1_rear_left_door_open') != 'off' %}
  134. {% set unmet_conditions = unmet_conditions + ['FPA1 Rear Left Door'] %}
  135. {% endif %}
  136. {% if states('binary_sensor.fpa1_rear_right_door_open') != 'off' %}
  137. {% set unmet_conditions = unmet_conditions + ['FPA1 Rear Right Door'] %}
  138. {% endif %}
  139. {% if states('binary_sensor.fpa1_decklid_open') != 'off' %}
  140. {% set unmet_conditions = unmet_conditions + ['FPA1 Trunk Open'] %}
  141. {% endif %}
  142. {% if states('binary_sensor.fpa1_engine_hood_open') != 'off' %}
  143. {% set unmet_conditions = unmet_conditions + ['FPA1 Hood'] %}
  144. {% endif %}
  145. {% if states('cover.smart_garage_door_23100877841e9dd4521_garage_1').strip() != 'closed' %}
  146. {% set unmet_conditions = unmet_conditions + ['Full Garage Open'] %}
  147. {% endif %}
  148. {% if states('cover.smart_garage_door_23100877841e9dd4521_garage_2').strip() != 'closed' %}
  149. {% set unmet_conditions = unmet_conditions + ['Half Garage Open'] %}
  150. {% endif %}
  151. {% if states('binary_sensor.kitchen_door_wall_sensor_2') != 'off' %}
  152. {% set unmet_conditions = unmet_conditions + ['Kitchen Doorwall Unlocked'] %}
  153. {% endif %}
  154. {% if states('binary_sensor.garage_fridge_2') != 'off' %}
  155. {% set unmet_conditions = unmet_conditions + ['Garage Fridge Open'] %}
  156. {% endif %}
  157. {% if states('binary_sensor.generac_1057423_is_connected') != 'on' %}
  158. {% set unmet_conditions = unmet_conditions + ['Generac Not Connected'] %}
  159. {% endif %}
  160. {% if states('binary_sensor.pja1_preclimate_status') != 'off' %}
  161. {% set unmet_conditions = unmet_conditions + ['EQE Preclimate Status Active'] %}
  162. {% endif %}
  163.  
  164. {{ unmet_conditions | join(', ') }}
  165.  
  166. - name: "Unmet Car Conditions"
  167. state: >
  168. {% set unmet_car_conditions = [] %}
  169.  
  170. {% if states('lock.pja1_lock') != 'locked' %}
  171. {% set unmet_car_conditions = unmet_car_conditions + ['PJA1 Lock'] %}
  172. {% endif %}
  173. {% if states('binary_sensor.pja1_tire_warning') != 'off' %}
  174. {% set unmet_car_conditions = unmet_car_conditions + ['PJA1 Tire Warning'] %}
  175. {% endif %}
  176. {% if states('binary_sensor.pja1_low_wash_water_warning') != 'off' %}
  177. {% set unmet_car_conditions = unmet_car_conditions + ['PJA1 Low Wash Water Warning'] %}
  178. {% endif %}
  179. {% if states('binary_sensor.pja1_low_brake_fluid_warning') != 'off' %}
  180. {% set unmet_car_conditions = unmet_car_conditions + ['PJA1 Low Brake Fluid Warning'] %}
  181. {% endif %}
  182. {% if states('sensor.pja1_sunroof_status') != '0' %}
  183. {% set unmet_car_conditions = unmet_car_conditions + ['PJA1 Sunroof Status'] %}
  184. {% endif %}
  185. {% if states('sensor.pja1_front_left_window') != '2' %}
  186. {% set unmet_car_conditions = unmet_car_conditions + ['PJA1 Front Left Window'] %}
  187. {% endif %}
  188. {% if states('sensor.pja1_front_right_window') != '2' %}
  189. {% set unmet_car_conditions = unmet_car_conditions + ['PJA1 Front Right Window'] %}
  190. {% endif %}
  191. {% if states('sensor.pja1_rear_left_window') != '2' %}
  192. {% set unmet_car_conditions = unmet_car_conditions + ['PJA1 Rear Left Window'] %}
  193. {% endif %}
  194. {% if states('sensor.pja1_rear_right_window') != '2' %}
  195. {% set unmet_car_conditions = unmet_car_conditions + ['PJA1 Rear Right Window'] %}
  196. {% endif %}
  197. {% if states('binary_sensor.pja1_front_left_door_open') != 'off' %}
  198. {% set unmet_car_conditions = unmet_car_conditions + ['PJA1 Front Left Door'] %}
  199. {% endif %}
  200. {% if states('binary_sensor.pja1_front_right_door_open') != 'off' %}
  201. {% set unmet_car_conditions = unmet_car_conditions + ['PJA1 Front Right Door'] %}
  202. {% endif %}
  203. {% if states('binary_sensor.pja1_rear_left_door_open') != 'off' %}
  204. {% set unmet_car_conditions = unmet_car_conditions + ['PJA1 Rear Left Door'] %}
  205. {% endif %}
  206. {% if states('binary_sensor.pja1_rear_right_door_open') != 'off' %}
  207. {% set unmet_car_conditions = unmet_car_conditions + ['PJA1 Rear Right Door'] %}
  208. {% endif %}
  209. {% if states('binary_sensor.pja1_decklid_open') != 'off' %}
  210. {% set unmet_car_conditions = unmet_car_conditions + ['PJA1 Decklid'] %}
  211. {% endif %}
  212. {% if states('binary_sensor.pja1_engine_hood_open') != 'off' %}
  213. {% set unmet_car_conditions = unmet_car_conditions + ['PJA1 Hood'] %}
  214. {% endif %}
  215.  
  216. {% if states('lock.fpa1_lock') != 'locked' and states('device_tracker.fpa1_device_tracker') != 'home' %}
  217. {% set unmet_car_conditions = unmet_car_conditions + ['FPA1 Lock'] %}
  218. {% endif %}
  219. {% if states('binary_sensor.fpa1_tire_warning') != 'off' %}
  220. {% set unmet_car_conditions = unmet_car_conditions + ['FPA1 Tire Warning'] %}
  221. {% endif %}
  222. {% if states('binary_sensor.fpa1_low_wash_water_warning') != 'off' %}
  223. {% set unmet_car_conditions = unmet_car_conditions + ['FPA1 Low Wash Water Warning'] %}
  224. {% endif %}
  225. {% if states('binary_sensor.fpa1_low_brake_fluid_warning') != 'off' %}
  226. {% set unmet_car_conditions = unmet_car_conditions + ['FPA1 Low Brake Fluid Warning'] %}
  227. {% endif %}
  228. {% if states('binary_sensor.fpa1_low_coolant_level_warning').strip() != 'off' %}
  229. {% set unmet_car_conditions = unmet_car_conditions + ['FPA1 Low Coolant Fluid Warning'] %}
  230. {% endif %}
  231. {% if states('sensor.fpa1_sunroof_status') != '0' %}
  232. {% set unmet_car_conditions = unmet_car_conditions + ['FPA1 Sunroof Status'] %}
  233. {% endif %}
  234. {% if states('sensor.fpa1_front_left_window') != '2' %}
  235. {% set unmet_car_conditions = unmet_car_conditions + ['FPA1 Front Left Window'] %}
  236. {% endif %}
  237. {% if states('sensor.fpa1_front_right_window') != '2' %}
  238. {% set unmet_car_conditions = unmet_car_conditions + ['FPA1 Front Right Window'] %}
  239. {% endif %}
  240. {% if states('sensor.fpa1_rear_left_window') != '2' %}
  241. {% set unmet_car_conditions = unmet_car_conditions + ['FPA1 Rear Left Window'] %}
  242. {% endif %}
  243. {% if states('sensor.fpa1_rear_right_window') != '2' %}
  244. {% set unmet_car_conditions = unmet_car_conditions + ['FPA1 Rear Right Window'] %}
  245. {% endif %}
  246. {% if states('binary_sensor.fpa1_front_left_door_open') != 'off' %}
  247. {% set unmet_car_conditions = unmet_car_conditions + ['FPA1 Front Left Door'] %}
  248. {% endif %}
  249. {% if states('binary_sensor.fpa1_front_right_door_open') != 'off' %}
  250. {% set unmet_car_conditions = unmet_car_conditions + ['FPA1 Front Right Door'] %}
  251. {% endif %}
  252. {% if states('binary_sensor.fpa1_rear_left_door_open') != 'off' %}
  253. {% set unmet_car_conditions = unmet_car_conditions + ['FPA1 Rear Left Door'] %}
  254. {% endif %}
  255. {% if states('binary_sensor.fpa1_rear_right_door_open') != 'off' %}
  256. {% set unmet_car_conditions = unmet_car_conditions + ['FPA1 Rear Right Door'] %}
  257. {% endif %}
  258. {% if states('binary_sensor.fpa1_decklid_open') != 'off' %}
  259. {% set unmet_car_conditions = unmet_car_conditions + ['FPA1 Decklid'] %}
  260. {% endif %}
  261. {% if states('binary_sensor.fpa1_engine_hood_open') != 'off' %}
  262. {% set unmet_car_conditions = unmet_car_conditions + ['FPA1 Hood'] %}
  263. {% endif %}
  264. {% if states('binary_sensor.pja1_preclimate_status') != 'off' %}
  265. {% set unmet_car_conditions = unmet_car_conditions + ['EQE Preclimate Status Active'] %}
  266. {% endif %}
  267.  
  268. {{ unmet_car_conditions | join(', ') }}
  269.  
  270. - name: "PJA1 Front Left Window"
  271. state: "{{ state_attr('binary_sensor.pja1_windows_closed', 'windowstatusfrontleft') }}"
  272. device_class: enum
  273.  
  274. - name: "PJA1 Front Right Window"
  275. state: "{{ state_attr('binary_sensor.pja1_windows_closed', 'windowstatusfrontright') }}"
  276. device_class: enum
  277.  
  278. - name: "PJA1 Rear Left Window"
  279. state: "{{ state_attr('binary_sensor.pja1_windows_closed', 'windowstatusrearleft') }}"
  280. device_class: enum
  281.  
  282. - name: "PJA1 Rear Right Window"
  283. state: "{{ state_attr('binary_sensor.pja1_windows_closed', 'windowstatusrearright') }}"
  284. device_class: enum
  285.  
  286. - name: "FPA1 Front Left Window"
  287. state: "{{ state_attr('binary_sensor.fpa1_windows_closed', 'windowstatusfrontleft') }}"
  288. device_class: enum
  289.  
  290. - name: "FPA1 Front Right Window"
  291. state: "{{ state_attr('binary_sensor.fpa1_windows_closed', 'windowstatusfrontright') }}"
  292. device_class: enum
  293.  
  294. - name: "FPA1 Rear Left Window"
  295. state: "{{ state_attr('binary_sensor.fpa1_windows_closed', 'windowstatusrearleft') }}"
  296. device_class: enum
  297.  
  298. - name: "FPA1 Rear Right Window"
  299. state: "{{ state_attr('binary_sensor.fpa1_windows_closed', 'windowstatusrearright') }}"
  300. device_class: enum
  301.  
  302. - name: "PJA1 Charging Power Valid"
  303. state: >
  304. {% set charging_power = states('sensor.pja1_charging_power').strip() | float(default=0) %}
  305. {% if charging_power > 1 %}
  306. charging
  307. {% else %}
  308. idle
  309. {% endif %}
  310.  
  311. - name: "Fireplace Status"
  312. state: >
  313. {% if is_state('light.family_room_fireplace', 'on') %}
  314. on
  315. {% else %}
  316. off
  317. {% endif %}
  318.  
  319. - binary_sensor:
  320. - name: "PJA1 Front Left Door Open"
  321. state: "{{ state_attr('sensor.pja1_lock', 'doorstatusfrontleft') }}"
  322. device_class: door
  323. - name: "PJA1 Front Right Door Open"
  324. state: "{{ state_attr('sensor.pja1_lock', 'doorstatusfrontright') }}"
  325. device_class: door
  326. - name: "PJA1 Rear Left Door Open"
  327. state: "{{ state_attr('sensor.pja1_lock', 'doorstatusrearleft') }}"
  328. device_class: door
  329. - name: "PJA1 Rear Right Door Open"
  330. state: "{{ state_attr('sensor.pja1_lock', 'doorstatusrearright') }}"
  331. device_class: door
  332. - name: "PJA1 Decklid Open"
  333. state: "{{ state_attr('sensor.pja1_lock', 'decklidstatus') }}"
  334. device_class: door
  335.  
  336. - name: "FPA1 Front Left Door Open"
  337. state: "{{ state_attr('sensor.fpa1_lock', 'doorstatusfrontleft') }}"
  338. device_class: door
  339. - name: "FPA1 Front Right Door Open"
  340. state: "{{ state_attr('sensor.fpa1_lock', 'doorstatusfrontright') }}"
  341. device_class: door
  342. - name: "FPA1 Rear Left Door Open"
  343. state: "{{ state_attr('sensor.fpa1_lock', 'doorstatusrearleft') }}"
  344. device_class: door
  345. - name: "FPA1 Rear Right Door Open"
  346. state: "{{ state_attr('sensor.fpa1_lock', 'doorstatusrearright') }}"
  347. device_class: door
  348. - name: "FPA1 Decklid Open"
  349. state: "{{ state_attr('sensor.fpa1_lock', 'decklidstatus') }}"
  350. device_class: door
  351.  
  352. - name: "FPA1 Engine Hood Open"
  353. state: "{{ state_attr('sensor.fpa1_lock', 'engineHoodStatus') }}"
  354. device_class: door
  355. - name: "PJA1 Engine Hood Open"
  356. state: "{{ state_attr('sensor.pja1_lock', 'engineHoodStatus') }}"
  357. device_class: door
Advertisement
Add Comment
Please, Sign In to add comment