Snippet content copied to clipboard.
Are you sure to delete this snippet? No, don't delete
  1. {
  2. "trace": {
  3. "last_step": "action/3/default/9/if/condition/0",
  4. "run_id": "60cf98ceee57c474273a3fdc6529e309",
  5. "state": "stopped",
  6. "script_execution": "finished",
  7. "timestamp": {
  8. "start": "2025-04-17T10:54:55.263649+00:00",
  9. "finish": "2025-04-17T10:54:58.141853+00:00"
  10. },
  11. "domain": "automation",
  12. "item_id": "1739643486506",
  13. "trigger": "binary_sensor.turkontakt_esszimmer via template",
  14. "trace": {
  15. "trigger/18": [
  16. {
  17. "path": "trigger/18",
  18. "timestamp": "2025-04-17T10:54:55.288043+00:00",
  19. "changed_variables": {
  20. "this": {
  21. "entity_id": "automation.automatisierung_heizung_esszimmer",
  22. "state": "on",
  23. "attributes": {
  24. "id": "1739643486506",
  25. "last_triggered": "2025-03-27T10:51:04.472992+00:00",
  26. "mode": "queued",
  27. "current": 0,
  28. "max": 10,
  29. "friendly_name": "AUTOMATISIERUNG - Heizung Esszimmer"
  30. },
  31. "last_changed": "2025-04-17T10:54:01.185468+00:00",
  32. "last_reported": "2025-04-17T10:54:01.185468+00:00",
  33. "last_updated": "2025-04-17T10:54:01.185468+00:00",
  34. "context": {
  35. "id": "01JS1P4PF1R3X5VFA934XQC6Z6",
  36. "parent_id": null,
  37. "user_id": null
  38. }
  39. },
  40. "trigger": {
  41. "platform": "template",
  42. "entity_id": "binary_sensor.turkontakt_esszimmer",
  43. "from_state": {
  44. "entity_id": "binary_sensor.turkontakt_esszimmer",
  45. "state": "off",
  46. "attributes": {
  47. "interface_id": "RaspberryMatic-HmIP-RF",
  48. "address": "0000DA499AD292:1",
  49. "model": "HMIP-SWDO",
  50. "parameter": "STATE",
  51. "function": null,
  52. "value_state": "valid",
  53. "device_class": "window",
  54. "friendly_name": "Türkontakt Esszimmer"
  55. },
  56. "last_changed": "2025-04-16T14:58:46.838713+00:00",
  57. "last_reported": "2025-04-16T14:58:46.838713+00:00",
  58. "last_updated": "2025-04-16T14:58:46.838713+00:00",
  59. "context": {
  60. "id": "01JRZHR4XP77YBAMBGAV0YGK79",
  61. "parent_id": null,
  62. "user_id": null
  63. }
  64. },
  65. "to_state": {
  66. "entity_id": "binary_sensor.turkontakt_esszimmer",
  67. "state": "on",
  68. "attributes": {
  69. "interface_id": "RaspberryMatic-HmIP-RF",
  70. "address": "0000DA499AD292:1",
  71. "model": "HMIP-SWDO",
  72. "parameter": "STATE",
  73. "function": null,
  74. "value_state": "valid",
  75. "device_class": "window",
  76. "friendly_name": "Türkontakt Esszimmer"
  77. },
  78. "last_changed": "2025-04-17T10:54:25.259293+00:00",
  79. "last_reported": "2025-04-17T10:54:25.259293+00:00",
  80. "last_updated": "2025-04-17T10:54:25.259293+00:00",
  81. "context": {
  82. "id": "01JS1P5DZBRP4J05D68NBJSWY0",
  83. "parent_id": null,
  84. "user_id": "efb6cf9cd2644b73b3e8338a28fb4e54"
  85. }
  86. },
  87. "id": "temperature_change_window_on",
  88. "idx": "18",
  89. "alias": null,
  90. "for": {
  91. "__type": "<class 'datetime.timedelta'>",
  92. "total_seconds": 30
  93. },
  94. "description": "binary_sensor.turkontakt_esszimmer via template"
  95. },
  96. "input_trvs": [
  97. "climate.heizung_esszimmer"
  98. ],
  99. "input_temperature_sensor": [],
  100. "is_temperature_sensor_defined": false,
  101. "input_persons": [],
  102. "input_mode_guest": null,
  103. "input_people_entering_home_duration": {
  104. "hours": 0,
  105. "minutes": 0,
  106. "seconds": 2
  107. },
  108. "input_people_leaving_home_duration": {
  109. "hours": 0,
  110. "minutes": 0,
  111. "seconds": 2
  112. },
  113. "input_person_count": 0,
  114. "is_person_defined": false,
  115. "is_guest_mode_defined": false,
  116. "input_schedulers": [],
  117. "input_scheduler_selector": null,
  118. "input_scheduler_presence": null,
  119. "is_scheduler_presence_defined": false,
  120. "input_temperature_comfort": [],
  121. "input_temperature_eco": [],
  122. "input_hvac_mode": "heat",
  123. "factor": 1,
  124. "is_heat_only_if_below_real_temp": false,
  125. "input_mode_winter": null,
  126. "input_mode_outside_temperature": null,
  127. "input_mode_outside_temperature_threshold": 20,
  128. "input_mode_room_temperature_threshold": 18,
  129. "input_mode_room_temperature": false,
  130. "input_invert_winter_mode_value": false,
  131. "input_mode_party": [],
  132. "input_adjustments": "[]",
  133. "input_calibration_timeout": {
  134. "hours": 24,
  135. "minutes": 0,
  136. "seconds": 0
  137. },
  138. "input_windows": [
  139. "binary_sensor.status_fenster_esszimmer_wohnzimmer_kuche"
  140. ],
  141. "input_presence_sensor": null,
  142. "is_presence_sensor_defined": false,
  143. "input_presence_reaction_on_time": {
  144. "hours": 0,
  145. "minutes": 5,
  146. "seconds": 0
  147. },
  148. "input_presence_reaction_off_time": {
  149. "hours": 0,
  150. "minutes": 5,
  151. "seconds": 0
  152. },
  153. "input_proximity": null,
  154. "input_proximity_duration": {
  155. "hours": 0,
  156. "minutes": 2,
  157. "seconds": 0
  158. },
  159. "input_proximity_distance": 500,
  160. "input_frost_protection_duration": {
  161. "days": 0,
  162. "hours": 0,
  163. "minutes": 0,
  164. "seconds": 0
  165. },
  166. "input_liming_protection": false,
  167. "input_liming_protection_day": "Mon",
  168. "input_liming_protection_time": "12:00:00",
  169. "input_liming_in_winter": false,
  170. "input_liming_protection_duration": 1,
  171. "input_temperature_comfort_entity": null,
  172. "input_temperature_comfort_static": 22,
  173. "input_temperature_eco_entity": null,
  174. "input_temperature_eco_static": 19,
  175. "input_frost_protection_temp": 5,
  176. "input_windows_reaction_time_open": {
  177. "hours": 0,
  178. "minutes": 0,
  179. "seconds": 30
  180. },
  181. "input_windows_reaction_time_close": {
  182. "hours": 0,
  183. "minutes": 0,
  184. "seconds": 30
  185. },
  186. "input_window_open_temperature": 0,
  187. "input_party_legacy_restore": false,
  188. "input_window_legacy_restore": true,
  189. "is_legacy_restore": true,
  190. "input_force_max_temperature": [],
  191. "input_force_eco_temperature": [],
  192. "input_calibration_delta": 5,
  193. "input_calibration_generic": false,
  194. "input_calibration_step_size": "0.1",
  195. "input_calibration_key_word": "calibration",
  196. "input_generic_calibration_offset": 5,
  197. "input_aggressive_mode_offset": 0,
  198. "input_aggressive_mode_range": 0,
  199. "input_aggressive_mode_calibration": false,
  200. "input_away_offset": 0,
  201. "is_scheduler_away_mode": false,
  202. "is_presence_away_mode": false,
  203. "presence_ignor_people": false,
  204. "is_reset_temperature": false,
  205. "is_off_instead_min": false,
  206. "is_not_off_but_min": false,
  207. "is_fahrenheit": false,
  208. "is_physical_change_enabled": false,
  209. "is_off_if_nobody_home": false,
  210. "input_action_call_delay": {
  211. "hours": 0,
  212. "minutes": 0,
  213. "seconds": 2
  214. },
  215. "input_custom_action": null,
  216. "input_startup_delay": {
  217. "hours": 0,
  218. "minutes": 1,
  219. "seconds": 0
  220. },
  221. "input_fully_open_difference": 1,
  222. "input_valve_opening_keyword": "valve_opening_degree",
  223. "input_valve_positioning_step_size": "10",
  224. "input_valve_positioning_mode": "off",
  225. "input_valve_positioning_timeout": {
  226. "hours": 0,
  227. "minutes": 20,
  228. "seconds": 0
  229. },
  230. "input_valve_positioning_max_opening": 100,
  231. "invalid_states": [
  232. "unknown",
  233. "unavailable"
  234. ],
  235. "value_temperature_sensor": "unknown",
  236. "valid_temperature_sensor": false,
  237. "current_time_stamp": "2025-04-17 12:54:55.265518+02:00",
  238. "is_metric": true,
  239. "up_time_sensor": null,
  240. "is_uptime_defined": false,
  241. "uptime": "2025-04-17 12:54:55.265518+02:00",
  242. "startup_delay": null,
  243. "state_outside_temp": null,
  244. "state_ahc": true,
  245. "is_proximity_defined": false,
  246. "state_proximity_arrived": false,
  247. "state_proximity_way_home": false,
  248. "is_guest_mode": false,
  249. "is_anybody_home": false,
  250. "is_anybody_home_or_proximity": false,
  251. "active_scheduler": null,
  252. "is_scheduler_defined": false,
  253. "state_scheduler": false,
  254. "is_presence_scheduler_defined": false,
  255. "state_presence_scheduler": false,
  256. "state_presence_sensor": false,
  257. "state_presence": false,
  258. "is_force_max_temperature": false,
  259. "is_force_eco_temperature": false,
  260. "active_party_entity": null,
  261. "state_party": false,
  262. "party_temp": null,
  263. "is_away": false,
  264. "state_window": true,
  265. "is_aggressive_mode": false,
  266. "is_aggressive_mode_calibration": false,
  267. "is_frost_protection": false,
  268. "is_liming_protection": false,
  269. "valves": [
  270. "climate.heizung_esszimmer"
  271. ],
  272. "valves_unsupported": [],
  273. "valves_off_mode": [
  274. "climate.heizung_esszimmer"
  275. ],
  276. "valves_without_off_mode": [],
  277. "valves_tado": [],
  278. "valves_xiaomi_xiaomi": [],
  279. "valves_xiaomi_aqara": [],
  280. "valves_xiaomi": [],
  281. "valves_danfoss": [],
  282. "valves_popp": [],
  283. "valves_hive": [],
  284. "valves_dph": [],
  285. "valves_calibration_common": [
  286. "climate.heizung_esszimmer"
  287. ],
  288. "last_comfort_entity_change": null,
  289. "last_eco_entity_change": null,
  290. "latest_entry_today": null,
  291. "latest_entry_day_before": null,
  292. "entry": null,
  293. "entry_time": "",
  294. "entry_comfort_temp": null,
  295. "entry_eco_temp": null,
  296. "entry_calibration": true,
  297. "entry_mode": "auto",
  298. "trigger_id_defined": true,
  299. "is_calibration_trigger": false,
  300. "is_generic_calibration_trigger": false,
  301. "is_generic_calibration": false,
  302. "is_aggressive_mode_trigger": false,
  303. "is_change_trigger": false,
  304. "set_max_temperature": false,
  305. "is_pysical_change": false,
  306. "is_adjustment_trigger": false,
  307. "is_reset": false,
  308. "is_changes_trigger": true,
  309. "is_scene_create_trigger": true,
  310. "is_scene_apply_trigger": false,
  311. "is_scene_destroy_trigger": false,
  312. "scene_entities": [
  313. "climate.heizung_esszimmer"
  314. ],
  315. "scene_window_id": "scene.automatisierung_heizung_esszimmer_window",
  316. "scene_party_id": "scene.automatisierung_heizung_esszimmer_party",
  317. "scenes_all": [
  318. "scene.automatisierung_heizung_esszimmer_window",
  319. "scene.automatisierung_heizung_esszimmer_party"
  320. ],
  321. "scene_to_apply": null,
  322. "scenes_to_destroy": [],
  323. "scene_to_create": "scene.automatisierung_heizung_esszimmer_window",
  324. "set_comfort": false,
  325. "mode": "off",
  326. "temperature_comfort_of_entity": null,
  327. "temperature_eco_of_entity": null,
  328. "temperature_comfort": 22,
  329. "temperature_away": 22,
  330. "temperature_eco": 19,
  331. "target_temperature": 19,
  332. "changes": {
  333. "climate.heizung_esszimmer": [
  334. {
  335. "mode": "off",
  336. "temp": 19
  337. }
  338. ]
  339. },
  340. "positioning": [],
  341. "reset_data": [],
  342. "is_reset_trigger": false,
  343. "is_native_calibration": false,
  344. "is_native_calibration_trigger": false,
  345. "rounding_mode": "manual",
  346. "calibration_tado": {},
  347. "calibration_xiaomi": {},
  348. "calibration_dph": {},
  349. "calibration_common": {},
  350. "calibration_value_set": {},
  351. "no_changes": true,
  352. "scene_trigger": true,
  353. "change_trigger": false,
  354. "reset_trigger": false,
  355. "calibration_trigger": false,
  356. "positioning_trigger": false,
  357. "automation_name": "AUTOMATISIERUNG - Heizung Esszimmer",
  358. "warnings": [
  359. "To make Advance Heating Control work properly just setup the uptime integration (https://www.home-assistant.io/integrations/uptime/)"
  360. ],
  361. "climates_information": [
  362. {
  363. "entity_id": "climate.heizung_esszimmer",
  364. "state": "heat",
  365. "temperature": 23,
  366. "current_temperature": 23.4
  367. }
  368. ]
  369. }
  370. }
  371. ],
  372. "condition/0": [
  373. {
  374. "path": "condition/0",
  375. "timestamp": "2025-04-17T10:54:55.288172+00:00",
  376. "result": {
  377. "result": true
  378. }
  379. }
  380. ],
  381. "condition/0/conditions/0": [
  382. {
  383. "path": "condition/0/conditions/0",
  384. "timestamp": "2025-04-17T10:54:55.288262+00:00",
  385. "result": {
  386. "result": false,
  387. "entities": []
  388. }
  389. }
  390. ],
  391. "condition/0/conditions/1": [
  392. {
  393. "path": "condition/0/conditions/1",
  394. "timestamp": "2025-04-17T10:54:55.289291+00:00",
  395. "result": {
  396. "result": true,
  397. "entities": []
  398. }
  399. }
  400. ],
  401. "action/0": [
  402. {
  403. "path": "action/0",
  404. "timestamp": "2025-04-17T10:54:55.290446+00:00",
  405. "changed_variables": {
  406. "context": {
  407. "id": "01JS1P6B8Z5CZZ59TD8JGSYAB6",
  408. "parent_id": "01JS1P5DZBRP4J05D68NBJSWY0",
  409. "user_id": null
  410. },
  411. "is_delayed": false
  412. }
  413. }
  414. ],
  415. "action/1": [
  416. {
  417. "path": "action/1",
  418. "timestamp": "2025-04-17T10:54:55.298512+00:00",
  419. "result": {
  420. "params": {
  421. "domain": "system_log",
  422. "service": "write",
  423. "service_data": {
  424. "message": "AHC - AUTOMATISIERUNG - Heizung Esszimmer \n automation delayed: False",
  425. "level": "debug",
  426. "logger": "blueprints.panhans.heatingcontrol"
  427. },
  428. "target": {}
  429. },
  430. "running_script": false
  431. }
  432. }
  433. ],
  434. "action/2": [
  435. {
  436. "path": "action/2",
  437. "timestamp": "2025-04-17T10:54:55.300129+00:00",
  438. "changed_variables": {
  439. "wait": {
  440. "remaining": null,
  441. "completed": true
  442. }
  443. },
  444. "result": {
  445. "wait": {
  446. "remaining": null,
  447. "completed": true
  448. }
  449. }
  450. }
  451. ],
  452. "action/3": [
  453. {
  454. "path": "action/3",
  455. "timestamp": "2025-04-17T10:54:55.301386+00:00",
  456. "changed_variables": {
  457. "scene_to_apply_tmp": "scene.automatisierung_heizung_esszimmer_window",
  458. "index": 0,
  459. "thermostat": "climate.heizung_esszimmer",
  460. "temp_target": 19
  461. },
  462. "result": {
  463. "choice": "default"
  464. }
  465. }
  466. ],
  467. "action/3/choose/0": [
  468. {
  469. "path": "action/3/choose/0",
  470. "timestamp": "2025-04-17T10:54:55.301824+00:00",
  471. "result": {
  472. "result": false
  473. }
  474. }
  475. ],
  476. "action/3/choose/0/conditions/0": [
  477. {
  478. "path": "action/3/choose/0/conditions/0",
  479. "timestamp": "2025-04-17T10:54:55.302551+00:00",
  480. "result": {
  481. "result": false,
  482. "entities": []
  483. }
  484. }
  485. ],
  486. "action/3/default/0": [
  487. {
  488. "path": "action/3/default/0",
  489. "timestamp": "2025-04-17T10:54:55.304433+00:00",
  490. "result": {
  491. "choice": "then"
  492. }
  493. }
  494. ],
  495. "action/3/default/0/if": [
  496. {
  497. "path": "action/3/default/0/if",
  498. "timestamp": "2025-04-17T10:54:55.304817+00:00",
  499. "result": {
  500. "result": true
  501. }
  502. }
  503. ],
  504. "action/3/default/0/if/condition/0": [
  505. {
  506. "path": "action/3/default/0/if/condition/0",
  507. "timestamp": "2025-04-17T10:54:55.305494+00:00",
  508. "result": {
  509. "result": true,
  510. "entities": []
  511. }
  512. }
  513. ],
  514. "action/3/default/0/then/0": [
  515. {
  516. "path": "action/3/default/0/then/0",
  517. "timestamp": "2025-04-17T10:54:55.314799+00:00",
  518. "result": {
  519. "params": {
  520. "domain": "system_log",
  521. "service": "write",
  522. "service_data": {
  523. "level": "warning",
  524. "logger": "blueprints.panhans.heatingcontrol",
  525. "message": "AHC-Warnings - AUTOMATISIERUNG - Heizung Esszimmer:\nTo make Advance Heating Control work properly just setup the uptime integration (https://www.home-assistant.io/integrations/uptime/)"
  526. },
  527. "target": {}
  528. },
  529. "running_script": false
  530. }
  531. }
  532. ],
  533. "action/3/default/1": [
  534. {
  535. "path": "action/3/default/1",
  536. "timestamp": "2025-04-17T10:54:55.317193+00:00",
  537. "result": {
  538. "event": "ahc_event",
  539. "event_data": {
  540. "state": true,
  541. "mode": "eco",
  542. "automation": "automation.automatisierung_heizung_esszimmer",
  543. "is_person_defined": false,
  544. "is_anybody_home": false,
  545. "is_proximity_defined": false,
  546. "is_anybody_home_or_proximity": false,
  547. "is_guest_mode": false,
  548. "active_scheduler": null,
  549. "state_scheduler": false,
  550. "state_presence_sensor": false,
  551. "state_presence_scheduler": false,
  552. "state_presence": false,
  553. "state_proximity_arrived": false,
  554. "state_proximity_way_home": false,
  555. "is_force_max_temperature": false,
  556. "is_force_eco_temperature": false,
  557. "active_party_entity": null,
  558. "party_temp": null,
  559. "is_away": false,
  560. "state_window": true,
  561. "is_aggressive_mode": false,
  562. "is_frost_protection": false,
  563. "is_liming_protection": false,
  564. "state_outside_temp": null,
  565. "entry_time": "",
  566. "thermostats": [
  567. "climate.heizung_esszimmer"
  568. ],
  569. "hvac_mode": "off",
  570. "temperature_comfort": 22,
  571. "temperature_eco": 19,
  572. "target_temperature": 19,
  573. "set_max_temperature": false,
  574. "last_trigger_id": "temperature_change_window_on",
  575. "calibration_trigger": false,
  576. "change_trigger": false,
  577. "warnings": true
  578. }
  579. }
  580. }
  581. ],
  582. "action/3/default/2": [
  583. {
  584. "path": "action/3/default/2",
  585. "timestamp": "2025-04-17T10:54:55.351189+00:00"
  586. }
  587. ],
  588. "action/3/default/2/if": [
  589. {
  590. "path": "action/3/default/2/if",
  591. "timestamp": "2025-04-17T10:54:55.351640+00:00",
  592. "result": {
  593. "result": false
  594. }
  595. }
  596. ],
  597. "action/3/default/2/if/condition/0": [
  598. {
  599. "path": "action/3/default/2/if/condition/0",
  600. "timestamp": "2025-04-17T10:54:55.352385+00:00",
  601. "result": {
  602. "result": false,
  603. "entities": []
  604. }
  605. }
  606. ],
  607. "action/3/default/3": [
  608. {
  609. "path": "action/3/default/3",
  610. "timestamp": "2025-04-17T10:54:55.354796+00:00"
  611. }
  612. ],
  613. "action/3/default/3/if": [
  614. {
  615. "path": "action/3/default/3/if",
  616. "timestamp": "2025-04-17T10:54:55.365861+00:00",
  617. "result": {
  618. "result": false
  619. }
  620. }
  621. ],
  622. "action/3/default/3/if/condition/0": [
  623. {
  624. "path": "action/3/default/3/if/condition/0",
  625. "timestamp": "2025-04-17T10:54:55.366688+00:00",
  626. "result": {
  627. "result": false,
  628. "entities": []
  629. }
  630. }
  631. ],
  632. "action/3/default/4": [
  633. {
  634. "path": "action/3/default/4",
  635. "timestamp": "2025-04-17T10:54:55.368988+00:00",
  636. "result": {
  637. "choice": "then"
  638. }
  639. }
  640. ],
  641. "action/3/default/4/if": [
  642. {
  643. "path": "action/3/default/4/if",
  644. "timestamp": "2025-04-17T10:54:55.369444+00:00",
  645. "result": {
  646. "result": true
  647. }
  648. }
  649. ],
  650. "action/3/default/4/if/condition/0": [
  651. {
  652. "path": "action/3/default/4/if/condition/0",
  653. "timestamp": "2025-04-17T10:54:55.370126+00:00",
  654. "result": {
  655. "result": true,
  656. "entities": []
  657. }
  658. }
  659. ],
  660. "action/3/default/4/if/condition/1": [
  661. {
  662. "path": "action/3/default/4/if/condition/1",
  663. "timestamp": "2025-04-17T10:54:55.371645+00:00",
  664. "result": {
  665. "result": true,
  666. "entities": [
  667. "scene.automatisierung_heizung_esszimmer_window"
  668. ]
  669. }
  670. }
  671. ],
  672. "action/3/default/4/then/0": [
  673. {
  674. "path": "action/3/default/4/then/0",
  675. "timestamp": "2025-04-17T10:54:55.378579+00:00",
  676. "result": {
  677. "params": {
  678. "domain": "scene",
  679. "service": "create",
  680. "service_data": {
  681. "snapshot_entities": [
  682. "climate.heizung_esszimmer"
  683. ],
  684. "scene_id": "automatisierung_heizung_esszimmer_window"
  685. },
  686. "target": {}
  687. },
  688. "running_script": false
  689. }
  690. }
  691. ],
  692. "action/3/default/5": [
  693. {
  694. "path": "action/3/default/5",
  695. "timestamp": "2025-04-17T10:54:55.382268+00:00"
  696. }
  697. ],
  698. "action/3/default/5/if": [
  699. {
  700. "path": "action/3/default/5/if",
  701. "timestamp": "2025-04-17T10:54:55.383227+00:00",
  702. "result": {
  703. "result": false
  704. }
  705. }
  706. ],
  707. "action/3/default/5/if/condition/0": [
  708. {
  709. "path": "action/3/default/5/if/condition/0",
  710. "timestamp": "2025-04-17T10:54:55.383947+00:00",
  711. "result": {
  712. "result": false,
  713. "entities": []
  714. }
  715. }
  716. ],
  717. "action/3/default/6": [
  718. {
  719. "path": "action/3/default/6",
  720. "timestamp": "2025-04-17T10:54:55.386703+00:00",
  721. "changed_variables": {
  722. "scene_to_apply_tmp": "scene.automatisierung_heizung_esszimmer_window"
  723. }
  724. }
  725. ],
  726. "action/3/default/7": [
  727. {
  728. "path": "action/3/default/7",
  729. "timestamp": "2025-04-17T10:54:55.388305+00:00",
  730. "changed_variables": {
  731. "index": 0,
  732. "thermostat": "climate.heizung_esszimmer",
  733. "temp_target": 19
  734. },
  735. "result": {
  736. "choice": "else"
  737. }
  738. }
  739. ],
  740. "action/3/default/7/if": [
  741. {
  742. "path": "action/3/default/7/if",
  743. "timestamp": "2025-04-17T10:54:55.388737+00:00",
  744. "result": {
  745. "result": false
  746. }
  747. }
  748. ],
  749. "action/3/default/7/if/condition/0": [
  750. {
  751. "path": "action/3/default/7/if/condition/0",
  752. "timestamp": "2025-04-17T10:54:55.389476+00:00",
  753. "result": {
  754. "result": false,
  755. "entities": []
  756. }
  757. }
  758. ],
  759. "action/3/default/7/else/0": [
  760. {
  761. "path": "action/3/default/7/else/0",
  762. "timestamp": "2025-04-17T10:54:55.391010+00:00"
  763. }
  764. ],
  765. "action/3/default/7/else/0/if": [
  766. {
  767. "path": "action/3/default/7/else/0/if",
  768. "timestamp": "2025-04-17T10:54:55.391346+00:00",
  769. "result": {
  770. "result": false
  771. }
  772. }
  773. ],
  774. "action/3/default/7/else/0/if/condition/0": [
  775. {
  776. "path": "action/3/default/7/else/0/if/condition/0",
  777. "timestamp": "2025-04-17T10:54:55.392032+00:00",
  778. "result": {
  779. "result": false,
  780. "entities": []
  781. }
  782. }
  783. ],
  784. "action/3/default/7/else/1": [
  785. {
  786. "path": "action/3/default/7/else/1",
  787. "timestamp": "2025-04-17T10:54:55.393564+00:00",
  788. "changed_variables": {
  789. "index": 0,
  790. "thermostat": "climate.heizung_esszimmer",
  791. "temp_target": 19
  792. },
  793. "result": {
  794. "choice": "then"
  795. }
  796. }
  797. ],
  798. "action/3/default/7/else/1/if": [
  799. {
  800. "path": "action/3/default/7/else/1/if",
  801. "timestamp": "2025-04-17T10:54:55.394457+00:00",
  802. "result": {
  803. "result": true
  804. }
  805. }
  806. ],
  807. "action/3/default/7/else/1/if/condition/0": [
  808. {
  809. "path": "action/3/default/7/else/1/if/condition/0",
  810. "timestamp": "2025-04-17T10:54:55.395331+00:00",
  811. "result": {
  812. "result": true
  813. }
  814. }
  815. ],
  816. "action/3/default/7/else/1/if/condition/1": [
  817. {
  818. "path": "action/3/default/7/else/1/if/condition/1",
  819. "timestamp": "2025-04-17T10:54:55.395993+00:00",
  820. "result": {
  821. "result": true,
  822. "entities": []
  823. }
  824. }
  825. ],
  826. "action/3/default/7/else/1/then/0": [
  827. {
  828. "path": "action/3/default/7/else/1/then/0",
  829. "timestamp": "2025-04-17T10:54:55.397424+00:00",
  830. "changed_variables": {
  831. "index": 0,
  832. "thermostat": "climate.heizung_esszimmer",
  833. "temp_target": 19
  834. }
  835. }
  836. ],
  837. "action/3/default/7/else/1/then/0/repeat/sequence/0": [
  838. {
  839. "path": "action/3/default/7/else/1/then/0/repeat/sequence/0",
  840. "timestamp": "2025-04-17T10:54:55.398451+00:00",
  841. "changed_variables": {
  842. "index": 0,
  843. "thermostat": "climate.heizung_esszimmer",
  844. "temp_target": 19,
  845. "repeat": {
  846. "first": true,
  847. "index": 1,
  848. "last": true
  849. }
  850. }
  851. }
  852. ],
  853. "action/3/default/7/else/1/then/0/repeat/sequence/1": [
  854. {
  855. "path": "action/3/default/7/else/1/then/0/repeat/sequence/1",
  856. "timestamp": "2025-04-17T10:54:55.404056+00:00",
  857. "result": {
  858. "params": {
  859. "domain": "system_log",
  860. "service": "write",
  861. "service_data": {
  862. "message": "AHC - Change - AUTOMATISIERUNG - Heizung Esszimmer \n Trigger ID: temperature_change_window_on Thermostat: climate.heizung_esszimmer \n Mode: off \n New Target Temp: 19 \n Current Target Temp: 23.0",
  863. "level": "debug",
  864. "logger": "blueprints.panhans.heatingcontrol"
  865. },
  866. "target": {}
  867. },
  868. "running_script": false
  869. }
  870. }
  871. ],
  872. "action/3/default/7/else/1/then/0/repeat/sequence/2": [
  873. {
  874. "path": "action/3/default/7/else/1/then/0/repeat/sequence/2",
  875. "timestamp": "2025-04-17T10:54:55.406403+00:00",
  876. "result": {
  877. "choice": "then"
  878. }
  879. }
  880. ],
  881. "action/3/default/7/else/1/then/0/repeat/sequence/2/if": [
  882. {
  883. "path": "action/3/default/7/else/1/then/0/repeat/sequence/2/if",
  884. "timestamp": "2025-04-17T10:54:55.407132+00:00",
  885. "result": {
  886. "result": true
  887. }
  888. }
  889. ],
  890. "action/3/default/7/else/1/then/0/repeat/sequence/2/if/condition/0": [
  891. {
  892. "path": "action/3/default/7/else/1/then/0/repeat/sequence/2/if/condition/0",
  893. "timestamp": "2025-04-17T10:54:55.411613+00:00",
  894. "result": {
  895. "result": true,
  896. "entities": [
  897. "climate.heizung_esszimmer"
  898. ]
  899. }
  900. }
  901. ],
  902. "action/3/default/7/else/1/then/0/repeat/sequence/2/then/0": [
  903. {
  904. "path": "action/3/default/7/else/1/then/0/repeat/sequence/2/then/0",
  905. "timestamp": "2025-04-17T10:54:55.414226+00:00",
  906. "result": {
  907. "params": {
  908. "domain": "climate",
  909. "service": "set_hvac_mode",
  910. "service_data": {
  911. "entity_id": "climate.heizung_esszimmer",
  912. "hvac_mode": "off"
  913. },
  914. "target": {}
  915. },
  916. "running_script": false
  917. }
  918. }
  919. ],
  920. "action/3/default/7/else/1/then/0/repeat/sequence/2/then/1": [
  921. {
  922. "path": "action/3/default/7/else/1/then/0/repeat/sequence/2/then/1",
  923. "timestamp": "2025-04-17T10:54:56.098742+00:00",
  924. "result": {
  925. "delay": 2,
  926. "done": true
  927. }
  928. }
  929. ],
  930. "action/3/default/7/else/1/then/0/repeat/sequence/3": [
  931. {
  932. "path": "action/3/default/7/else/1/then/0/repeat/sequence/3",
  933. "timestamp": "2025-04-17T10:54:58.104066+00:00"
  934. }
  935. ],
  936. "action/3/default/7/else/1/then/0/repeat/sequence/3/if": [
  937. {
  938. "path": "action/3/default/7/else/1/then/0/repeat/sequence/3/if",
  939. "timestamp": "2025-04-17T10:54:58.107766+00:00",
  940. "result": {
  941. "result": false
  942. }
  943. }
  944. ],
  945. "action/3/default/7/else/1/then/0/repeat/sequence/3/if/condition/0": [
  946. {
  947. "path": "action/3/default/7/else/1/then/0/repeat/sequence/3/if/condition/0",
  948. "timestamp": "2025-04-17T10:54:58.117657+00:00",
  949. "result": {
  950. "result": false,
  951. "entities": [
  952. "climate.heizung_esszimmer"
  953. ]
  954. }
  955. }
  956. ],
  957. "action/3/default/8": [
  958. {
  959. "path": "action/3/default/8",
  960. "timestamp": "2025-04-17T10:54:58.122662+00:00"
  961. }
  962. ],
  963. "action/3/default/8/if": [
  964. {
  965. "path": "action/3/default/8/if",
  966. "timestamp": "2025-04-17T10:54:58.128587+00:00",
  967. "result": {
  968. "result": false
  969. }
  970. }
  971. ],
  972. "action/3/default/8/if/condition/0": [
  973. {
  974. "path": "action/3/default/8/if/condition/0",
  975. "timestamp": "2025-04-17T10:54:58.130446+00:00",
  976. "result": {
  977. "result": false,
  978. "entities": []
  979. }
  980. }
  981. ],
  982. "action/3/default/9": [
  983. {
  984. "path": "action/3/default/9",
  985. "timestamp": "2025-04-17T10:54:58.135640+00:00"
  986. }
  987. ],
  988. "action/3/default/9/if": [
  989. {
  990. "path": "action/3/default/9/if",
  991. "timestamp": "2025-04-17T10:54:58.136118+00:00",
  992. "result": {
  993. "result": false
  994. }
  995. }
  996. ],
  997. "action/3/default/9/if/condition/0": [
  998. {
  999. "path": "action/3/default/9/if/condition/0",
  1000. "timestamp": "2025-04-17T10:54:58.136833+00:00",
  1001. "result": {
  1002. "result": false,
  1003. "entities": []
  1004. }
  1005. }
  1006. ]
  1007. },
  1008. "config": {
  1009. "trigger_variables": {
  1010. "input_trvs": [
  1011. "climate.heizung_esszimmer"
  1012. ],
  1013. "input_temperature_sensor": [],
  1014. "is_temperature_sensor_defined": "{{ input_temperature_sensor != [] }}",
  1015. "input_persons": [],
  1016. "input_mode_guest": null,
  1017. "input_people_entering_home_duration": {
  1018. "hours": 0,
  1019. "minutes": 0,
  1020. "seconds": 2
  1021. },
  1022. "input_people_leaving_home_duration": {
  1023. "hours": 0,
  1024. "minutes": 0,
  1025. "seconds": 2
  1026. },
  1027. "input_person_count": "{{ input_persons | count }}",
  1028. "is_person_defined": "{{ input_person_count > 0 }}",
  1029. "is_guest_mode_defined": "{{ input_mode_guest != none }}",
  1030. "input_schedulers": [],
  1031. "input_scheduler_selector": null,
  1032. "input_scheduler_presence": null,
  1033. "is_scheduler_presence_defined": "{{ input_scheduler_presence != none }}",
  1034. "input_temperature_comfort": [],
  1035. "input_temperature_eco": [],
  1036. "input_hvac_mode": "heat",
  1037. "factor": "{{ iif(input_hvac_mode == 'cool', -1, 1) | int }}",
  1038. "is_heat_only_if_below_real_temp": false,
  1039. "input_mode_winter": null,
  1040. "input_mode_outside_temperature": null,
  1041. "input_mode_outside_temperature_threshold": 20,
  1042. "input_mode_room_temperature_threshold": 18,
  1043. "input_mode_room_temperature": false,
  1044. "input_invert_winter_mode_value": false,
  1045. "input_mode_party": [],
  1046. "input_adjustments": "[]",
  1047. "input_calibration_timeout": {
  1048. "hours": 24,
  1049. "minutes": 0,
  1050. "seconds": 0
  1051. },
  1052. "input_windows": [
  1053. "binary_sensor.status_fenster_esszimmer_wohnzimmer_kuche"
  1054. ],
  1055. "input_presence_sensor": null,
  1056. "is_presence_sensor_defined": "{{ input_presence_sensor != none }}",
  1057. "input_presence_reaction_on_time": {
  1058. "hours": 0,
  1059. "minutes": 5,
  1060. "seconds": 0
  1061. },
  1062. "input_presence_reaction_off_time": {
  1063. "hours": 0,
  1064. "minutes": 5,
  1065. "seconds": 0
  1066. },
  1067. "input_proximity": null,
  1068. "input_proximity_duration": {
  1069. "hours": 0,
  1070. "minutes": 2,
  1071. "seconds": 0
  1072. },
  1073. "input_proximity_distance": 500,
  1074. "input_frost_protection_duration": {
  1075. "days": 0,
  1076. "hours": 0,
  1077. "minutes": 0,
  1078. "seconds": 0
  1079. },
  1080. "input_liming_protection": false,
  1081. "input_liming_protection_day": "Mon",
  1082. "input_liming_protection_time": "12:00:00",
  1083. "input_liming_in_winter": false,
  1084. "input_liming_protection_duration": 1
  1085. },
  1086. "variables": {
  1087. "input_trvs": [
  1088. "climate.heizung_esszimmer"
  1089. ],
  1090. "input_hvac_mode": "heat",
  1091. "input_temperature_sensor": [],
  1092. "input_temperature_comfort": [],
  1093. "input_temperature_comfort_entity": "{{ iif(input_temperature_comfort == [], none, input_temperature_comfort) }}",
  1094. "input_temperature_comfort_static": 22,
  1095. "input_temperature_eco": [],
  1096. "input_temperature_eco_entity": "{{ iif(input_temperature_eco == [], none, input_temperature_eco) }}",
  1097. "input_temperature_eco_static": 19,
  1098. "input_frost_protection_temp": 5,
  1099. "input_frost_protection_duration": {
  1100. "days": 0,
  1101. "hours": 0,
  1102. "minutes": 0,
  1103. "seconds": 0
  1104. },
  1105. "input_liming_protection": false,
  1106. "input_liming_protection_day": "Mon",
  1107. "input_liming_protection_time": "12:00:00",
  1108. "input_liming_in_winter": false,
  1109. "input_liming_protection_duration": 1,
  1110. "input_schedulers": [],
  1111. "input_scheduler_selector": null,
  1112. "input_presence_sensor": null,
  1113. "input_scheduler_presence": null,
  1114. "input_presence_reaction_off_time": {
  1115. "hours": 0,
  1116. "minutes": 5,
  1117. "seconds": 0
  1118. },
  1119. "input_presence_reaction_on_time": {
  1120. "hours": 0,
  1121. "minutes": 5,
  1122. "seconds": 0
  1123. },
  1124. "input_windows": [
  1125. "binary_sensor.status_fenster_esszimmer_wohnzimmer_kuche"
  1126. ],
  1127. "input_windows_reaction_time_open": {
  1128. "hours": 0,
  1129. "minutes": 0,
  1130. "seconds": 30
  1131. },
  1132. "input_windows_reaction_time_close": {
  1133. "hours": 0,
  1134. "minutes": 0,
  1135. "seconds": 30
  1136. },
  1137. "input_window_open_temperature": 0,
  1138. "input_party_legacy_restore": false,
  1139. "input_window_legacy_restore": true,
  1140. "is_legacy_restore": "{{ input_party_legacy_restore or input_window_legacy_restore }}",
  1141. "input_mode_winter": null,
  1142. "input_invert_winter_mode_value": false,
  1143. "input_mode_outside_temperature": null,
  1144. "input_mode_outside_temperature_threshold": 20,
  1145. "input_mode_room_temperature": false,
  1146. "input_mode_room_temperature_threshold": 18,
  1147. "input_proximity": null,
  1148. "input_persons": [],
  1149. "input_mode_guest": null,
  1150. "input_people_entering_home_duration": {
  1151. "hours": 0,
  1152. "minutes": 0,
  1153. "seconds": 2
  1154. },
  1155. "input_people_leaving_home_duration": {
  1156. "hours": 0,
  1157. "minutes": 0,
  1158. "seconds": 2
  1159. },
  1160. "input_mode_party": [],
  1161. "input_force_max_temperature": [],
  1162. "input_force_eco_temperature": [],
  1163. "input_calibration_delta": 5,
  1164. "input_calibration_generic": false,
  1165. "input_calibration_step_size": "0.1",
  1166. "input_calibration_key_word": "calibration",
  1167. "input_generic_calibration_offset": 5,
  1168. "input_aggressive_mode_offset": 0,
  1169. "input_aggressive_mode_range": 0,
  1170. "input_aggressive_mode_calibration": false,
  1171. "input_away_offset": 0,
  1172. "is_scheduler_away_mode": false,
  1173. "is_presence_away_mode": false,
  1174. "presence_ignor_people": false,
  1175. "input_adjustments": "[]",
  1176. "is_reset_temperature": false,
  1177. "is_off_instead_min": false,
  1178. "is_not_off_but_min": false,
  1179. "is_fahrenheit": false,
  1180. "is_heat_only_if_below_real_temp": false,
  1181. "is_physical_change_enabled": false,
  1182. "is_off_if_nobody_home": false,
  1183. "input_action_call_delay": {
  1184. "hours": 0,
  1185. "minutes": 0,
  1186. "seconds": 2
  1187. },
  1188. "input_custom_action": null,
  1189. "input_startup_delay": {
  1190. "hours": 0,
  1191. "minutes": 1,
  1192. "seconds": 0
  1193. },
  1194. "input_fully_open_difference": 1,
  1195. "input_valve_opening_keyword": "valve_opening_degree",
  1196. "input_valve_positioning_step_size": "10",
  1197. "input_valve_positioning_mode": "off",
  1198. "input_valve_positioning_timeout": {
  1199. "hours": 0,
  1200. "minutes": 20,
  1201. "seconds": 0
  1202. },
  1203. "input_valve_positioning_max_opening": 100,
  1204. "is_temperature_sensor_defined": "{{ input_temperature_sensor != [] }}",
  1205. "invalid_states": "{{ ['unknown', 'unavailable'] }}\n",
  1206. "value_temperature_sensor": "{% if is_temperature_sensor_defined %}\n {{ states(input_temperature_sensor) }}\n{% else %}\n {{ 'unknown' }}\n{% endif %}\n",
  1207. "valid_temperature_sensor": "{{ value_temperature_sensor not in invalid_states }}\n",
  1208. "factor": "{{ iif(input_hvac_mode == 'cool', -1, 1) | int }}",
  1209. "current_time_stamp": "{{ now() }}",
  1210. "is_metric": "{{ not is_temperature_sensor_defined or (is_temperature_sensor_defined and state_attr(input_temperature_sensor,VAR_UNIT_OF_MEASUREMENT) == '°C') }}",
  1211. "up_time_sensor": "{{ integration_entities('uptime') | first | default(none) }}",
  1212. "is_uptime_defined": "{{ up_time_sensor != none }}",
  1213. "uptime": "{% if is_uptime_defined %}\n {{ states(up_time_sensor) | as_datetime }}\n{% else %}\n {{ current_time_stamp | as_datetime }}\n{% endif %}\n",
  1214. "startup_delay": "{% set start_delay_seconds = timedelta(**input_startup_delay).total_seconds() %}\n{% if not is_uptime_defined or start_delay_seconds == 0 %}\n {{ none }}\n{% else %}\n {% set difference = (current_time_stamp | as_datetime - uptime | as_datetime).total_seconds() %}\n {% set real_start_delay = (start_delay_seconds - difference) %}\n\n {{ iif(real_start_delay > 0, real_start_delay, none) }}\n{% endif %}\n",
  1215. "state_outside_temp": "{% if input_mode_outside_temperature == none %}\n {{ none }}\n{% else %}\n {% set outside_state = false %}\n {% set use_room_temp = input_mode_room_temperature and valid_temperature_sensor %}\n {% set room_state = iif(use_room_temp, false, true) %}\n\n {% set state = states(input_mode_outside_temperature) %}\n {% set state = iif(is_number(state) == true, state, state_attr(input_mode_outside_temperature,'temperature'))%}\n\n {% if is_number(state) %}\n {% set outside_state = (state | float - input_mode_outside_temperature_threshold | float) * factor < 0 %}\n {% endif %}\n\n {% if use_room_temp %}\n {% set state = states(input_temperature_sensor) %}\n\n {% if is_number(state) %}\n {% set room_state = (state | float - input_mode_room_temperature_threshold | float) * factor < 0 %}\n {% endif %}\n {% endif %}\n\n {{ room_state and outside_state }}\n{% endif %}\n",
  1216. "state_ahc": "{% set result = true %} {% if input_mode_winter != none %}\n {% set activation_state = iif(input_invert_winter_mode_value, 'off', 'on') %}\n {% set result = is_state(input_mode_winter, activation_state) %}\n{% endif %}\n{{ iif(state_outside_temp == none, result, result and state_outside_temp) }}\n",
  1217. "is_proximity_defined": "{{ input_proximity != none }}",
  1218. "state_proximity_arrived": "{% set proximity_entities = device_entities(input_proximity) %} {% set is_arrived = proximity_entities \n | select('is_state','arrived') \n | expand \n | selectattr('attributes.device_class', 'eq', 'enum') \n | list | count > 0 %}\n{{ is_arrived }}\n",
  1219. "state_proximity_way_home": "{% set proximity_entities = device_entities(input_proximity) %}\n{% set earliest_timestamp = current_time_stamp | as_datetime - timedelta(**input_proximity_duration) %} {% set uptime_duration = as_datetime(uptime) + timedelta(**input_proximity_duration) %}\n{% if uptime_duration > earliest_timestamp %}\n {% set earliest_timestamp = uptime_duration%}\n{% endif %}\n{% set entities_towards = proximity_entities \n | expand \n | selectattr('attributes.device_class', 'eq', 'enum') \n | selectattr('last_changed', '<=', earliest_timestamp)\n | map(attribute='entity_id') | select('is_state','towards')\n | map('regex_replace','_(?=[^_]*$)(.*)', '')\n | list %}\n\n{% set distances = proximity_entities \n | expand \n | selectattr('attributes.device_class', 'eq', 'distance')\n | map(attribute='state')\n | reject('eq', 'unknown')\n | map('int')\n | select('<=', input_proximity_distance | int)\n | map('string')\n | list %}\n\n{% set entities_distances = proximity_entities \n | expand \n | selectattr('attributes.device_class', 'eq', 'distance')\n | selectattr('state', 'in', distances)\n | map(attribute='entity_id')\n | map('regex_replace','_(?=[^_]*$)(.*)', '')\n | list %}\n\n{% set towards_and_in_distance = entities_towards | select('in', entities_distances) | list | count > 0 %}\n{{ towards_and_in_distance }}\n",
  1220. "is_person_defined": "{{ input_persons | count > 0 or input_mode_guest != none }}",
  1221. "is_guest_mode": "{{ input_mode_guest != none and is_state(input_mode_guest, 'on') }}",
  1222. "is_anybody_home": "{% if is_guest_mode %}\n {{ true }}\n{% elif not is_person_defined %}\n {{ false }}\n{% else %}\n {% set on_time_delta = current_time_stamp | as_datetime - timedelta(**input_people_entering_home_duration) %}\n {% set off_time_delta = current_time_stamp | as_datetime - timedelta(**input_people_leaving_home_duration) %}\n\n {% set uptime_on = as_datetime(uptime) + timedelta(**input_people_entering_home_duration) %}\n {% set uptime_off = as_datetime(uptime) + timedelta(**input_people_leaving_home_duration) %}\n\n {% set result = false %}\n\n {% if uptime_on > on_time_delta or uptime_off > off_time_delta %}\n {{ input_persons | expand \n | selectattr('state', 'eq', 'home') \n | list \n | count > 0 }}\n {% else %}\n {% set persons_home = state_attr('zone.home','persons') | select('in', input_persons) | list %}\n\n {% set somebody_is_home = persons_home | expand\n | selectattr('last_changed', '<=', on_time_delta)\n | list\n | count > 0 %}\n\n {% set somebody_is_leaving = persons_home | count == 0 and ['zone.home'] | expand | map(attribute='last_changed') | first | default(off_time_delta) > off_time_delta %}\n\n {{ somebody_is_home or somebody_is_leaving }}\n {% endif %}\n{% endif %}\n",
  1223. "is_anybody_home_or_proximity": "{{ is_anybody_home or state_proximity_way_home or state_proximity_arrived}}",
  1224. "active_scheduler": "{% set selected_scheduler = none %} {% set schedules_count = input_schedulers | count %}\n{% if schedules_count == 0 %}\n {% set selected_scheduler = none %}\n{% elif schedules_count == 1 or input_scheduler_selector == none %}\n {% set selected_scheduler = input_schedulers | first %}\n{% elif schedules_count > 1 %}\n {% set selector_value = states(input_scheduler_selector) %}\n\n {% if is_number(selector_value) %}\n {% set selector_value = iif(selector_value | int > schedules_count, schedules_count, selector_value) %}\n {% set selector_value = iif(selector_value | int <= 0, 1, selector_value) %}\n {% set selected_scheduler = input_schedulers[selector_value | int - 1] %}\n {% elif selector_value in ['on','off'] %}\n {% set selected_scheduler = iif(selector_value == 'off', input_schedulers[0], input_schedulers[1]) %}\n {% else %}\n {% set selected_scheduler = input_schedulers | expand | selectattr('attributes.friendly_name', 'eq', selector_value) | map(attribute='entity_id') | first | default(none) %}\n {% if (selected_scheduler == none) %}\n {% set selected_scheduler = input_schedulers | expand | selectattr('attributes.friendly_name', 'search', '(?i)' + selector_value) | map(attribute='entity_id') | first | default(none) %}\n {% endif %}\n {% endif %}\n{% endif %}\n{{ selected_scheduler }}\n",
  1225. "is_scheduler_defined": "{{ active_scheduler != none }}",
  1226. "state_scheduler": "{{ active_scheduler != none and is_state(active_scheduler,'on') }}",
  1227. "is_presence_sensor_defined": "{{ input_presence_sensor != none }}",
  1228. "is_presence_scheduler_defined": "{{ input_scheduler_presence != none }}",
  1229. "state_presence_scheduler": "{{ is_presence_scheduler_defined and is_state(input_scheduler_presence, 'on') }}",
  1230. "state_presence_sensor": "{% if not is_presence_sensor_defined %}\n {{ false }}\n{% else %}\n {% set last_changed = [input_presence_sensor] | expand | map(attribute='last_changed') | first %}\n {% set sensor_state = is_state(input_presence_sensor, 'on') %}\n {% set reaction_time = iif(sensor_state, input_presence_reaction_on_time, input_presence_reaction_off_time) %}\n {% set min_timestamp = last_changed + timedelta(**reaction_time) %}\n {% set current_ts = current_time_stamp | as_datetime%}\n\n {% if is_uptime_defined and as_datetime(uptime) + timedelta(**reaction_time) > current_ts - timedelta(**reaction_time) %}\n {{ sensor_state }}\n {% else %}\n {% set is_limit = min_timestamp <= current_ts %}\n\n {{ (sensor_state == true and is_limit) or (sensor_state == false and not is_limit) }}\n {% endif %}\n{% endif %}\n",
  1231. "state_presence": "{{ iif(is_presence_scheduler_defined, state_presence_scheduler and state_presence_sensor, state_presence_sensor) }}\n",
  1232. "is_force_max_temperature": "{{ input_force_max_temperature != [] and is_state(input_force_max_temperature, 'on') }}",
  1233. "is_force_eco_temperature": "{{ input_force_eco_temperature != [] and is_state(input_force_eco_temperature, 'on') }}",
  1234. "active_party_entity": "{{ input_mode_party | expand | selectattr('state', 'in', ['active','on']) | map(attribute='entity_id') | first | default(none) }}",
  1235. "state_party": "{{ active_party_entity != none }}",
  1236. "party_temp": "{% set pos_party_temp = none %} {% if state_party == true %}\n {% set name = state_attr(active_party_entity,'friendly_name') %}\n {% set pos_temp = name.split(' ') | last %}\n {% if is_number(pos_temp) %}\n {% set pos_party_temp = pos_temp | float %}\n {% endif %}\n{% endif %} {{ pos_party_temp }}\n",
  1237. "is_away": "{% if is_person_defined and not is_anybody_home_or_proximity %}\n {{ (is_scheduler_away_mode and state_scheduler) or (is_presence_away_mode and state_presence_scheduler and not state_presence) }}\n{% elif presence_ignor_people and is_presence_away_mode %}\n {{ state_presence_scheduler and not state_presence }}\n{% elif is_presence_away_mode and is_person_defined and is_anybody_home_or_proximity and not presence_ignor_people %}\n {{ not state_presence }}\n{% else %}\n {{ false }}\n{% endif %}\n",
  1238. "state_window": "{% set current_ts = current_time_stamp | as_datetime %} {% set on_time_delta = current_ts - timedelta(**input_windows_reaction_time_open) %} {% set off_time_delta = current_ts - timedelta(**input_windows_reaction_time_close) %}\n{% set has_open_windows = input_windows \n | expand\n | selectattr('state', 'in', ['on','open','tilted'])\n | selectattr('last_changed', '<=', on_time_delta)\n | list\n | count > 0 %}\n\n{% set closed_but_not_in_duration = input_windows \n | expand\n | selectattr('state', 'in', ['off','closed'])\n | selectattr('last_changed', '>=', off_time_delta)\n | list\n | count > 0 %}\n\n{{ has_open_windows or closed_but_not_in_duration }}\n",
  1239. "is_aggressive_mode": "{{ input_aggressive_mode_offset > 0 }}",
  1240. "is_aggressive_mode_calibration": "{{ is_aggressive_mode and input_aggressive_mode_calibration and valid_temperature_sensor }}",
  1241. "is_frost_protection": "{% set frost_protection_timestamp = as_datetime(current_time_stamp) - timedelta(**input_frost_protection_duration) %} {% if frost_protection_timestamp == as_datetime(current_time_stamp) %}\n {{ false }}\n{% else %}\n {% set relevant_entities = [input_presence_sensor] + [input_mode_guest] + input_persons %}\n {% set relevant_entities_count = relevant_entities | reject('eq',none) | list | count %}\n\n {% if relevant_entities_count > 0 %}\n\n {% set presence_count = [input_presence_sensor] \n | reject('eq',none)\n | reject('is_state','on')\n | expand \n | selectattr('last_changed', '<=', frost_protection_timestamp)\n | list | count %}\n\n {% set persons_count = input_persons\n | reject('eq',none)\n | reject('is_state','home')\n | expand\n | selectattr('last_changed', '<=', frost_protection_timestamp)\n | list | count %}\n\n {% set guest_mode_count = [input_mode_guest] \n | reject('eq',none)\n | reject('is_state','on')\n | expand \n | selectattr('last_changed', '<=', frost_protection_timestamp)\n | list | count %}\n\n {{ presence_count + guest_mode_count + persons_count == relevant_entities_count }}\n {% else %}\n {{ false }}\n {% endif %}\n{% endif %}\n",
  1242. "is_liming_protection": "{% if not input_liming_protection%}\n {{ false }}\n{% else %}\n {% set enable_liming = true %}\n {% if input_mode_winter != none %}\n {% set enable_liming = is_state(input_mode_winter,'on') or input_liming_in_winter %}\n {% endif %}\n\n {% set current_timestamp = now() %}\n\n {% set is_liming_day = input_liming_protection_day == as_datetime(current_timestamp).strftime('%a') %}\n\n {% set start_hour = input_liming_protection_time.split(':')[0] | int %}\n {% set start_minute = input_liming_protection_time.split(':')[1] | int %}\n\n {% set today_start = as_datetime(current_timestamp).replace(second=0,microsecond=0,hour=start_hour,minute=start_minute) %}\n {% set today_end = as_datetime(current_timestamp).replace(second=0,microsecond=0,hour=start_hour,minute=start_minute) + timedelta(minutes=input_liming_protection_duration | int) %}\n\n {% set is_liming_time = as_datetime(current_timestamp) >= today_start and as_datetime(current_timestamp) <= today_end %}\n\n {{ enable_liming and is_liming_day and is_liming_time }}\n{% endif %}\n",
  1243. "valves": "{{ input_trvs | expand\n | selectattr('attributes.hvac_modes','search','(?i)'+input_hvac_mode) \n | map(attribute='entity_id') \n | list }}\n",
  1244. "valves_unsupported": "{{ input_trvs | reject('in',valves) | list }}\n",
  1245. "valves_off_mode": "{{ valves | expand | selectattr('attributes.hvac_modes','search','(?i)off') \n | map(attribute='entity_id') \n | list }}\n",
  1246. "valves_without_off_mode": "{{ valves | reject('in',valves_off_mode) | list }}\n",
  1247. "valves_tado": "{{ valves | select('is_device_attr', 'manufacturer', 'Tado') | list }}",
  1248. "valves_xiaomi_xiaomi": "{{ valves | select('is_device_attr', 'manufacturer', 'Xiaomi') | list }}",
  1249. "valves_xiaomi_aqara": "{{ valves | select('is_device_attr', 'manufacturer', 'Aqara') | list }}",
  1250. "valves_xiaomi": "{{ valves_xiaomi_xiaomi + valves_xiaomi_aqara }}",
  1251. "valves_danfoss": "{{ valves | select('is_device_attr', 'manufacturer', 'Danfoss') | list }}",
  1252. "valves_popp": "{{ valves | select('is_device_attr', 'manufacturer', 'Popp') | list }}",
  1253. "valves_hive": "{{ valves | select('is_device_attr', 'manufacturer', 'Hive') | list }}",
  1254. "valves_dph": "{{ valves_danfoss + valves_popp + valves_hive }}",
  1255. "valves_calibration_common": "{{ valves | reject('in', valves_tado + valves_dph + valves_xiaomi) | list }}",
  1256. "last_comfort_entity_change": "{{ [input_temperature_comfort_entity] | expand | map(attribute='last_changed') | list | first | default(none) }}",
  1257. "last_eco_entity_change": "{{ [input_temperature_eco_entity] | expand | map(attribute='last_changed') | list | first | default(none) }}",
  1258. "latest_entry_today": "{% set scheduler_name = none %} {% if active_scheduler != none %}\n {% set scheduler_name = state_attr(active_scheduler,'friendly_name') %}\n{% endif %}\n{% set current_ts = current_time_stamp | as_datetime %}\n{% set current_day = current_ts.strftime('%a') %} {% set current_time = current_ts.strftime('%H:%M') %}\n{% set plan = input_adjustments | rejectattr('time', 'undefined') \n | selectattr('time','<=', current_time| string)\n | list %}\n\n{% set selected_entries_days_and_schedule = plan | rejectattr('days','==',Undefined) | selectattr('days','search',current_day) \n | rejectattr('scheduler','==',Undefined) | selectattr('scheduler','in',scheduler_name) \n | list %}\n\n{% set selected_entries_days = plan | rejectattr('days','==',Undefined) | selectattr('days','search',current_day) \n | selectattr('scheduler','in',[Undefined])\n | list %}\n\n{% set selected_entries_schedule = plan | rejectattr('scheduler','==',Undefined) | selectattr('scheduler','in',scheduler_name) \n | selectattr('days','in',[Undefined])\n | list %}\n\n{% set selected_entries_time_only = plan | selectattr('days','in',[Undefined]) \n | selectattr('scheduler','in',[Undefined]) \n | list %}\n\n{% set selected_entries = selected_entries_days_and_schedule + selected_entries_days + selected_entries_schedule + selected_entries_time_only %}\n{% if selected_entries | count > 0%}\n {{ selected_entries | sort(attribute='time', reverse = true) | first }}\n{% else %}\n {{ none }}\n{% endif %}\n",
  1259. "latest_entry_day_before": "{% set timestamp = as_datetime(current_time_stamp).replace(hour=23,minute=59) + timedelta(days=-1) %}\n{% set scheduler_name = none %} {% if active_scheduler != none %}\n {% set scheduler_name = state_attr(active_scheduler,'friendly_name') %}\n{% endif %}\n{% set current_day = timestamp.strftime('%a') %} {% set current_time = timestamp.strftime('%H:%M') %}\n{% set plan = input_adjustments | rejectattr('time', 'undefined') \n | selectattr('time','<=', current_time| string)\n | list %}\n\n{% set selected_entries_days_and_schedule = plan | rejectattr('days','==',Undefined) | selectattr('days','search',current_day) \n | rejectattr('scheduler','==',Undefined) | selectattr('scheduler','in',scheduler_name) \n | list %}\n\n{% set selected_entries_days = plan | rejectattr('days','==',Undefined) | selectattr('days','search',current_day) \n | selectattr('scheduler','in',[Undefined])\n | list %}\n\n{% set selected_entries_schedule = plan | rejectattr('scheduler','==',Undefined) | selectattr('scheduler','in',scheduler_name) \n | selectattr('days','in',[Undefined])\n | list %}\n\n{% set selected_entries_time_only = plan | selectattr('days','in',[Undefined]) \n | selectattr('scheduler','in',[Undefined]) \n | list %}\n\n{% set selected_entries = selected_entries_days_and_schedule + selected_entries_days + selected_entries_schedule + selected_entries_time_only %}\n{% if selected_entries | count > 0%}\n {{ selected_entries | sort(attribute='time', reverse = true) | first }}\n{% else %}\n {{ none }}\n{% endif %}\n",
  1260. "entry": "{{ iif(latest_entry_today != none, latest_entry_today, latest_entry_day_before) }}",
  1261. "entry_time": "{% if entry != none %}\n {% set entry_hour = entry['time'].split(':')[0] | int %}\n {% set entry_minute = entry['time'].split(':')[1] | int %}\n {{ as_datetime(current_time_stamp).replace(hour=entry_hour, minute=entry_minute, second=0, microsecond=0) + timedelta(days=iif(latest_entry_today == none,-1,0)) }}\n{% endif %}\n",
  1262. "entry_comfort_temp": "{% if entry != none and 'comfort' in entry.keys() and (last_comfort_entity_change == none or as_datetime(entry_time) > as_datetime(last_comfort_entity_change)) %}\n {% set entry_temp = entry['comfort']%} \n {% if is_number(entry_temp) %}\n {{ entry_temp }}\n {% elif states[entry_temp] != none %}\n {{ states(entry_temp) }}\n {% endif %}\n{% else %}\n {{ none }}\n{% endif %}\n",
  1263. "entry_eco_temp": "{% if entry != none and 'eco' in entry.keys() and (last_eco_entity_change == none or as_datetime(entry_time) > as_datetime(last_eco_entity_change)) %}\n {% set entry_temp = entry['eco']%} \n {% if is_number(entry_temp) %}\n {{ entry_temp }}\n {% elif states[entry_temp] != none %}\n {{ states(entry_temp) }}\n {% endif %}\n{% else %}\n {{ none }}\n{% endif %}\n",
  1264. "entry_calibration": "{% if entry != none and 'calibration' in entry.keys() %}\n {{ entry['calibration'] == 'on' }}\n{% else %}\n {{ true }}\n{% endif %}\n",
  1265. "entry_mode": "{% if entry != none and 'mode' in entry.keys() %}\n {{ entry['mode'] }}\n{% else %}\n {{ 'auto' }}\n{% endif %}\n",
  1266. "trigger_id_defined": "{{ trigger.id is defined }}",
  1267. "is_calibration_trigger": "{% if valves_dph | count > 0 and trigger_id_defined and trigger.id in ['calibration_popp_ping','calibration_popp_change'] %}\n {{ true }}\n{% elif is_aggressive_mode_calibration and trigger_id_defined and 'aggressive_mode' in trigger.id %}\n {{ true }}\n{% else %}\n {{ trigger_id_defined and 'calibration' in trigger.id and not trigger.id == 'calibration_aggressive_mode_thermostat_temp_change' }}\n{% endif %}\n",
  1268. "is_generic_calibration_trigger": "{{ is_calibration_trigger and input_calibration_generic }}",
  1269. "is_generic_calibration": "{{ is_generic_calibration_trigger and entry_calibration and valid_temperature_sensor }}",
  1270. "is_aggressive_mode_trigger": "{{ is_aggressive_mode and trigger_id_defined and 'aggressive_mode' in trigger.id }}",
  1271. "is_change_trigger": "{{ trigger_id_defined and \n 'temperature_change' in trigger.id and \n ('presence' in trigger.id or \n 'scheduler' in trigger.id or \n 'proximity' in trigger.id or \n 'person' in trigger.id or\n '_ds' in trigger.id)\n and not trigger.id == 'temperature_change_valve_target' }}\n",
  1272. "set_max_temperature": "{{ is_force_max_temperature or is_liming_protection }}",
  1273. "is_pysical_change": "{{ trigger_id_defined \n and trigger.id == 'temperature_change_valve_target' \n and is_physical_change_enabled\n and not state_window\n and not set_max_temperature\n and not is_away }}\n",
  1274. "is_adjustment_trigger": "{{ trigger_id_defined and trigger.id == 'temperature_change_heating_adjustment' and (entry_comfort_temp != none or entry_eco_temp != none) }}",
  1275. "is_reset": "{{ (is_reset_temperature and is_change_trigger) or \n is_pysical_change or is_adjustment_trigger }}\n",
  1276. "is_changes_trigger": "{% if state_window %}\n {% if trigger_id_defined and 'temperature_change_window_on' in trigger.id %}\n {{ true }}\n {% elif trigger_id_defined and 'temperature_change_window_off' not in trigger.id %}\n {{ false }}\n {% endif %}\n{% elif trigger.platform == none %}\n {{ true }}\n{% elif trigger_id_defined and trigger.id == 'temperature_change_valve_target' %}\n {{ false }}\n{% elif is_heat_only_if_below_real_temp and trigger_id_defined and 'above_temp' in trigger.id %}\n {{ true }}\n{% elif is_aggressive_mode_calibration and is_aggressive_mode_trigger %}\n {{ false }}\n{% elif is_aggressive_mode_trigger %}\n {{ true }}\n{% elif is_generic_calibration %}\n {{ true }}\n{% else %}\n {{ trigger_id_defined and 'temperature_change' in trigger.id}}\n{% endif %}\n",
  1277. "is_scene_create_trigger": "{{ trigger_id_defined and ((\"window_on\" in trigger.id and not state_party) or (\"party_on\" in trigger.id and not state_window)) }}\n",
  1278. "is_scene_apply_trigger": "{{ trigger_id_defined and (\"window_off\" in trigger.id or \"party_off\" in trigger.id) and not is_legacy_restore and not (state_window or state_party) }}\n",
  1279. "is_scene_destroy_trigger": "{{ (is_change_trigger or trigger.id == 'temperature_change_heating_adjustment') and (state_window or state_party) }}\n",
  1280. "scene_entities": "{{ valves }}",
  1281. "scene_window_id": "{{ 'scene.' + this.entity_id | replace('automation.','') | replace('.','_') + '_window' }}",
  1282. "scene_party_id": "{{ 'scene.' + this.entity_id | replace('automation.','') | replace('.','_') + '_party' }}",
  1283. "scenes_all": "{{ [scene_window_id, scene_party_id] }}",
  1284. "scene_to_apply": "{% if is_scene_apply_trigger and \"window_off\" in trigger.id %}\n {{ scene_window_id }}\n{% elif is_scene_apply_trigger and \"party_off\" in trigger.id %}\n {{ scene_party_id }}\n{% else %}\n {{ none }}\n{% endif %}\n",
  1285. "scenes_to_destroy": "{% set scenes = [] %} {% if is_scene_destroy_trigger %}\n {% set scenes = iif(state_window, scenes + [scene_window_id], scenes) %}\n {% set scenes = iif(state_party, scenes + [scene_party_id], scenes) %}\n{% endif %} {{ scenes }}\n",
  1286. "scene_to_create": "{{ iif(is_scene_create_trigger and \"window_on\" in trigger.id, scene_window_id, scene_party_id) }}\n",
  1287. "set_comfort": "{% if is_force_max_temperature %}\n {{ true }}\n{% elif entry_mode == 'eco' %}\n {{ false }}\n{% elif entry_mode == 'comfort' %}\n {{ true }}\n{% elif state_party %}\n {{ true }}\n{% elif is_force_eco_temperature %}\n {{ false }}\n{% elif is_away %}\n {{ true }}\n{% elif not is_scheduler_defined and not is_presence_sensor_defined %}\n {{ is_anybody_home_or_proximity }}\n{% else %}\n {% set comfort_state = state_scheduler or state_presence %}\n\n {% if is_person_defined or is_proximity_defined %}\n {{ is_anybody_home_or_proximity and comfort_state }}\n {% else %}\n {{ comfort_state }}\n {% endif %}\n{% endif %}\n",
  1288. "mode": "{% if not state_ahc %}\n {{ 'off' }}\n{% elif state_window and input_window_open_temperature | int == 0 and not set_max_temperature %}\n {{ 'off' }}\n{% elif entry_mode == 'off' %}\n {{ 'off' }}\n{% elif is_off_instead_min and not set_comfort %} \n {{ 'off' }}\n{% elif is_off_if_nobody_home and is_person_defined and not is_anybody_home_or_proximity and not set_comfort %}\n {{ 'off' }}\n{% else %}\n {{ input_hvac_mode }}\n{% endif %}\n",
  1289. "temperature_comfort_of_entity": "{% if(input_temperature_comfort_entity != none) %}\n {{ states(input_temperature_comfort_entity) | float }}\n{% else %}\n {{ none }}\n{% endif %}\n",
  1290. "temperature_eco_of_entity": "{% if(input_temperature_eco_entity != none) %}\n {{ states(input_temperature_eco_entity) | float }}\n{% else %}\n {{ none }}\n{% endif %}\n",
  1291. "temperature_comfort": "{{ [entry_comfort_temp, temperature_comfort_of_entity, input_temperature_comfort_static] | reject('==', none) | first }}",
  1292. "temperature_away": "{{ temperature_comfort | float - input_away_offset }}",
  1293. "temperature_eco": "{{ [entry_eco_temp, temperature_eco_of_entity, input_temperature_eco_static] | reject('==', none) | first }}",
  1294. "target_temperature": "{% if state_window and input_window_open_temperature > 0 %}\n {{ input_window_open_temperature }}\n{% elif state_party %}\n {{ iif(party_temp != none, party_temp, temperature_comfort) }}\n{% elif is_frost_protection %}\n {{ input_frost_protection_temp }}\n{% else %}\n {{ iif(set_comfort, iif(is_away, temperature_away, temperature_comfort), temperature_eco) }}\n{% endif %}\n",
  1295. "changes": "{% set n = namespace(dict=[]) %}\n{% set original_mode = mode %}\n{% if not is_changes_trigger %}\n {{ n.dict }}\n{% else %}\n {% for valve in input_trvs %}\n\n {% set current_valve_temp = state_attr(valve, 'current_temperature') | float(20) %}\n {% set current_valve_target_temp = state_attr(valve, 'temperature') | float(temperature) %}\n {% set current_valve_mode = states(valve) %}\n {% set min_temp = state_attr(valve, 'min_temp') | float(5) %}\n {% set max_temp = state_attr(valve, 'max_temp') | float(30) %}\n\n {% set valve_temp = target_temperature %}\n\n {% set dont_turn_off = \n valve in valves_without_off_mode or \n is_not_off_but_min or \n (state_window and input_window_open_temperature > 0) or\n set_max_temperature %}\n\n {% set ref_temp = current_valve_temp %}\n {% if valid_temperature_sensor %}\n {% set ref_temp = value_temperature_sensor | float(current_valve_temp) %}\n {% endif %}\n\n {% if is_heat_only_if_below_real_temp and iif(factor == 1, target_temperature <= ref_temp, target_temperature >= ref_temp) %}\n {% set mode = 'off' %}\n {% endif %}\n\n {% set valve_mode = iif(mode == 'off' and dont_turn_off, current_valve_mode, mode) %}\n\n {% if mode != 'off' %}\n\n {% if is_aggressive_mode and not is_aggressive_mode_calibration %}\n\n {% set temp_diff = valve_temp - ref_temp %}\n\n {% if temp_diff * factor < input_aggressive_mode_range * -1 %}\n {% set valve_temp = valve_temp - input_aggressive_mode_offset * factor %}\n {% elif temp_diff * factor > input_aggressive_mode_range %}\n {% set valve_temp = valve_temp + input_aggressive_mode_offset * factor %}\n {% endif %}\n\n {% endif %}\n\n {% if input_calibration_generic %}\n\n {% if current_valve_temp != ref_temp %}\n {% set offset = current_valve_temp - ref_temp %}\n\n {% set offset = iif(offset > float(input_generic_calibration_offset), input_generic_calibration_offset, offset) %}\n {% set offset = iif(offset < float(input_generic_calibration_offset) * -1, input_generic_calibration_offset * -1, offset) %}\n\n {% set temp_with_offset = float(valve_temp) + float(offset) %}\n {% set step = state_attr(valve, 'target_temp_step') | float(0.5) %}\n\n {% set temp_with_offset = (temp_with_offset | float(0) / float(step)) | round(0) * float(step) %}\n\n {% set valve_temp = iif(input_calibration_step_size == 'full', float(temp_with_offset) | round(), temp_with_offset | round(1)) %}\n\n {% endif %}\n {% endif %}\n\n {% endif %}\n\n {% if mode == 'off' and dont_turn_off %}\n {% set valve_temp = min_temp %}\n {% endif %}\n\n {% set valve_temp = iif(set_max_temperature, max_temp, valve_temp) %}\n {% set valve_temp = iif(valve_temp > max_temp, max_temp, valve_temp) %}\n {% set valve_temp = iif(valve_temp < min_temp, min_temp, valve_temp) %}\n\n {% if current_valve_mode != valve_mode or current_valve_target_temp != valve_temp %}\n {% set n.dict = n.dict + [(valve, [{'mode': valve_mode , 'temp': valve_temp}])] %}\n {% endif %}\n\n {% endfor %}\n\n {% set mode = original_mode %}\n\n {{ dict.from_keys(n.dict) }}\n{% endif %}\n",
  1296. "positioning": "{% set n = namespace(dict=[]) %}\n{% if input_valve_positioning_mode == 'off' %}\n {{ n.dict }}\n{% else %}\n {% for valve in input_trvs %}\n\n {% set current_temp = state_attr(valve, 'current_temperature') | float(none) %}\n {% if valid_temperature_sensor %}\n {% set current_temp = value_temperature_sensor | float(none) %}\n {% endif %}\n\n {% set target_temp = state_attr(valve, 'temperature') | float(none) %}\n\n {% set open_valve_entity = device_entities(device_id(valve)) | expand \n | selectattr('domain','in','number') \n | selectattr('entity_id', 'search', input_valve_opening_keyword)\n | map(attribute='entity_id') \n | list | first | default(none) %}\n\n {% if open_valve_entity != none and current_temp != none and target_temp != none and\n (\n (trigger_id_defined and trigger.id == 'positioning_event') or \n ([open_valve_entity] | expand | map(attribute='last_changed') | first) + timedelta(**input_valve_positioning_timeout) <= now()\n )\n %}\n\n {% set opening = 100 %}\n {% set difference = target_temp - current_temp %}\n {% set step_size = input_valve_positioning_step_size | int %}\n\n {% if input_fully_open_difference > 0 and not is_force_max_temperature %}\n\n {% set opening_regular = (100 / input_fully_open_difference) * difference %}\n {% set opening_pessimistic = sqrt(((100 / input_fully_open_difference) * difference) | abs) * 10 %}\n {% set opening_optimistic = ((100 / input_fully_open_difference) * difference)**2 / 100 %}\n\n {% set opening = opening_regular %}\n {% set opening = iif(input_valve_positioning_mode == 'pessimistic', opening_pessimistic, opening) %}\n {% set opening = iif(input_valve_positioning_mode == 'optimistic', opening_optimistic, opening) %}\n\n {% set opening = iif(difference >= input_fully_open_difference, 100, opening) %}\n {% set opening = iif(difference < 0, 0, opening) %}\n\n {% set opening = opening / 100 * input_valve_positioning_max_opening %}\n\n {% set opening = ((opening + step_size / 2) // step_size * step_size) | int %}\n {% endif %}\n\n {% set open_valve_entity_value = states(open_valve_entity) | int %}\n\n {% if open_valve_entity_value != opening %}\n {% set n.dict = n.dict + [(valve, [{'entity': open_valve_entity , 'value': opening, 'current_temp': current_temp, 'target_temp': target_temp, 'difference': difference}])] %}\n {% endif %}\n\n {% endif %}\n {% endfor %}\n\n {{ dict.from_keys(n.dict) }}\n{% endif %}\n",
  1297. "reset_data": "{% set result = [] %} {% if is_adjustment_trigger %}\n {% if entry_comfort_temp != none and input_temperature_comfort_entity != none %}\n {% set result = result + [{'entity': input_temperature_comfort_entity, 'temp': entry_comfort_temp}] %}\n {% endif %}\n {% if entry_eco_temp != none and input_temperature_eco_entity != none %}\n {% set result = result + [{'entity': input_temperature_eco_entity, 'temp': entry_eco_temp}] %}\n {% endif %}\n{% else %}\n {% set entity = none %}\n {% if is_reset and set_comfort %}\n {% set entity = iif(is_pysical_change, input_temperature_comfort_entity, input_temperature_eco_entity) %}\n {% elif is_reset and not set_comfort %}\n {% set entity = iif(is_pysical_change, input_temperature_eco_entity, input_temperature_comfort_entity) %}\n {% endif %}\n\n {% set temp_r = none %}\n {% if is_pysical_change %}\n {% set temp_r = state_attr(trigger.to_state.entity_id,'temperature') %}\n {% else %}\n {% set temp_r = iif(is_reset and entity == input_temperature_eco_entity, \n input_temperature_eco_static, input_temperature_comfort_static) %}\n {% endif %}\n\n {% if entity != none and temp_r != none %}\n {% set result = result + [{'entity': entity, 'temp': temp_r}] %}\n {% endif %}\n{% endif %}\n{{ result }}\n",
  1298. "is_reset_trigger": "{{ is_reset and reset_data | count > 0 }}",
  1299. "is_native_calibration": "{{ not input_calibration_generic and entry_calibration and valid_temperature_sensor }}",
  1300. "is_native_calibration_trigger": "{{ is_calibration_trigger and is_native_calibration }}",
  1301. "rounding_mode": "{% if is_number(input_calibration_step_size) or input_calibration_step_size == 'full' %}\n {{ 'manual' }}\n{% else %}\n {{ 'auto' }}\n{% endif %}\n",
  1302. "calibration_tado": "{% set n = namespace(dict=[]) %}\n{% if is_native_calibration_trigger %}\n {% for valve in valves_tado %}\n\n {% set offset_old = state_attr(valve, 'offset_celsius') | float(0) %}\n {% set local_temperature = state_attr(valve, 'current_temperature') | float %}\n {% set calibration_sensor_temperature = value_temperature_sensor | float %}\n \n {% set offset_new = (-(local_temperature - calibration_sensor_temperature) + offset_old) %}\n\n {% if is_aggressive_mode_calibration %} \n {% set temp_diff = state_attr(valve,'temperature') | float(target_temperature) - calibration_sensor_temperature %}\n\n {% if temp_diff * factor < input_aggressive_mode_range * -1 %}\n {% set offset_new = offset_new + input_aggressive_mode_offset * factor %}\n {% elif temp_diff * factor > input_aggressive_mode_range %}\n {% set offset_new = offset_new - input_aggressive_mode_offset * factor %}\n {% endif %}\n {% endif %}\n\n {% set t_min = -10.9 %}\n {% set t_max = 10.9 %}\n\n {% set offset_new = iif(offset_new > t_max, t_max, offset_new) %}\n {% set offset_new = iif(offset_new < t_min, t_min, offset_new) %}\n\n {% set offset_new = offset_new | round(1) %}\n\n {% if (float(offset_old) - float(offset_new)) | abs >= float(input_calibration_delta) %}\n {% set n.dict = n.dict + [(valve, [{'value': offset_new }])] %}\n {% endif %}\n\n {% endfor %}\n{% endif %}\n{{ dict.from_keys(n.dict) }}\n",
  1303. "calibration_xiaomi": "{% set n = namespace(dict=[]) %}\n{% if is_native_calibration_trigger %}\n {% for valve in valves_xiaomi %}\n\n {% set calibration_entities = device_entities(device_id(valve)) |\n expand | selectattr('domain','in','number') |\n selectattr('entity_id', 'search', input_calibration_key_word) |\n map(attribute='entity_id') | list %}\n\n {% if calibration_entities | count > 0 %}\n\n {% set calibration_entity = calibration_entities | first %}\n {% set offset_old = states(calibration_entity) | float(0) %}\n {% set offset_new = value_temperature_sensor | float %}\n \n {% set step = state_attr(calibration_entity, 'step') | float(1) %}\n {% if rounding_mode == 'manual' %} \n {% set step = input_calibration_step_size | float(1) %}\n {% endif %}\n\n {% set min_val = state_attr(calibration_entity,'min') | float(0) %}\n {% set max_val = state_attr(calibration_entity,'max') | float(55) %}\n \n {% if is_aggressive_mode_calibration %} \n {% set temp_diff = state_attr(valve,'temperature') | float(target_temperature) - value_temperature_sensor | float %}\n\n {% if temp_diff * factor < input_aggressive_mode_range * -1 %}\n {% set offset_new = offset_new + input_aggressive_mode_offset * factor %}\n {% elif temp_diff * factor > input_aggressive_mode_range %}\n {% set offset_new = offset_new - input_aggressive_mode_offset * factor %}\n {% endif %}\n {% endif %}\n\n {% set round_size = iif('.' in (step | string), (step | string).split('.')[1] | length, 0) %}\n {% set offset_new = ((offset_new | float(0) / step) | round(0) * step) | round(round_size) | float %}\n\n {% set offset_new = iif(offset_new > max_val, max_val, offset_new) %}\n {% set offset_new = iif(offset_new < min_val, min_val, offset_new) %}\n\n {% if (float(offset_old) - float(offset_new)) | abs >= float(input_calibration_delta) %}\n {% set n.dict = n.dict + [(calibration_entity, [{'value': offset_new, 'valve': valve}])] %}\n {% endif %}\n {% endif %}\n\n {% endfor %}\n{% endif %}\n{{ dict.from_keys(n.dict) }}\n",
  1304. "calibration_dph": "{% set n = namespace(dict=[]) %} {% if is_native_calibration_trigger %}\n\n {% for valve in valves_dph %}\n\n {% set calibration_entities = device_entities(device_id(valve)) |\n expand | selectattr('domain','in','number') |\n selectattr('entity_id', 'search', input_calibration_key_word) |\n map(attribute='entity_id') | list %}\n\n {% if calibration_entity != calibration_entities | count > 0 %}\n\n {% set calibration_entity = calibration_entities | first %}\n\n {% set min_val = state_attr(calibration_entity,'min')%}\n {% set max_val = state_attr(calibration_entity,'max')%}\n \n {% set step = state_attr(calibration_entity, 'step') | float(1) %}\n {% if rounding_mode == 'manual' %} \n {% set step = input_calibration_step_size | float(1) %}\n {% endif %}\n\n {% set current_temp = state_attr(valve,'current_temperature') | float(20) %}\n\n {% set new_state = value_temperature_sensor | float(current_temp) %}\n {% set old_state = states(calibration_entity) | float %}\n\n {% if is_aggressive_mode_calibration %} \n {% set temp_diff = state_attr(valve,'temperature') | float(target_temperature) - value_temperature_sensor | float %}\n\n {% if temp_diff * factor < input_aggressive_mode_range * -1 %}\n {% set new_state = new_state + input_aggressive_mode_offset * factor %}\n {% elif temp_diff * factor > input_aggressive_mode_range %}\n {% set new_state = new_state - input_aggressive_mode_offset * factor %}\n {% endif %}\n {% endif %}\n\n {% if step <= 1 and max_val | string | count < 4 %}\n {% set round_size = iif('.' in (step | string), (step | string).split('.')[1] | length, 0) %}\n {% set new_state = ((new_state | float(0) / step) | round(0) * step) | round(round_size) | float %}\n {% else %}\n {% set new_state = new_state * 100 | int %}\n {% set old_state = old_state | int %}\n {% endif %}\n\n {% set update_calibration = old_state != new_state %}\n\n {% if is_calibration_trigger and not update_calibration %}\n {% set last_updated = [calibration_entity] | expand | map(attribute='last_updated') | first %}\n {% set update_calibration = as_datetime(current_time_stamp) - timedelta(minutes=20) >= last_updated %}\n {% endif %}\n\n {% if update_calibration %}\n {% set n.dict = n.dict + [(calibration_entity, [{'value': new_state, 'valve': valve}])] %}\n {% endif%}\n\n {% endif %}\n\n {% endfor %}\n{% endif %}\n{{ dict.from_keys(n.dict) }}\n",
  1305. "calibration_common": "{% set n = namespace(dict=[]) %}\n{% if is_native_calibration_trigger %}\n\n {% for valve in valves_calibration_common %}\n\n {% set calibration_entities = device_entities(device_id(valve)) |\n expand | selectattr('domain','in','number') |\n selectattr('entity_id', 'search', input_calibration_key_word) |\n map(attribute='entity_id') | list %}\n\n {% if calibration_entities | count > 0%}\n\n {% set calibration_entity = calibration_entities | first %}\n \n {% set step = state_attr(calibration_entity, 'step') | float(1) %}\n {% if rounding_mode == 'manual' %} \n {% set step = input_calibration_step_size | float(1) %}\n {% endif %}\n\n {% set min_calibration_value = state_attr(calibration_entity,'min') | float %}\n {% set max_calibration_value = state_attr(calibration_entity,'max') | float %}\n {% set thermostat_temperature = state_attr(valve, 'current_temperature') | float %}\n {% set offset_old = states(calibration_entity) | float(0) %}\n\n {% set new_calibration_value = (-(thermostat_temperature - value_temperature_sensor) + offset_old) %}\n\n {% if is_aggressive_mode_calibration %} \n {% set temp_diff = state_attr(valve,'temperature') | float(target_temperature) - value_temperature_sensor %}\n\n {% if temp_diff * factor < input_aggressive_mode_range * -1 %}\n {% set new_calibration_value = new_calibration_value + input_aggressive_mode_offset * factor %}\n {% elif temp_diff * factor > input_aggressive_mode_range %}\n {% set new_calibration_value = new_calibration_value - input_aggressive_mode_offset * factor %}\n {% endif %}\n {% endif %}\n\n {% set new_calibration_value = iif(new_calibration_value > max_calibration_value, max_calibration_value, new_calibration_value) %}\n {% set new_calibration_value = iif(new_calibration_value < min_calibration_value, min_calibration_value, new_calibration_value) %}\n\n {% set round_size = iif('.' in (step | string), (step | string).split('.')[1] | length, 0) %}\n\n {% set offset_new = ((new_calibration_value | float(0) / step) | round(0) * step) | round(round_size) | float %}\n\n {% if (float(offset_old) - float(offset_new)) | abs >= float(input_calibration_delta) %}\n {% set n.dict = n.dict + [(calibration_entity, [{'value': offset_new, 'valve': valve}])] %}\n {% endif %}\n\n {% endif %}\n\n {% endfor %}\n{% endif %}\n{{ dict.from_keys(n.dict) }}\n",
  1306. "calibration_value_set": "{{ dict(dict(calibration_xiaomi, **calibration_dph),**calibration_common) }}",
  1307. "no_changes": "{{ \n (input_persons | count == 0 and \n input_mode_guest == none and \n input_schedulers | count == 0 and \n input_presence_sensor == none and \n input_proximity == none) or\n (is_temperature_sensor_defined and not valid_temperature_sensor)\n}}\n",
  1308. "scene_trigger": "{{ is_scene_create_trigger or is_scene_apply_trigger or is_scene_destroy_trigger }}",
  1309. "change_trigger": "{{ is_changes_trigger and not scene_trigger and changes | count > 0 and not no_changes}}",
  1310. "reset_trigger": "{{ is_reset_trigger and not no_changes }}",
  1311. "calibration_trigger": "{{ is_calibration_trigger and not input_calibration_generic and (calibration_value_set | count > 0 or calibration_tado | count > 0) }}",
  1312. "positioning_trigger": "{{ positioning | count > 0 }}",
  1313. "automation_name": "{{ state_attr(this.entity_id,'friendly_name') }}",
  1314. "warnings": "{% set messages = [] %} {% if not is_uptime_defined %}\n {% set messages = messages + ['To make Advance Heating Control work properly just setup the uptime integration (https://www.home-assistant.io/integrations/uptime/)'] %}\n{% elif is_aggressive_mode and not input_aggressive_mode_calibration and is_physical_change_enabled %}\n {% set messages = messages + ['Aggressive Mode in combination with physical change / sync feature is not recommended. Expect unwanted side effects.'] %}\n{% elif is_generic_calibration and is_physical_change_enabled %}\n {% set messages = messages + ['Generic Calibration in combination with physical change / sync feature is not recommended. Expect unwanted side effects.'] %}\n{% elif valves_unsupported | count > 0 %}\n {% set messages = messages + ['Unsupported climate entities: ' + valves_unsupported | join(',') | string ] %}\n{% elif is_temperature_sensor_defined and not valid_temperature_sensor %}\n {% set messages = messages + ['The temperature sensor' + input_temperature_sensor + ' has an invalid state: ' + states(input_temperature_sensor) ] %}\n{% endif %}\n{{ messages }}\n",
  1315. "climates_information": "{% set n = namespace(dict=[]) %}\n{% for valve in input_trvs %}\n {% set temperature = state_attr(valve,'temperature') %}\n {% set current_temperature = state_attr(valve,'current_temperature') %}\n {% set state = states(valve) %}\n {% set n.dict = n.dict + [{'entity_id': valve, 'state': state, 'temperature': temperature, 'current_temperature': current_temperature}] %}\n{% endfor %}\n{{ n.dict }}\n"
  1316. },
  1317. "conditions": [
  1318. {
  1319. "condition": "or",
  1320. "conditions": [
  1321. {
  1322. "condition": "template",
  1323. "value_template": "{{ calibration_trigger }}"
  1324. },
  1325. {
  1326. "condition": "template",
  1327. "value_template": "{{ scene_trigger }}"
  1328. },
  1329. {
  1330. "condition": "template",
  1331. "value_template": "{{ change_trigger }}"
  1332. },
  1333. {
  1334. "condition": "template",
  1335. "value_template": "{{ reset_trigger }}"
  1336. },
  1337. {
  1338. "condition": "template",
  1339. "value_template": "{{ positioning_trigger }}"
  1340. }
  1341. ]
  1342. }
  1343. ],
  1344. "actions": [
  1345. {
  1346. "variables": {
  1347. "is_delayed": "{{ not (not is_uptime_defined or (now() | as_datetime - states(up_time_sensor) | as_datetime) > timedelta(**input_startup_delay)) }}"
  1348. }
  1349. },
  1350. {
  1351. "action": "system_log.write",
  1352. "data": {
  1353. "message": "{{ 'AHC - ' + automation_name | string + ' \\n ' + 'automation delayed: ' + is_delayed | string }}\n",
  1354. "level": "debug",
  1355. "logger": "blueprints.panhans.heatingcontrol"
  1356. }
  1357. },
  1358. {
  1359. "wait_template": "{{ not is_uptime_defined or (now() | as_datetime - states(up_time_sensor) | as_datetime) > timedelta(**input_startup_delay) }}\n"
  1360. },
  1361. {
  1362. "choose": [
  1363. {
  1364. "conditions": "{{ is_delayed }}",
  1365. "sequence": [
  1366. {
  1367. "event": "ahc_delay_event",
  1368. "event_data": {
  1369. "automation": "{{ this.entity_id }}"
  1370. }
  1371. }
  1372. ]
  1373. }
  1374. ],
  1375. "default": [
  1376. {
  1377. "if": [
  1378. {
  1379. "condition": "template",
  1380. "value_template": "{{ warnings | count > 0 }}"
  1381. }
  1382. ],
  1383. "then": [
  1384. {
  1385. "action": "system_log.write",
  1386. "data": {
  1387. "level": "warning",
  1388. "logger": "blueprints.panhans.heatingcontrol",
  1389. "message": "{{ 'AHC-Warnings - ' + automation_name + ':\\n' + warnings | join('\\n') }}\n"
  1390. }
  1391. }
  1392. ]
  1393. },
  1394. {
  1395. "event": "ahc_event",
  1396. "event_data": {
  1397. "state": "{{ state_ahc }}",
  1398. "mode": "{{ iif(set_comfort == true, 'comfort', 'eco') }}",
  1399. "automation": "{{ this.entity_id }}",
  1400. "is_person_defined": "{{ is_person_defined }}",
  1401. "is_anybody_home": "{{ is_anybody_home }}",
  1402. "is_proximity_defined": "{{ is_proximity_defined }}",
  1403. "is_anybody_home_or_proximity": "{{ is_anybody_home_or_proximity }}",
  1404. "is_guest_mode": "{{ is_guest_mode }}",
  1405. "active_scheduler": "{{ active_scheduler }}",
  1406. "state_scheduler": "{{ state_scheduler }}",
  1407. "state_presence_sensor": "{{ state_presence_sensor }}",
  1408. "state_presence_scheduler": "{{ state_presence_scheduler }}",
  1409. "state_presence": "{{ state_presence }}",
  1410. "state_proximity_arrived": "{{ state_proximity_arrived }}",
  1411. "state_proximity_way_home": "{{ state_proximity_way_home }}",
  1412. "is_force_max_temperature": "{{ is_force_max_temperature }}",
  1413. "is_force_eco_temperature": "{{ is_force_eco_temperature }}",
  1414. "active_party_entity": "{{ active_party_entity }}",
  1415. "party_temp": "{{ party_temp }}",
  1416. "is_away": "{{ is_away }}",
  1417. "state_window": "{{ state_window }}",
  1418. "is_aggressive_mode": "{{ is_aggressive_mode }}",
  1419. "is_frost_protection": "{{ is_frost_protection }}",
  1420. "is_liming_protection": "{{ is_liming_protection }}",
  1421. "state_outside_temp": "{{ state_outside_temp }}",
  1422. "entry_time": "{{ entry_time }}",
  1423. "thermostats": "{{ input_trvs }}",
  1424. "hvac_mode": "{{ mode }}",
  1425. "temperature_comfort": "{{ temperature_comfort }}",
  1426. "temperature_eco": "{{ temperature_eco }}",
  1427. "target_temperature": "{{ target_temperature }}",
  1428. "set_max_temperature": "{{ set_max_temperature }}",
  1429. "last_trigger_id": "{{ iif(trigger_id_defined, trigger.id, '') }}",
  1430. "calibration_trigger": "{{ is_generic_calibration_trigger or calibration_trigger }}",
  1431. "change_trigger": "{{ change_trigger }}",
  1432. "warnings": "{{ warnings | count > 0 }}"
  1433. }
  1434. },
  1435. {
  1436. "if": [
  1437. {
  1438. "condition": "template",
  1439. "value_template": "{{ calibration_trigger }}"
  1440. },
  1441. {
  1442. "condition": "and",
  1443. "conditions": null
  1444. }
  1445. ],
  1446. "then": [
  1447. {
  1448. "action": "system_log.write",
  1449. "data": {
  1450. "message": "{{ 'AHC - Calibration - ' + automation_name | string + ' \\n ' + 'calibration data set: ' + calibration_value_set | string }}\n",
  1451. "level": "debug",
  1452. "logger": "blueprints.panhans.heatingcontrol"
  1453. }
  1454. },
  1455. {
  1456. "repeat": {
  1457. "count": "{{ calibration_value_set | count | int }}",
  1458. "sequence": [
  1459. {
  1460. "variables": {
  1461. "index": "{{ repeat.index-1 }}",
  1462. "calibration_entity": "{{ (calibration_value_set.keys() | list) [index] }}",
  1463. "thermostat": "{{ (((calibration_value_set.values() | list) [index]) | first) ['valve'] }}",
  1464. "offset": "{{ (((calibration_value_set.values() | list) [index]) | first) ['value'] }}",
  1465. "select_entity": "{{ device_entities(device_id(thermostat)) | expand | selectattr('domain','in','select') | selectattr('attributes.options', 'contains', 'external') | map(attribute='entity_id') | list | first | default(none) }}"
  1466. }
  1467. },
  1468. {
  1469. "action": "system_log.write",
  1470. "data": {
  1471. "message": "{{ 'AHC - Calibration - ' + automation_name | string + ' \\n ' + 'calibration entity: ' + calibration_entity | string + ' \\n ' + 'offset: ' + offset | string }}\n",
  1472. "level": "debug",
  1473. "logger": "blueprints.panhans.heatingcontrol"
  1474. }
  1475. },
  1476. {
  1477. "if": [
  1478. {
  1479. "condition": "template",
  1480. "value_template": "{{ thermostat in valves_xiaomi }}"
  1481. },
  1482. {
  1483. "condition": "template",
  1484. "value_template": "{{ select_entity != none and not is_state(select_entity, 'external') }}"
  1485. }
  1486. ],
  1487. "then": [
  1488. {
  1489. "action": "select.select_option",
  1490. "target": {
  1491. "entity_id": "{{ select_entity }}"
  1492. },
  1493. "data": {
  1494. "option": "external"
  1495. }
  1496. },
  1497. {
  1498. "delay": {
  1499. "hours": 0,
  1500. "minutes": 0,
  1501. "seconds": 2
  1502. }
  1503. }
  1504. ]
  1505. },
  1506. {
  1507. "action": "number.set_value",
  1508. "data": {
  1509. "value": "{{ float(offset) }}"
  1510. },
  1511. "target": {
  1512. "entity_id": "{{ calibration_entity }}"
  1513. }
  1514. },
  1515. {
  1516. "delay": {
  1517. "hours": 0,
  1518. "minutes": 0,
  1519. "seconds": 2
  1520. }
  1521. }
  1522. ]
  1523. }
  1524. },
  1525. {
  1526. "repeat": {
  1527. "count": "{{ calibration_tado | count | int }}",
  1528. "sequence": [
  1529. {
  1530. "variables": {
  1531. "index": "{{ repeat.index-1 }}",
  1532. "thermostat": "{{ (calibration_tado.keys() | list) [index] }}",
  1533. "offset": "{{ (((calibration_tado.values() | list) [index]) | first) ['value'] }}"
  1534. }
  1535. },
  1536. {
  1537. "action": "{{ 'tado.set_climate_temperature_offset' }}",
  1538. "data": {
  1539. "offset": "{{ offset }}",
  1540. "entity_id": "{{ thermostat }}"
  1541. }
  1542. },
  1543. {
  1544. "delay": {
  1545. "hours": 0,
  1546. "minutes": 0,
  1547. "seconds": 2
  1548. }
  1549. }
  1550. ]
  1551. }
  1552. }
  1553. ]
  1554. },
  1555. {
  1556. "if": [
  1557. {
  1558. "condition": "template",
  1559. "value_template": "{{ positioning_trigger }}"
  1560. }
  1561. ],
  1562. "then": [
  1563. {
  1564. "repeat": {
  1565. "count": "{{ positioning | count | int }}",
  1566. "sequence": [
  1567. {
  1568. "variables": {
  1569. "index": "{{ repeat.index-1 }}",
  1570. "thermostat": "{{ (positioning.keys() | list) [index] }}",
  1571. "positioning_value": "{{ (((positioning.values() | list) [index]) | first) ['value'] }}",
  1572. "positioning_entity": "{{ (((positioning.values() | list) [index]) | first) ['entity'] }}"
  1573. }
  1574. },
  1575. {
  1576. "action": "system_log.write",
  1577. "data": {
  1578. "message": "{{ 'AHC - Positioning - ' + automation_name | string + ' \\n ' + 'entity: ' + positioning_entity | string + ' \\n ' + 'value: ' + positioning_value | string }}\n",
  1579. "level": "debug",
  1580. "logger": "blueprints.panhans.heatingcontrol"
  1581. }
  1582. },
  1583. {
  1584. "action": "number.set_value",
  1585. "data": {
  1586. "value": "{{ positioning_value | int }}"
  1587. },
  1588. "target": {
  1589. "entity_id": "{{ positioning_entity }}"
  1590. }
  1591. },
  1592. {
  1593. "delay": {
  1594. "hours": 0,
  1595. "minutes": 0,
  1596. "seconds": 2
  1597. }
  1598. }
  1599. ]
  1600. }
  1601. }
  1602. ]
  1603. },
  1604. {
  1605. "if": [
  1606. {
  1607. "condition": "template",
  1608. "value_template": "{{ is_scene_create_trigger }}"
  1609. },
  1610. {
  1611. "condition": "template",
  1612. "value_template": "{{ states[scene_to_create] == none }}"
  1613. }
  1614. ],
  1615. "then": [
  1616. {
  1617. "action": "scene.create",
  1618. "data": {
  1619. "snapshot_entities": "{{ scene_entities }}",
  1620. "scene_id": "{{ scene_to_create.split('.')[1] }}"
  1621. }
  1622. }
  1623. ]
  1624. },
  1625. {
  1626. "if": [
  1627. {
  1628. "condition": "template",
  1629. "value_template": "{{ is_scene_destroy_trigger }}"
  1630. },
  1631. {
  1632. "condition": "template",
  1633. "value_template": "{{ scenes_to_destroy | count > 0 }}"
  1634. }
  1635. ],
  1636. "then": [
  1637. {
  1638. "repeat": {
  1639. "count": "{{ scenes_to_destroy | count | int }}",
  1640. "sequence": [
  1641. {
  1642. "variables": {
  1643. "scene_to_destroy": "{{ scenes_to_destroy[repeat.index-1] }}"
  1644. }
  1645. },
  1646. {
  1647. "if": [
  1648. {
  1649. "condition": "template",
  1650. "value_template": "{{ states[scene_to_destroy] != none }}"
  1651. }
  1652. ],
  1653. "then": [
  1654. {
  1655. "action": "scene.delete",
  1656. "target": {
  1657. "entity_id": "{{ scene_to_destroy }}"
  1658. }
  1659. }
  1660. ]
  1661. }
  1662. ]
  1663. }
  1664. }
  1665. ]
  1666. },
  1667. {
  1668. "variables": {
  1669. "scene_to_apply_tmp": "{% if scene_to_apply != none and states[scene_to_apply] != none %}\n {{ scene_to_apply }}\n{% else %}\n {{ scenes_all | expand | reject('==',none) | map(attribute=\"entity_id\") | list | first | default(none) }}\n{% endif %}\n"
  1670. }
  1671. },
  1672. {
  1673. "if": [
  1674. {
  1675. "condition": "template",
  1676. "value_template": "{{ is_scene_apply_trigger }}"
  1677. },
  1678. {
  1679. "condition": "template",
  1680. "value_template": "{{ scene_to_apply_tmp != none and states[scene_to_apply_tmp] != none }}"
  1681. }
  1682. ],
  1683. "then": [
  1684. {
  1685. "action": "system_log.write",
  1686. "data": {
  1687. "message": "{{ 'AHC - Calibration - ' + automation_name | string + ' \\n ' + 'apply scene: ' + scene_to_apply_tmp | string + ' state: ' + states[scene_to_apply_tmp] | string }}\n",
  1688. "level": "debug",
  1689. "logger": "blueprints.panhans.heatingcontrol"
  1690. }
  1691. },
  1692. {
  1693. "action": "scene.turn_on",
  1694. "target": {
  1695. "entity_id": "{{ scene_to_apply_tmp }}"
  1696. }
  1697. },
  1698. {
  1699. "action": "scene.delete",
  1700. "target": {
  1701. "entity_id": "{{ scene_to_apply_tmp }}"
  1702. }
  1703. },
  1704. {
  1705. "condition": "template",
  1706. "value_template": "{{ false }}"
  1707. }
  1708. ],
  1709. "else": [
  1710. {
  1711. "if": [
  1712. {
  1713. "condition": "template",
  1714. "value_template": "{{ is_reset_trigger }}"
  1715. }
  1716. ],
  1717. "then": [
  1718. {
  1719. "repeat": {
  1720. "count": "{{ reset_data | count | int }}",
  1721. "sequence": [
  1722. {
  1723. "action": "system_log.write",
  1724. "data": {
  1725. "message": "{{ 'AHC - Calibration - ' + automation_name | string + ' \\n ' + 'reset data: ' + reset_data | string }}\n",
  1726. "level": "debug",
  1727. "logger": "blueprints.panhans.heatingcontrol"
  1728. }
  1729. },
  1730. {
  1731. "variables": {
  1732. "index": "{{ repeat.index-1 }}",
  1733. "reset_entity": "{{ reset_data[index]['entity'] }}",
  1734. "reset_temp": "{% set temp_r = reset_data[index]['temp'] %} {% set t_min = state_attr(reset_entity,'min') %} {% set t_max = state_attr(reset_entity,'max') %} {% set step = state_attr(reset_entity,'step') %}\n{% set temp_r = ((temp_r | float(0) / step) | round(0) * step) | float %} {% set temp_r = iif(temp_r > t_max, t_max, temp_r) %} {% set temp_r = iif(temp_r < t_min, t_min, temp_r) %} {{ temp_r }}\n"
  1735. }
  1736. },
  1737. {
  1738. "action": "input_number.set_value",
  1739. "data": {
  1740. "value": "{{ reset_temp }}"
  1741. },
  1742. "target": {
  1743. "entity_id": "{{ reset_entity }}"
  1744. }
  1745. }
  1746. ]
  1747. }
  1748. }
  1749. ]
  1750. },
  1751. {
  1752. "if": [
  1753. {
  1754. "condition": "and",
  1755. "conditions": null
  1756. },
  1757. {
  1758. "condition": "template",
  1759. "value_template": "{{ changes | count | int > 0 and (not no_changes or (no_changes and state_window)) }}"
  1760. }
  1761. ],
  1762. "then": [
  1763. {
  1764. "repeat": {
  1765. "count": "{{ changes | count | int }}",
  1766. "sequence": [
  1767. {
  1768. "variables": {
  1769. "index": "{{ repeat.index-1 }}",
  1770. "thermostat": "{{ (changes.keys() | list) [index] }}",
  1771. "mode": "{{ (((changes.values() | list) [index]) | first) ['mode'] }}",
  1772. "temp_target": "{{ (((changes.values() | list) [index]) | first) ['temp'] }}"
  1773. }
  1774. },
  1775. {
  1776. "action": "system_log.write",
  1777. "data": {
  1778. "message": "AHC - Change - {{ automation_name }} {{\" \\n \"}} Trigger ID: {{ iif(trigger_id_defined, trigger.id, '') }} Thermostat: {{ thermostat }} {{\" \\n \"}} Mode: {{ mode }} {{\" \\n \"}} New Target Temp: {{ temp_target }} {{\" \\n \"}} Current Target Temp: {{ state_attr(thermostat,'temperature') }}\n",
  1779. "level": "debug",
  1780. "logger": "blueprints.panhans.heatingcontrol"
  1781. }
  1782. },
  1783. {
  1784. "if": [
  1785. {
  1786. "condition": "template",
  1787. "value_template": "{{ states(thermostat) | lower != mode | lower }}"
  1788. }
  1789. ],
  1790. "then": [
  1791. {
  1792. "action": "climate.set_hvac_mode",
  1793. "data": {
  1794. "entity_id": "{{ thermostat }}",
  1795. "hvac_mode": "{{ mode }}"
  1796. }
  1797. },
  1798. {
  1799. "delay": {
  1800. "hours": 0,
  1801. "minutes": 0,
  1802. "seconds": 2
  1803. }
  1804. }
  1805. ]
  1806. },
  1807. {
  1808. "if": [
  1809. {
  1810. "condition": "template",
  1811. "value_template": "{{ state_attr(thermostat, 'temperature') != temp_target and mode != 'off' }}"
  1812. }
  1813. ],
  1814. "then": [
  1815. {
  1816. "action": "climate.set_temperature",
  1817. "data": {
  1818. "entity_id": "{{ thermostat }}",
  1819. "temperature": "{{ temp_target | float }}"
  1820. }
  1821. },
  1822. {
  1823. "delay": {
  1824. "hours": 0,
  1825. "minutes": 0,
  1826. "seconds": 2
  1827. }
  1828. }
  1829. ]
  1830. }
  1831. ]
  1832. }
  1833. }
  1834. ]
  1835. }
  1836. ]
  1837. },
  1838. {
  1839. "if": [
  1840. {
  1841. "condition": "template",
  1842. "value_template": "{{ input_valve_positioning_mode != 'off' }}"
  1843. },
  1844. {
  1845. "condition": "template",
  1846. "value_template": "{{ changes | count | int > 0 or is_scene_apply_trigger }}"
  1847. }
  1848. ],
  1849. "then": [
  1850. {
  1851. "delay": {
  1852. "seconds": 10
  1853. }
  1854. },
  1855. {
  1856. "event": "ahc_positioning_event",
  1857. "event_data": {
  1858. "automation": "{{ this.entity_id }}"
  1859. }
  1860. },
  1861. {
  1862. "delay": {
  1863. "hours": 0,
  1864. "minutes": 0,
  1865. "seconds": 2
  1866. }
  1867. }
  1868. ]
  1869. },
  1870. {
  1871. "if": [
  1872. {
  1873. "condition": "template",
  1874. "value_template": "{{ input_custom_action != none }}"
  1875. }
  1876. ],
  1877. "then": null
  1878. }
  1879. ]
  1880. }
  1881. ],
  1882. "mode": "queued",
  1883. "triggers": [
  1884. {
  1885. "trigger": "homeassistant",
  1886. "event": "start",
  1887. "id": "temperature_change_hastart"
  1888. },
  1889. {
  1890. "trigger": "event",
  1891. "event_type": "automation_reloaded",
  1892. "id": "temperature_change_reload"
  1893. },
  1894. {
  1895. "trigger": "event",
  1896. "event_type": "ahc_delay_event",
  1897. "id": "delayed_call_temperature_change",
  1898. "event_data": {
  1899. "automation": "{{ this.entity_id }}"
  1900. }
  1901. },
  1902. {
  1903. "trigger": "event",
  1904. "event_type": "ahc_positioning_event",
  1905. "id": "positioning_event",
  1906. "event_data": {
  1907. "automation": "{{ this.entity_id }}"
  1908. }
  1909. },
  1910. {
  1911. "trigger": "state",
  1912. "entity_id": [
  1913. "climate.heizung_esszimmer"
  1914. ],
  1915. "from": [
  1916. "unknown",
  1917. "unavailable"
  1918. ],
  1919. "for": {
  1920. "seconds": 5
  1921. },
  1922. "id": "temperature_change_available"
  1923. },
  1924. {
  1925. "trigger": "state",
  1926. "entity_id": [
  1927. "climate.heizung_esszimmer"
  1928. ],
  1929. "attribute": "temperature",
  1930. "for": {
  1931. "seconds": 5
  1932. },
  1933. "id": "temperature_change_valve_target"
  1934. },
  1935. {
  1936. "trigger": "state",
  1937. "entity_id": [],
  1938. "for": {
  1939. "hours": 0,
  1940. "minutes": 0,
  1941. "seconds": 2
  1942. },
  1943. "id": "temperature_change_eco"
  1944. },
  1945. {
  1946. "trigger": "state",
  1947. "entity_id": [],
  1948. "for": {
  1949. "hours": 0,
  1950. "minutes": 0,
  1951. "seconds": 2
  1952. },
  1953. "id": "temperature_change_comfort"
  1954. },
  1955. {
  1956. "trigger": "template",
  1957. "value_template": "{{ input_persons | expand \n | selectattr('state', 'eq', 'home') \n | list \n | count > 0 \n \n or (is_guest_mode_defined and states(input_mode_guest) in ['on','active'] ) }}\n",
  1958. "id": "temperature_change_person_on",
  1959. "for": {
  1960. "hours": 0,
  1961. "minutes": 0,
  1962. "seconds": 2
  1963. }
  1964. },
  1965. {
  1966. "trigger": "template",
  1967. "value_template": "{{ input_persons | expand \n | selectattr('state', 'eq', 'home') \n | list \n | count == 0 \n \n and (not is_guest_mode_defined or (is_guest_mode_defined and states(input_mode_guest) not in ['on','active'])) }}\n",
  1968. "id": "temperature_change_person_off",
  1969. "for": {
  1970. "hours": 0,
  1971. "minutes": 0,
  1972. "seconds": 2
  1973. }
  1974. },
  1975. {
  1976. "trigger": "template",
  1977. "id": "temperature_change_scheduler_on",
  1978. "value_template": "{% set selected_scheduler = none %} {% set schedules_count = input_schedulers | count %}\n{% if schedules_count == 0 %}\n {% set selected_scheduler = none %}\n{% elif schedules_count == 1 or input_scheduler_selector == none %}\n {% set selected_scheduler = input_schedulers | first %}\n{% elif schedules_count > 1 %}\n {% set selector_value = states(input_scheduler_selector) %}\n\n {% if is_number(selector_value) %}\n {% set selector_value = iif(selector_value | int > schedules_count, schedules_count, selector_value) %}\n {% set selector_value = iif(selector_value | int <= 0, 1, selector_value) %}\n {% set selected_scheduler = input_schedulers[selector_value | int - 1] %}\n {% elif selector_value in ['on','off'] %}\n {% set selected_scheduler = iif(selector_value == 'off', input_schedulers[0], input_schedulers[1]) %}\n {% else %}\n {% set selected_scheduler = input_schedulers | expand | selectattr('attributes.friendly_name', 'eq', selector_value) | map(attribute='entity_id') | first | default(none) %}\n {% if (selected_scheduler == none) %}\n {% set selected_scheduler = input_schedulers | expand | selectattr('attributes.friendly_name', 'search', '(?i)' + selector_value) | map(attribute='entity_id') | first | default(none) %}\n {% endif %}\n {% endif %}\n{% endif %}\n{% if selected_scheduler == none %}\n {{ false }}\n{% else %}\n {{ is_state(selected_scheduler, 'on') }}\n{% endif %}\n"
  1979. },
  1980. {
  1981. "trigger": "template",
  1982. "id": "temperature_change_scheduler_off",
  1983. "value_template": "{% set selected_scheduler = none %} {% set schedules_count = input_schedulers | count %}\n{% if schedules_count == 0 %}\n {% set selected_scheduler = none %}\n{% elif schedules_count == 1 or input_scheduler_selector == none %}\n {% set selected_scheduler = input_schedulers | first %}\n{% elif schedules_count > 1 %}\n {% set selector_value = states(input_scheduler_selector) %}\n\n {% if is_number(selector_value) %}\n {% set selector_value = iif(selector_value | int > schedules_count, schedules_count, selector_value) %}\n {% set selector_value = iif(selector_value | int <= 0, 1, selector_value) %}\n {% set selected_scheduler = input_schedulers[selector_value | int - 1] %}\n {% elif selector_value in ['on','off'] %}\n {% set selected_scheduler = iif(selector_value == 'off', input_schedulers[0], input_schedulers[1]) %}\n {% else %}\n {% set selected_scheduler = input_schedulers | expand | selectattr('attributes.friendly_name', 'eq', selector_value) | map(attribute='entity_id') | first | default(none) %}\n {% if (selected_scheduler == none) %}\n {% set selected_scheduler = input_schedulers | expand | selectattr('attributes.friendly_name', 'search', '(?i)' + selector_value) | map(attribute='entity_id') | first | default(none) %}\n {% endif %}\n {% endif %}\n{% endif %}\n{% if selected_scheduler == none %}\n {{ false }}\n{% else %}\n {{ is_state(selected_scheduler, 'off') }}\n{% endif %}\n"
  1984. },
  1985. {
  1986. "trigger": "template",
  1987. "id": "temperature_change_presence_on",
  1988. "value_template": "{{ input_presence_sensor != none and is_state(input_presence_sensor, 'on') }}",
  1989. "for": {
  1990. "hours": 0,
  1991. "minutes": 5,
  1992. "seconds": 0
  1993. }
  1994. },
  1995. {
  1996. "trigger": "template",
  1997. "id": "temperature_change_presence_off",
  1998. "value_template": "{{ input_presence_sensor != none and is_state(input_presence_sensor, 'off') }}",
  1999. "for": {
  2000. "hours": 0,
  2001. "minutes": 5,
  2002. "seconds": 0
  2003. }
  2004. },
  2005. {
  2006. "trigger": "template",
  2007. "id": "temperature_change_presence_scheduler_on",
  2008. "value_template": "{{ input_scheduler_presence != none and is_state(input_scheduler_presence, 'on') }}",
  2009. "for": {
  2010. "hours": 0,
  2011. "minutes": 0,
  2012. "seconds": 2
  2013. }
  2014. },
  2015. {
  2016. "trigger": "template",
  2017. "id": "temperature_change_presence_scheduler_off",
  2018. "value_template": "{{ input_scheduler_presence != none and is_state(input_scheduler_presence, 'off') }}",
  2019. "for": {
  2020. "hours": 0,
  2021. "minutes": 0,
  2022. "seconds": 2
  2023. }
  2024. },
  2025. {
  2026. "trigger": "template",
  2027. "id": "temperature_change_person_proximity_on",
  2028. "value_template": "{% set proximity_entities = device_entities(input_proximity) %}\n{% set is_arrived = proximity_entities \n | select('is_state','arrived') \n | expand \n | selectattr('attributes.device_class', 'eq', 'enum')\n | list | count > 0 %}\n\n{% set entities_towards = proximity_entities \n | expand \n | selectattr('attributes.device_class', 'eq', 'enum') \n | map(attribute='entity_id') | select('is_state','towards') \n | map('regex_replace','_(?=[^_]*$)(.*)', '')\n | list %}\n\n{% set distances = proximity_entities \n | expand \n | selectattr('attributes.device_class', 'eq', 'distance')\n | map(attribute='state')\n | reject('eq', 'unknown')\n | map('int')\n | select('<=', input_proximity_distance | int)\n | map('string')\n | list %}\n\n{% set entities_distances = proximity_entities \n | expand \n | selectattr('attributes.device_class', 'eq', 'distance')\n | selectattr('state', 'in', distances)\n | map(attribute='entity_id')\n | map('regex_replace','_(?=[^_]*$)(.*)', '')\n | list %}\n\n{% set entites_towards_and_in_distance = entities_towards | select('in', entities_distances) | list | count > 0 %}\n{{ entites_towards_and_in_distance or is_arrived }}\n",
  2029. "for": {
  2030. "hours": 0,
  2031. "minutes": 2,
  2032. "seconds": 0
  2033. }
  2034. },
  2035. {
  2036. "trigger": "template",
  2037. "id": "temperature_change_person_proximity_off",
  2038. "value_template": "{% set proximity_entities = device_entities(input_proximity) %} {% set is_arrived = proximity_entities \n | select('is_state','arrived') \n | expand \n | selectattr('attributes.device_class', 'eq', 'enum') \n | list | count > 0 %}\n\n{% set entities_towards = proximity_entities \n | expand \n | selectattr('attributes.device_class', 'eq', 'enum') \n | map(attribute='entity_id') | select('is_state','towards') \n | map('regex_replace','_(?=[^_]*$)(.*)', '')\n | list %}\n\n{% set distances = proximity_entities \n | expand \n | selectattr('attributes.device_class', 'eq', 'distance')\n | map(attribute='state')\n | reject('eq', 'unknown')\n | map('int')\n | select('<=', input_proximity_distance | int)\n | map('string')\n | list %}\n\n{% set entities_distances = proximity_entities \n | expand \n | selectattr('attributes.device_class', 'eq', 'distance')\n | selectattr('state', 'in', distances)\n | map(attribute='entity_id')\n | map('regex_replace','_(?=[^_]*$)(.*)', '')\n | list %}\n\n{% set entites_towards_and_in_distance = entities_towards | select('in', entities_distances) | list | count > 0 %}\n{{ entites_towards_and_in_distance == false and is_arrived == false }}\n",
  2039. "for": {
  2040. "hours": 0,
  2041. "minutes": 2,
  2042. "seconds": 0
  2043. }
  2044. },
  2045. {
  2046. "trigger": "template",
  2047. "value_template": "{{ expand(input_windows) | selectattr('state', 'in', ['on','open','tilted']) | list | count > 0 }}",
  2048. "for": {
  2049. "hours": 0,
  2050. "minutes": 0,
  2051. "seconds": 30
  2052. },
  2053. "id": "temperature_change_window_on"
  2054. },
  2055. {
  2056. "trigger": "template",
  2057. "value_template": "{{ expand(input_windows) | selectattr('state', 'in', ['on','open','tilted']) | list | count == 0 }}",
  2058. "for": {
  2059. "hours": 0,
  2060. "minutes": 0,
  2061. "seconds": 30
  2062. },
  2063. "id": "temperature_change_window_off"
  2064. },
  2065. {
  2066. "trigger": "template",
  2067. "id": "temperature_change_winter_mode_on",
  2068. "value_template": "{% if input_mode_winter != none %}\n {% set activation_state = iif(input_invert_winter_mode_value, 'off', 'on') %}\n {{ is_state(input_mode_winter, activation_state) }}\n{% endif %}\n",
  2069. "for": {
  2070. "hours": 0,
  2071. "minutes": 0,
  2072. "seconds": 2
  2073. }
  2074. },
  2075. {
  2076. "trigger": "template",
  2077. "id": "temperature_change_winter_mode_off",
  2078. "value_template": "{% if input_mode_winter != none %}\n {% set activation_state = iif(input_invert_winter_mode_value, 'off', 'on') %}\n {{ not is_state(input_mode_winter, activation_state) }}\n{% endif %}\n",
  2079. "for": {
  2080. "hours": 0,
  2081. "minutes": 0,
  2082. "seconds": 2
  2083. }
  2084. },
  2085. {
  2086. "trigger": "template",
  2087. "id": "temperature_change_outside_on",
  2088. "value_template": "{% if input_mode_outside_temperature == none %}\n {{ false }}\n{% else %}\n {% set outside_state = false %}\n {% set use_room_temp = input_mode_room_temperature and is_temperature_sensor_defined %}\n {% set room_state = iif(use_room_temp, false, true) %}\n\n {% set state = states(input_mode_outside_temperature) %}\n {% set state = iif(is_number(state) == true, state, state_attr(input_mode_outside_temperature,'temperature'))%}\n\n {% if is_number(state) %}\n {% set outside_state = (state | float - input_mode_outside_temperature_threshold | float) * factor < 0 %}\n {% endif %}\n\n {% if use_room_temp %}\n {% set state = states(input_temperature_sensor) %}\n\n {% if is_number(state) %}\n {% set room_state = (state | float - input_mode_room_temperature_threshold | float) * factor < 0 %}\n {% endif %}\n {% endif %}\n\n {{ room_state and outside_state }}\n{% endif %}\n",
  2089. "for": {
  2090. "hours": 0,
  2091. "minutes": 0,
  2092. "seconds": 2
  2093. }
  2094. },
  2095. {
  2096. "trigger": "template",
  2097. "id": "temperature_change_outside_off",
  2098. "value_template": "{% if input_mode_outside_temperature == none %}\n {{ false }}\n{% else %}\n {% set outside_state = false %}\n {% set use_room_temp = input_mode_room_temperature and is_temperature_sensor_defined %}\n {% set room_state = iif(use_room_temp, false, true) %}\n\n {% set state = states(input_mode_outside_temperature) %}\n {% set state = iif(is_number(state) == true, state, state_attr(input_mode_outside_temperature,'temperature'))%}\n\n {% if is_number(state) %}\n {% set outside_state = (state | float - input_mode_outside_temperature_threshold | float) * factor < 0 %}\n {% endif %}\n\n {% if use_room_temp %}\n {% set state = states(input_temperature_sensor) %}\n\n {% if is_number(state) %}\n {% set room_state = (state | float - input_mode_room_temperature_threshold | float) * factor < 0 %}\n {% endif %}\n {% endif %}\n\n {{ not (room_state and outside_state) }}\n{% endif %}\n",
  2099. "for": {
  2100. "hours": 0,
  2101. "minutes": 0,
  2102. "seconds": 2
  2103. }
  2104. },
  2105. {
  2106. "trigger": "state",
  2107. "id": "temperature_change_force_max_temperature_on",
  2108. "entity_id": [],
  2109. "for": {
  2110. "hours": 0,
  2111. "minutes": 0,
  2112. "seconds": 2
  2113. }
  2114. },
  2115. {
  2116. "trigger": "state",
  2117. "id": "temperature_change_force_eco_temperature_ds",
  2118. "entity_id": [],
  2119. "for": {
  2120. "hours": 0,
  2121. "minutes": 0,
  2122. "seconds": 2
  2123. }
  2124. },
  2125. {
  2126. "trigger": "template",
  2127. "id": "temperature_change_party_on",
  2128. "value_template": "{{ input_mode_party | expand | selectattr('state', 'in', ['active','on']) | list | count > 0 }}",
  2129. "for": {
  2130. "hours": 0,
  2131. "minutes": 0,
  2132. "seconds": 2
  2133. }
  2134. },
  2135. {
  2136. "trigger": "template",
  2137. "value_template": "{{ input_mode_party | expand | selectattr('state', 'in', ['active','on']) | list | count == 0 }}",
  2138. "id": "temperature_change_party_off",
  2139. "for": {
  2140. "hours": 0,
  2141. "minutes": 0,
  2142. "seconds": 2
  2143. }
  2144. },
  2145. {
  2146. "trigger": "state",
  2147. "id": "calibration_aggressive_mode_above_temp_thermostat_current_temp_change",
  2148. "entity_id": [
  2149. "climate.heizung_esszimmer"
  2150. ],
  2151. "attribute": "current_temperature",
  2152. "for": {
  2153. "hours": 24,
  2154. "minutes": 0,
  2155. "seconds": 0
  2156. }
  2157. },
  2158. {
  2159. "trigger": "state",
  2160. "id": "calibration_aggressive_mode_thermostat_temp_change",
  2161. "entity_id": [
  2162. "climate.heizung_esszimmer"
  2163. ],
  2164. "attribute": "temperature",
  2165. "for": {
  2166. "seconds": 30
  2167. }
  2168. },
  2169. {
  2170. "trigger": "state",
  2171. "id": "aggressive_mode_above_temp_sensor_change",
  2172. "entity_id": [],
  2173. "for": {
  2174. "seconds": 30
  2175. }
  2176. },
  2177. {
  2178. "trigger": "state",
  2179. "id": "calibration_sensor_change",
  2180. "entity_id": [],
  2181. "for": {
  2182. "hours": 24,
  2183. "minutes": 0,
  2184. "seconds": 0
  2185. }
  2186. },
  2187. {
  2188. "trigger": "state",
  2189. "id": "calibration_popp_change",
  2190. "entity_id": [],
  2191. "for": {
  2192. "seconds": 2
  2193. }
  2194. },
  2195. {
  2196. "trigger": "template",
  2197. "id": "calibration_popp_ping",
  2198. "value_template": "{% set has_valves_danfoss = input_trvs | select('is_device_attr', 'manufacturer', 'Danfoss') | list %} {% set has_valves_popp = input_trvs | select('is_device_attr', 'manufacturer', 'Popp') | list %} {% set valves_hive = input_trvs | select('is_device_attr', 'manufacturer', 'Hive') | list %}\n{% set has_valves = (has_valves_danfoss + has_valves_popp + valves_hive) | count > 0 %}\n{{ has_valves and is_temperature_sensor_defined and now().strftime('%M') | int % 10 == 0 }}\n"
  2199. },
  2200. {
  2201. "trigger": "template",
  2202. "id": "temperature_change_heating_adjustment",
  2203. "value_template": "{% set timestamp = now() %}\n{% set current_day = timestamp.strftime('%a') %} {% set current_time = timestamp.strftime('%H:%M') %}\n{% set plan = input_adjustments | rejectattr('time', 'undefined') \n | selectattr('time','eq', current_time | string)\n | sort(attribute='time', reverse = true)\n | list %}\n\n{{ plan | count > 0 and now() < now().replace(second=2) }}\n"
  2204. },
  2205. {
  2206. "trigger": "template",
  2207. "value_template": "{% if not input_liming_protection%}\n {{ false }}\n{% else %}\n {% set enable_liming = true %}\n {% if input_mode_winter != none %}\n {% set enable_liming = is_state(input_mode_winter,'on') or input_liming_in_winter %}\n {% endif %}\n\n {% set current_timestamp = now() %}\n\n {% set is_liming_day = input_liming_protection_day == as_datetime(current_timestamp).strftime('%a') %}\n\n {% set start_hour = input_liming_protection_time.split(':')[0] | int %}\n {% set start_minute = input_liming_protection_time.split(':')[1] | int %}\n\n {% set today_start = as_datetime(current_timestamp).replace(second=0,microsecond=0,hour=start_hour,minute=start_minute) %}\n {% set today_end = as_datetime(current_timestamp).replace(second=0,microsecond=0,hour=start_hour,minute=start_minute) + timedelta(minutes=input_liming_protection_duration | int) %}\n\n {% set is_liming_time = as_datetime(current_timestamp) >= today_start and as_datetime(current_timestamp) <= today_end %}\n\n {{ enable_liming and is_liming_day and is_liming_time }}\n{% endif %}\n",
  2208. "id": "temperature_change_liming_protection_on"
  2209. },
  2210. {
  2211. "trigger": "template",
  2212. "value_template": "{% if not input_liming_protection%}\n {{ false }}\n{% else %}\n {% set enable_liming = true %}\n {% if input_mode_winter != none %}\n {% set enable_liming = is_state(input_mode_winter,'on') or input_liming_in_winter %}\n {% endif %}\n\n {% set current_timestamp = now() %}\n\n {% set current_timestamp = now() %}\n\n {% set is_liming_day = input_liming_protection_day == as_datetime(current_timestamp).strftime('%a') %}\n\n {% set start_hour = input_liming_protection_time.split(':')[0] | int %}\n {% set start_minute = input_liming_protection_time.split(':')[1] | int %}\n\n {% set today_start = as_datetime(current_timestamp).replace(second=0,microsecond=0,hour=start_hour,minute=start_minute) %}\n {% set today_end = as_datetime(current_timestamp).replace(second=0,microsecond=0,hour=start_hour,minute=start_minute) + timedelta(minutes=input_liming_protection_duration | int) %}\n\n {% set is_liming_time = as_datetime(current_timestamp) >= today_start and as_datetime(current_timestamp) <= today_end %}\n\n {{ not (enable_liming and is_liming_day and is_liming_time) }}\n{% endif %}\n",
  2213. "id": "temperature_change_liming_protection_off"
  2214. },
  2215. {
  2216. "trigger": "template",
  2217. "id": "temperature_change_frost_protection_on",
  2218. "for": {
  2219. "days": 0,
  2220. "hours": 0,
  2221. "minutes": 0,
  2222. "seconds": 0
  2223. },
  2224. "value_template": "{% set now_ts = now() %} {% set frost_protection_timestamp = as_datetime(now_ts) - timedelta(**input_frost_protection_duration) %} {% if frost_protection_timestamp == now_ts %}\n {{ false }}\n{% else %}\n \n {% set relevant_entities = [input_presence_sensor] + [input_mode_guest] + input_persons %}\n {% set relevant_entities_count = relevant_entities | reject('eq',none) | list | count %}\n\n {% if relevant_entities_count > 0 %}\n {% set presence_count = [input_presence_sensor] \n | reject('eq',none)\n | reject('is_state','on')\n | list\n | count %}\n\n {% set guest_mode_count = [input_mode_guest] \n | reject('eq',none)\n | reject('is_state','on')\n | list\n | count %}\n\n {% set person_count = input_persons\n | reject('is_state','home')\n | list\n | count %}\n\n {{ presence_count + guest_mode_count + person_count == relevant_entities_count }}\n {% else %}\n {{ false }}\n {% endif %}\n{% endif %}\n"
  2225. }
  2226. ],
  2227. "id": "1739643486506",
  2228. "alias": "AUTOMATISIERUNG - Heizung Esszimmer",
  2229. "description": ""
  2230. },
  2231. "blueprint_inputs": {
  2232. "id": "1739643486506",
  2233. "alias": "AUTOMATISIERUNG - Heizung Esszimmer",
  2234. "description": "",
  2235. "use_blueprint": {
  2236. "path": "panhans/advanced_heating_control.yaml",
  2237. "input": {
  2238. "input_trvs": [
  2239. "climate.heizung_esszimmer"
  2240. ],
  2241. "input_off_instead_of_eco": false,
  2242. "input_windows": [
  2243. "binary_sensor.status_fenster_esszimmer_wohnzimmer_kuche"
  2244. ],
  2245. "input_calibration_timeout": {
  2246. "hours": 24,
  2247. "minutes": 0,
  2248. "seconds": 0
  2249. },
  2250. "input_calibration_delta": 5,
  2251. "input_calibration_step_size": "0.1",
  2252. "input_startup_delay": {
  2253. "hours": 0,
  2254. "minutes": 1,
  2255. "seconds": 0
  2256. },
  2257. "input_mode_outside_temperature_threshold": 20,
  2258. "input_window_legacy_restore": true
  2259. }
  2260. }
  2261. },
  2262. "context": {
  2263. "id": "01JS1P6B8Z5CZZ59TD8JGSYAB6",
  2264. "parent_id": "01JS1P5DZBRP4J05D68NBJSWY0",
  2265. "user_id": null
  2266. }
  2267. },
  2268. "logbookEntries": [
  2269. {
  2270. "name": "AUTOMATISIERUNG - Heizung Esszimmer",
  2271. "message": "triggered by binary_sensor.turkontakt_esszimmer via template",
  2272. "source": "binary_sensor.turkontakt_esszimmer via template",
  2273. "entity_id": "automation.automatisierung_heizung_esszimmer",
  2274. "context_id": "01JS1P6B8Z5CZZ59TD8JGSYAB6",
  2275. "domain": "automation",
  2276. "when": 1744887295.2898636
  2277. },
  2278. {
  2279. "state": "off",
  2280. "entity_id": "climate.heizung_esszimmer",
  2281. "when": 1744887296.1247437,
  2282. "context_event_type": "automation_triggered",
  2283. "context_domain": "automation",
  2284. "context_name": "AUTOMATISIERUNG - Heizung Esszimmer",
  2285. "context_message": "triggered by binary_sensor.turkontakt_esszimmer via template",
  2286. "context_source": "binary_sensor.turkontakt_esszimmer via template",
  2287. "context_entity_id": "automation.automatisierung_heizung_esszimmer"
  2288. }
  2289. ]
  2290. }

Edit this Snippet