{"action":"closed","issue":{"url":"https://api.github.com/repos/Hyrules/WinHue3/issues/138","repository_url":"https://api.github.com/repos/Hyrules/WinHue3","labels_url":"https://api.github.com/repos/Hyrules/WinHue3/issues/138/labels{/name}","comments_url":"https://api.github.com/repos/Hyrules/WinHue3/issues/138/comments","events_url":"https://api.github.com/repos/Hyrules/WinHue3/issues/138/events","html_url":"https://github.com/Hyrules/WinHue3/issues/138","id":282229878,"node_id":"MDU6SXNzdWUyODIyMjk4Nzg=","number":138,"title":"Not an issue, more a feature suggestion : \"Power cut set of rules\"","user":{"login":"GrimDeclaw","id":32737042,"node_id":"MDQ6VXNlcjMyNzM3MDQy","avatar_url":"https://avatars2.githubusercontent.com/u/32737042?v=4","gravatar_id":"","url":"https://api.github.com/users/GrimDeclaw","html_url":"https://github.com/GrimDeclaw","followers_url":"https://api.github.com/users/GrimDeclaw/followers","following_url":"https://api.github.com/users/GrimDeclaw/following{/other_user}","gists_url":"https://api.github.com/users/GrimDeclaw/gists{/gist_id}","starred_url":"https://api.github.com/users/GrimDeclaw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GrimDeclaw/subscriptions","organizations_url":"https://api.github.com/users/GrimDeclaw/orgs","repos_url":"https://api.github.com/users/GrimDeclaw/repos","events_url":"https://api.github.com/users/GrimDeclaw/events{/privacy}","received_events_url":"https://api.github.com/users/GrimDeclaw/received_events","type":"User","site_admin":false},"labels":[{"id":447621349,"node_id":"MDU6TGFiZWw0NDc2MjEzNDk=","url":"https://api.github.com/repos/Hyrules/WinHue3/labels/feature%20request","name":"feature request","color":"5319e7","default":false}],"state":"closed","locked":false,"assignee":{"login":"Hyrules","id":3161577,"node_id":"MDQ6VXNlcjMxNjE1Nzc=","avatar_url":"https://avatars3.githubusercontent.com/u/3161577?v=4","gravatar_id":"","url":"https://api.github.com/users/Hyrules","html_url":"https://github.com/Hyrules","followers_url":"https://api.github.com/users/Hyrules/followers","following_url":"https://api.github.com/users/Hyrules/following{/other_user}","gists_url":"https://api.github.com/users/Hyrules/gists{/gist_id}","starred_url":"https://api.github.com/users/Hyrules/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Hyrules/subscriptions","organizations_url":"https://api.github.com/users/Hyrules/orgs","repos_url":"https://api.github.com/users/Hyrules/repos","events_url":"https://api.github.com/users/Hyrules/events{/privacy}","received_events_url":"https://api.github.com/users/Hyrules/received_events","type":"User","site_admin":false},"assignees":[{"login":"Hyrules","id":3161577,"node_id":"MDQ6VXNlcjMxNjE1Nzc=","avatar_url":"https://avatars3.githubusercontent.com/u/3161577?v=4","gravatar_id":"","url":"https://api.github.com/users/Hyrules","html_url":"https://github.com/Hyrules","followers_url":"https://api.github.com/users/Hyrules/followers","following_url":"https://api.github.com/users/Hyrules/following{/other_user}","gists_url":"https://api.github.com/users/Hyrules/gists{/gist_id}","starred_url":"https://api.github.com/users/Hyrules/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Hyrules/subscriptions","organizations_url":"https://api.github.com/users/Hyrules/orgs","repos_url":"https://api.github.com/users/Hyrules/repos","events_url":"https://api.github.com/users/Hyrules/events{/privacy}","received_events_url":"https://api.github.com/users/Hyrules/received_events","type":"User","site_admin":false}],"milestone":null,"comments":3,"created_at":"2017-12-14T20:31:20Z","updated_at":"2018-12-14T22:11:14Z","closed_at":"2018-12-14T22:11:14Z","author_association":"NONE","body":"One thing that was bothering me with the hue system is the fact that after a power cut, all the lights would turn on, and stays that way.\r\n\r\nAfter some search, I found a 1 rule, 1 timer and 2 sensors \"kind of solution\".\r\nI thought it would be a nice feature on WinHue to have a \"Powercut Light off\" button that would create those items.\r\n\r\nHere is the json for this 4 items (while the timer and the rule must be adjusted to use created sensors id):\r\n\r\nThe 2 sensors are simple CLIPGenericStatus:\r\n\r\nThis is the id 8 sensor\r\n```\r\n{\r\n  \"name\": \"PCStateSensor\",\r\n  \"modelid\": \"ipsensor\",\r\n  \"swversion\": \"1.0\",\r\n  \"type\": \"CLIPGenericStatus\",\r\n  \"manufacturername\": \"statesensor_pc\",\r\n  \"uniqueid\": \"statesensor_pc\",\r\n  \"config\": {\r\n    \"on\": true\r\n  }\r\n}\r\n```\r\n\r\nThis is the id 9 sensor\r\n```\r\n{\r\n  \"name\": \"PCInitSensor\",\r\n  \"modelid\": \"ipsensor\",\r\n  \"swversion\": \"1.0\",\r\n  \"type\": \"CLIPGenericStatus\",\r\n  \"manufacturername\": \"initsensor_pc\",\r\n  \"uniqueid\": \"initsensor_pc\",\r\n  \"config\": {\r\n    \"on\": true\r\n  }\r\n}\r\n```\r\n\r\nThe timer is a 10 seconds repeating timer, which set the id 8 sensor status to 1:\r\n```\r\n{\r\n  \"name\": \"PCHeartbeat\",\r\n  \"localtime\": \"R/PT00:00:10\",\r\n  \"description\": \"Powercut Heartbeat\",\r\n  \"command\": {\r\n    \"method\": \"PUT\",\r\n    \"address\": \"/sensors/8/state\",\r\n    \"body\": {\"status\":1}\r\n  },\r\n  \"status\": \"enabled\",\r\n  \"recycle\": false\r\n}\r\n```\r\n\r\nFinally the rule is simple : on sensor 8 dx, if sensor 9 value is 0, set it to 1 and turn off groups/0 lights (ie all lights).\r\nThis works because on bridge init, all sensors state are set to 0, so after boot the lights will go off and the sensor 9 will be set to 1, which will prevent the all lights off  \"PCRule\" rule to trigger\r\n\r\n```\r\n{\r\n  \"name\": \"PCRule\",\r\n  \"conditions\": [{\"address\":\"/sensors/8/state/lastupdated\",\"operator\":\"dx\"},{\"address\":\"/sensors/9/state/status\",\"operator\":\"eq\",\"value\":\"0\"}],\r\n  \"actions\": [{\"address\":\"/sensors/9/state\",\"method\":\"PUT\",\"body\":{\"status\":1}},{\"address\":\"/groups/0/action\",\"method\":\"PUT\",\"body\":{\"on\":false}}],\r\n  \"status\": \"enabled\"\r\n}\r\n```\r\n\r\nDon't know if someone else will find it usefull, but as far as I'm concerned I'm much confident leaving my house with those set!\r\n"}}
{"actor":{"display_login":"Hyrules"}}