This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {% set dwd_warning = namespace(found=false)%} | |
| {% if state_attr('sensor.dwd_weather_warnings_current_warning_level', 'warning_count') > 0 %} | |
| {% for i in range(1, state_attr('sensor.dwd_weather_warnings_current_warning_level', 'warning_count')+1) %} | |
| {% set start = as_timestamp(state_attr('sensor.dwd_weather_warnings_current_warning_level', 'warning_'~i~'_start'))%} | |
| {% set end = as_timestamp(state_attr('sensor.dwd_weather_warnings_current_warning_level', 'warning_'~i~'_end'))%} | |
| {% if start < as_timestamp(now()) < as_timestamp(now()) < end %} | |
| {% set dwd_warning.found = true %} | |
| {%endif%} | |
| {%endfor%} | |
| {%endif%} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function proof_of_work(difficulty, prev_hash, timestamp, merkle_root) { | |
| var hash = “1111111111111111111111111111111111111111111111111111111111111111”; | |
| var nonce = 0; | |
| //check if hash meets difficulty criteria (by counting number of zeros) | |
| while (hash.substring(0, difficulty) !== Array(difficulty + 1).join("0")) { | |
| //incrementing the nonce value every time the loop runs. | |
| nonce++; | |
| //recalculating the hash value | |
| hash = this.calculateHash(nonce, prev_hash, timestamp, merkle_root); | |
| } |