I have a system to control my valve based on the input from the sensor.
If the value of sensor is below 0.27, I need the valve to switch ON and below the value 0.25, I need it to switch OFF. I have used the Hysteresis to obtain this functionality.
But, I am trying to obtain a chart in the dhashboard to show the state of the Hysteresis. I get the following chart.
Instead of the slant line I want the charts to display the state until there is no change. For example:
either 0 or 1 (On or off state). I am trying to write a function but not successful in retaining the previous state for the graph.
Also can I have a variable (counter) to count the number of the times the state has switched On and to check how long in a day that the valve was in ON state in a day?
I am new to prograamming and would be happy to get your suggestions and try things to get the result. Thank you for the reply.
type or paste code here
[{"id":"5cc803a0.00daac","type":"inject","z":"19ee434e.bdaadd","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":".20","payloadType":"num","x":180,"y":220,"wires":[["44b50f76.5c776"]]},{"id":"d6bbbb38.1ea408","type":"inject","z":"19ee434e.bdaadd","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":".26","payloadType":"num","x":180,"y":340,"wires":[["44b50f76.5c776"]]},{"id":"28de5d46.326362","type":"inject","z":"19ee434e.bdaadd","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":".30","payloadType":"num","x":180,"y":460,"wires":[["44b50f76.5c776"]]},{"id":"44b50f76.5c776","type":"hysteresis","z":"19ee434e.bdaadd","name":"","ThresholdType":"fixed","ThresholdRising":".27","ThresholdFalling":".25","TopicThreshold":"","TopicCurrent":"","ThresholdDeltaRising":"","ThresholdDeltaFalling":"","InitialMessage":false,"OutRisingType":"num","OutRisingValue":"1","OutFallingType":"num","OutFallingValue":"0","OutTopicType":"top","OutTopicValue":"","DynRaiseError":false,"x":470,"y":340,"wires":[["896bcf1d.0aa85","65b0e7b9.1c3518","a62990d5.b73be"]]},{"id":"65b0e7b9.1c3518","type":"ui_chart","z":"19ee434e.bdaadd","name":"","group":"3e9d2da9.93da42","order":0,"width":0,"height":0,"label":"chart","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"","ymax":"","removeOlder":"24","removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"useUTC":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"outputs":1,"useDifferentColor":false,"x":980,"y":300,"wires":[]},{"id":"896bcf1d.0aa85","type":"debug","z":"19ee434e.bdaadd","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":730,"y":260,"wires":},{"id":"3e9d2da9.93da42","type":"ui_group","name":"Default","tab":"86a34ae4.73b6c8","order":1,"disp":true,"width":"6","collapse":false},{"id":"86a34ae4.73b6c8","type":"ui_tab","name":"Home","icon":"dashboard","disabled":false,"hidden":false}]