woozar / node-red-contrib-time-based-dimmer

MIT License
4 stars 4 forks source link

Question/Issue on Stop Command #15

Closed scuppasteve closed 3 years ago

scuppasteve commented 3 years ago

So i am having an issue where i cant get the time dimmer to stop counting with the stop command. The Start command works fine. Any idea what i am doing wrong.

[{"id":"3844750f.09ce6a","type":"change","z":"36bc7cc3.f1a1fc","name":"On","rules":[{"t":"set","p":"payload","pt":"msg","to":"on","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":1850,"y":220,"wires":[["f00cf679.683148","33abe5c6.86c1da"]]},{"id":"f4e4fa3f.a7d768","type":"change","z":"36bc7cc3.f1a1fc","name":"Off","rules":[{"t":"set","p":"payload","pt":"msg","to":"off","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":2050,"y":260,"wires":[["33abe5c6.86c1da"]]},{"id":"f00cf679.683148","type":"api-current-state","z":"36bc7cc3.f1a1fc","name":"Override On?","server":"f0d8d950.180ef8","version":1,"outputs":2,"halt_if":"100","halt_if_type":"num","halt_if_compare":"gte","override_topic":true,"entity_id":"input_number.hallway_kids_bedrooms","state_type":"num","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":2020,"y":100,"wires":[[],["1b3f267e.d371ca"]]},{"id":"15b65c2f.91fb74","type":"switch","z":"36bc7cc3.f1a1fc","name":"<=10","property":"payload","propertyType":"msg","rules":[{"t":"lte","v":"10","vt":"num"}],"checkall":"true","repair":false,"outputs":1,"x":2930,"y":220,"wires":[["203bea0a.765876"]]},{"id":"c62dec14.ec878","type":"api-call-service","z":"36bc7cc3.f1a1fc","name":"Kid's Hallway - Light","server":"f0d8d950.180ef8","version":1,"debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"light.hallway_kids_bedrooms","data":"{\"brightness_pct\":{{payload}}}","dataType":"json","mergecontext":"","output_location":"payload","output_location_type":"msg","mustacheAltTags":false,"x":3140,"y":280,"wires":[[]]},{"id":"175b578a.69c138","type":"api-call-service","z":"36bc7cc3.f1a1fc","name":"Kid's Hallway - Light","server":"f0d8d950.180ef8","version":1,"debugenabled":false,"service_domain":"light","service":"turn_off","entityId":"light.hallway_kids_bedrooms","data":"","dataType":"json","mergecontext":"","output_location":"payload","output_location_type":"msg","mustacheAltTags":false,"x":3120,"y":160,"wires":[[]]},{"id":"33abe5c6.86c1da","type":"time-based-dimmer","z":"36bc7cc3.f1a1fc","name":"Dimmer","interval":"10000","step":"10","minValue":0,"maxValue":100,"startIncCommand":"null","stopIncCommand":"null","startDecCommand":"off","stopDecCommand":"on","x":2920,"y":280,"wires":[["c62dec14.ec878","15b65c2f.91fb74"]],"info":"Starting value is from current state node"},{"id":"203bea0a.765876","type":"delay","z":"36bc7cc3.f1a1fc","name":"12s","pauseType":"delay","timeout":"12","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":2930,"y":160,"wires":[["175b578a.69c138"]]},{"id":"5aa98493.185bac","type":"server-state-changed","z":"36bc7cc3.f1a1fc","name":"Kid's Hallway - Motion","server":"f0d8d950.180ef8","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"binary_sensor.motion_kids_hallway_sensors","entityidfiltertype":"substring","outputinitially":false,"state_type":"str","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":false,"for":"","forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"x":1720,"y":100,"wires":[["fff03b5f.7e29d8","ae69ae1.deaba5"]]},{"id":"ae69ae1.deaba5","type":"function","z":"36bc7cc3.f1a1fc","name":"On to Off","func":"var newState = msg.data.new_state.state;\nvar oldState = msg.data.old_state.state;\nif (oldState == \"on\" && newState == \"off\") {\n return [ msg, null ];\n}\nelse { return [ null, null ]; \n}","outputs":1,"noerr":0,"x":1720,"y":260,"wires":[["b3869a8d.6cfc68"]]},{"id":"fff03b5f.7e29d8","type":"function","z":"36bc7cc3.f1a1fc","name":"Off to On","func":"var newState = msg.data.new_state.state;\nvar oldState = msg.data.old_state.state;\nif (oldState == \"off\" && newState == \"on\") {\n return [ msg, null ];\n}\nelse { return [ null, null ]; \n}","outputs":1,"noerr":0,"x":1720,"y":220,"wires":[["3844750f.09ce6a"]]},{"id":"b3869a8d.6cfc68","type":"api-current-state","z":"36bc7cc3.f1a1fc","name":"Override On?","server":"f0d8d950.180ef8","version":1,"outputs":2,"halt_if":"100","halt_if_type":"num","halt_if_compare":"gte","override_topic":true,"entity_id":"input_number.hallway_kids_bedrooms","state_type":"num","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":1880,"y":260,"wires":[[],["f4e4fa3f.a7d768"]]},{"id":"aff9d87a.876af8","type":"api-call-service","z":"36bc7cc3.f1a1fc","name":"20% Brightness","server":"f0d8d950.180ef8","version":1,"debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"light.hallway_kids_bedrooms","data":"{\"brightness_pct\":\"20\"}","dataType":"json","mergecontext":"","output_location":"payload","output_location_type":"msg","mustacheAltTags":false,"x":2480,"y":100,"wires":[["666d31b8.c9137"]]},{"id":"27e4de95.d8e292","type":"time-range-switch","z":"36bc7cc3.f1a1fc","name":"22:00-06:00","lat":"","lon":"","startTime":"22:00","endTime":"06:00","startOffset":0,"endOffset":0,"x":2250,"y":100,"wires":[["aff9d87a.876af8"],["e676ac62.05604"]]},{"id":"f167f2f3.03f84","type":"time-range-switch","z":"36bc7cc3.f1a1fc","name":"","lat":"","lon":"","startTime":"06:00","endTime":"08:00","startOffset":0,"endOffset":0,"x":2250,"y":220,"wires":[["b595d345.5376f"],["905dbf87.ed753"]],"outputLabels":["Yes","No"]},{"id":"e676ac62.05604","type":"time-range-switch","z":"36bc7cc3.f1a1fc","name":"","lat":"","lon":"","startTime":"20:00","endTime":"22:00","startOffset":0,"endOffset":0,"x":2250,"y":160,"wires":[["b595d345.5376f"],["f167f2f3.03f84"]]},{"id":"b595d345.5376f","type":"api-call-service","z":"36bc7cc3.f1a1fc","name":"35% Brightness","server":"f0d8d950.180ef8","version":1,"debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"light.hallway_kids_bedrooms","data":"{\"brightness_pct\":\"35\"}","dataType":"json","mergecontext":"","output_location":"payload","output_location_type":"msg","mustacheAltTags":false,"x":2480,"y":160,"wires":[["adc868b.6eabc98"]]},{"id":"905dbf87.ed753","type":"api-call-service","z":"36bc7cc3.f1a1fc","name":"50% Brightness","server":"64bd0fa0.d5bf18","version":1,"debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"light.hallway_kids_bedrooms","data":"{\"brightness_pct\":\"50\"}","dataType":"json","mergecontext":"","output_location":"payload","output_location_type":"msg","mustacheAltTags":false,"x":2480,"y":220,"wires":[["ac283499.b78578"]]},{"id":"1b3f267e.d371ca","type":"time-range-switch","z":"36bc7cc3.f1a1fc","name":"Dark Out?","lat":"38.777662","lon":"-121.389895","startTime":"goldenHour","endTime":"sunrise","startOffset":"","endOffset":"+60","x":2030,"y":160,"wires":[["27e4de95.d8e292"],[]]},{"id":"b0cb7f9.625518","type":"change","z":"36bc7cc3.f1a1fc","name":"20%","rules":[{"t":"set","p":"payload","pt":"msg","to":"20","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":2750,"y":100,"wires":[["33abe5c6.86c1da"]]},{"id":"e242920a.b3d6e","type":"change","z":"36bc7cc3.f1a1fc","name":"35%","rules":[{"t":"set","p":"payload","pt":"msg","to":"35","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":2750,"y":160,"wires":[["33abe5c6.86c1da"]]},{"id":"fc90e42b.c0d998","type":"change","z":"36bc7cc3.f1a1fc","name":"50%","rules":[{"t":"set","p":"payload","pt":"msg","to":"50","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":2750,"y":220,"wires":[["33abe5c6.86c1da"]]},{"id":"666d31b8.c9137","type":"delay","z":"36bc7cc3.f1a1fc","name":"1s","pauseType":"delay","timeout":"1","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":2630,"y":100,"wires":[["b0cb7f9.625518"]]},{"id":"adc868b.6eabc98","type":"delay","z":"36bc7cc3.f1a1fc","name":"1s","pauseType":"delay","timeout":"1","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":2630,"y":160,"wires":[["e242920a.b3d6e"]]},{"id":"ac283499.b78578","type":"delay","z":"36bc7cc3.f1a1fc","name":"1s","pauseType":"delay","timeout":"1","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":2630,"y":220,"wires":[["fc90e42b.c0d998"]]},{"id":"f0d8d950.180ef8","type":"server","name":"Home Assistant","addon":true},{"id":"64bd0fa0.d5bf18","type":"server","name":"Home Assistant","legacy":false,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true}]

woozar commented 3 years ago

looks good for me. did you debug if the correct message is reaching the inbound side of the node? I am sorry, but I don't know how to support in this case.