Thanks for your reply @Mikefila
Well, I think I finally got it to work. This is what I did:
- I used “node-red-contrib-blindcontroller” instead of “node-red-contrib-blindcontroller-v2”. For any reason, the v2 did’t compute any blind position percentage. It remained “undetermined” all the time.
- In my case, 0% is closed, but when enabling this option I got a warning when deploying becasue of an error: “toLowerCase is not a function”. I ignored it and deployed it anyway. It worked well.
The problem I have now is that my blinds are automated with a shelly 2.5 pm. This device calibrates the positions of the blind in such a way the percentage of aperture is computed by considering the total travel time. Roller shutters here in Spain continue travelling down for a little more time once the bottom edge has hit the floor. So for example, a 50% closed for my blinds corresponds to a lower position of the bottom edge of the blind (more or less a 70%). I have to figure out now how to correct this effect.
I share my flow in case you find it useful. Please note that this is the first node-red flow I write. Probably the connection of the blind controller output to the home assistante service can be done in a smarter way:
[{"id":"67c64dc392e2637e","type":"tab","label":"Persianas / Sol","disabled":false,"info":"Ajusta la posición de las persianas en \r\nfunción de la posición del sol. \r\nEn verano minimiza la radiación solar y\r\nen invierno la maximiza.","env":[]},{"id":"c57a34a54778c575","type":"inject","z":"67c64dc392e2637e","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"*/5 10-20 * * *","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":130,"y":460,"wires":[["ae247d81706923ad"]]},{"id":"ae247d81706923ad","type":"sunpos","z":"67c64dc392e2637e","name":"","lon":"-2.000","lat":"40.000","start":"sunrise","startoffset":0,"end":"sunset","endoffset":0,"x":310,"y":460,"wires":[["f221b831382dc208","57bf1854ca30a181","6990363b6a0f4c4f"]]},{"id":"febb0c2cdddceb7e","type":"debug","z":"67c64dc392e2637e","name":"debug 1","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":660,"y":280,"wires":[]},{"id":"f221b831382dc208","type":"debug","z":"67c64dc392e2637e","name":"debug 2","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":360,"y":300,"wires":[]},{"id":"859a672140797655","type":"api-call-service","z":"67c64dc392e2637e","name":"Posicionar Persiana","server":"e3da66e2.912be8","version":5,"debugenabled":true,"domain":"cover","service":"set_cover_position","areaId":[],"deviceId":[],"entityId":["cover.dormitoriopersiana_cover_0"],"data":"{\"position\":msg.data.position}","dataType":"jsonata","mergeContext":"","mustacheAltTags":true,"outputProperties":[],"queue":"none","x":940,"y":360,"wires":[[]]},{"id":"57bf1854ca30a181","type":"blindcontroller","z":"67c64dc392e2637e","name":"Dormitorio","mode":"Summer","channel":"1","orientation":"180","noffset":"","poffset":"","top":"189","bottom":"25","depth":"50","altitudethreshold":"","increment":"1","maxopen":"","maxclosed":"","temperaturethreshold":"","temperaturethresholdposition":"","cloudsthreshold":"","cloudsthresholdposition":"","uvindexthreshold":"","uvindexthresholdposition":"","nightposition":"","expiryperiod":"","opposite":true,"x":550,"y":360,"wires":[["febb0c2cdddceb7e","e347f5619a9a04b3"]]},{"id":"e347f5619a9a04b3","type":"function","z":"67c64dc392e2637e","name":"function 1","func":"var pos = msg.data.blindPosition\nmsg.data.position = pos;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":740,"y":360,"wires":[["859a672140797655"]]},{"id":"6990363b6a0f4c4f","type":"blindcontroller","z":"67c64dc392e2637e","name":"Gimnasio 1","mode":"Summer","channel":"1","orientation":"180","noffset":"","poffset":"","top":"189","bottom":"25","depth":"50","altitudethreshold":"","increment":"1","maxopen":"","maxclosed":"","temperaturethreshold":"","temperaturethresholdposition":"","cloudsthreshold":"","cloudsthresholdposition":"","uvindexthreshold":"","uvindexthresholdposition":"","nightposition":"","expiryperiod":"","opposite":true,"x":550,"y":460,"wires":[["92528672d46dba1a"]]},{"id":"92528672d46dba1a","type":"function","z":"67c64dc392e2637e","name":"function 2","func":"var pos = msg.data.blindPosition\nmsg.data.position = pos;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":740,"y":460,"wires":[["37be22882154b0a2"]]},{"id":"37be22882154b0a2","type":"api-call-service","z":"67c64dc392e2637e","name":"Posicionar Persiana","server":"e3da66e2.912be8","version":5,"debugenabled":true,"domain":"cover","service":"set_cover_position","areaId":[],"deviceId":[],"entityId":["cover.gimnasiopersiana1"],"data":"{\"position\":msg.data.position}","dataType":"jsonata","mergeContext":"","mustacheAltTags":true,"outputProperties":[],"queue":"none","x":940,"y":460,"wires":[[]]},{"id":"e3da66e2.912be8","type":"server","name":"Home Assistant","version":4,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":false,"cacheJson":true,"heartbeat":false,"heartbeatInterval":"30","areaSelector":"friendlyName","deviceSelector":"friendlyName","entitySelector":"friendlyName","statusSeparator":"at: ","statusYear":"hidden","statusMonth":"short","statusDay":"numeric","statusHourCycle":"h23","statusTimeFormat":"h:m"}]