{"action":"created","issue":{"url":"https://api.github.com/repos/letscontrolit/ESPEasy/issues/1999","repository_url":"https://api.github.com/repos/letscontrolit/ESPEasy","labels_url":"https://api.github.com/repos/letscontrolit/ESPEasy/issues/1999/labels{/name}","comments_url":"https://api.github.com/repos/letscontrolit/ESPEasy/issues/1999/comments","events_url":"https://api.github.com/repos/letscontrolit/ESPEasy/issues/1999/events","html_url":"https://github.com/letscontrolit/ESPEasy/issues/1999","id":377048978,"node_id":"MDU6SXNzdWUzNzcwNDg5Nzg=","number":1999,"title":"New event MQTT#PublishComplete","user":{"login":"Grovkillen","id":26706274,"node_id":"MDQ6VXNlcjI2NzA2Mjc0","avatar_url":"https://avatars3.githubusercontent.com/u/26706274?v=4","gravatar_id":"","url":"https://api.github.com/users/Grovkillen","html_url":"https://github.com/Grovkillen","followers_url":"https://api.github.com/users/Grovkillen/followers","following_url":"https://api.github.com/users/Grovkillen/following{/other_user}","gists_url":"https://api.github.com/users/Grovkillen/gists{/gist_id}","starred_url":"https://api.github.com/users/Grovkillen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Grovkillen/subscriptions","organizations_url":"https://api.github.com/users/Grovkillen/orgs","repos_url":"https://api.github.com/users/Grovkillen/repos","events_url":"https://api.github.com/users/Grovkillen/events{/privacy}","received_events_url":"https://api.github.com/users/Grovkillen/received_events","type":"User","site_admin":false},"labels":[{"id":855596496,"node_id":"MDU6TGFiZWw4NTU1OTY0OTY=","url":"https://api.github.com/repos/letscontrolit/ESPEasy/labels/Category:%20Energy","name":"Category: Energy","color":"5319e7","default":false},{"id":855590409,"node_id":"MDU6TGFiZWw4NTU1OTA0MDk=","url":"https://api.github.com/repos/letscontrolit/ESPEasy/labels/Category:%20Rules","name":"Category: Rules","color":"5319e7","default":false},{"id":854297562,"node_id":"MDU6TGFiZWw4NTQyOTc1NjI=","url":"https://api.github.com/repos/letscontrolit/ESPEasy/labels/Type:%20Feature%20Request","name":"Type: Feature Request","color":"35e8e2","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":12,"created_at":"2018-11-03T12:09:35Z","updated_at":"2018-11-03T20:12:07Z","closed_at":null,"author_association":"MEMBER","body":"Given the new event based approach for rules we cannot be sure that this will work:\r\n\r\n```\r\nOn MQTT#Connected Do\r\n Publish,%sysname%/Temperature,[BME#temp]\r\n DeepSleep,600\r\nEndOn\r\n```\r\nCurrently this means that the Publish and DeepSleep will be triggered \"at the same time\". And thus the deepsleep will make the publish not take place. To overcome this we would use a timer:\r\n```\r\nOn MQTT#Connected Do\r\n Publish,%sysname%/Temperature,[BME#temp]\r\n TimerSet,1,5\r\nEndOn\r\n\r\nOn Rules#Timer=1 Do\r\n  DeepSleep,600\r\nEndOn\r\n```\r\n\r\nBut given that we want to save as much time as possible (save battery) we don't guess the time it takes for it to be done publishing. So my idea is that after each publish we get an event `MQTT#PublishComplete` or even better, after each publish the event would add an integer, i.e.:\r\n\r\n```\r\nOn MQTT#Connected Do\r\n Publish,%sysname%/Temperature,[BME#temp]\r\n Publish,%sysname%/Humidity,[BME#rh]\r\nEndOn\r\n\r\nOn MQTT#PublishComplete=2 Do\r\n  DeepSleep,600\r\nEndOn\r\n```"},"comment":{"url":"https://api.github.com/repos/letscontrolit/ESPEasy/issues/comments/435617373","html_url":"https://github.com/letscontrolit/ESPEasy/issues/1999#issuecomment-435617373","issue_url":"https://api.github.com/repos/letscontrolit/ESPEasy/issues/1999","id":435617373,"node_id":"MDEyOklzc3VlQ29tbWVudDQzNTYxNzM3Mw==","user":{"login":"TD-er","id":3751318,"node_id":"MDQ6VXNlcjM3NTEzMTg=","avatar_url":"https://avatars3.githubusercontent.com/u/3751318?v=4","gravatar_id":"","url":"https://api.github.com/users/TD-er","html_url":"https://github.com/TD-er","followers_url":"https://api.github.com/users/TD-er/followers","following_url":"https://api.github.com/users/TD-er/following{/other_user}","gists_url":"https://api.github.com/users/TD-er/gists{/gist_id}","starred_url":"https://api.github.com/users/TD-er/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TD-er/subscriptions","organizations_url":"https://api.github.com/users/TD-er/orgs","repos_url":"https://api.github.com/users/TD-er/repos","events_url":"https://api.github.com/users/TD-er/events{/privacy}","received_events_url":"https://api.github.com/users/TD-er/received_events","type":"User","site_admin":false},"created_at":"2018-11-03T20:12:07Z","updated_at":"2018-11-03T20:12:07Z","author_association":"MEMBER","body":"@M0ebiu5 \r\nI agree the rules must be executed in a very predictive order.\r\nThe async idea of running network related commands is about not blocking for a long time.\r\n\r\nSo if we want to be able to do publish commands async, we simply need an event to trigger when it is finished.\r\nBut most important is to be predictive and the current state with commands running from the scheduler is not as predictive as it should be when executing rules.\r\nSo that really has to change, but I really have no clue why things are crashing when I try to run commands from withing rules directly instead of running from the scheduler."}}
{"actor":{"display_login":"TD-er"}}