Fail Percentage Blind control in domoticz
Moderator: leecollings
-
- Posts: 1
- Joined: Monday 15 May 2017 21:35
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Fail Percentage Blind control in domoticz
Hi, I'm trying to control a blind with V_percentage and the problem is that Domoticz does not use it. The problem is that the option V_Percentaje in domoticz is not contemplated. It would have to be created and compiled to see if it works. Can somebody help me.
- Attachments
-
- domoticz.png (39.74 KiB) Viewed 6052 times
-
- Posts: 10
- Joined: Saturday 14 February 2015 17:41
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: Netherlands
- Contact:
Re: Fail Percentage Blind control in domoticz
Hi miguelingles, I believe I face the same difficulties. De slider in Domoticz does not work and does not send proper information back to the node. How did you proceed? I turned the node into a dimmer and in Domoticz I choose a blinds with percentage.
-
- Posts: 14
- Joined: Wednesday 23 August 2017 22:14
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Fail Percentage Blind control in domoticz
did someone resolve the problem with percentage control of Blinds using mysensors and domoticz?
-
- Posts: 1
- Joined: Friday 06 April 2018 18:41
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Fail Percentage Blind control in domoticz
Is anybody working on this, it appears it's still not solved?
If not, I might try my hand at this...
If not, I might try my hand at this...
-
- Posts: 26
- Joined: Wednesday 03 August 2016 12:34
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Fail Percentage Blind control in domoticz
I have the same issue
I'm running the lasted stable version 3.8153 on rpi2
but also tested on latest beta
I'm running the lasted stable version 3.8153 on rpi2
but also tested on latest beta
-
- Posts: 2
- Joined: Monday 18 June 2018 12:07
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Fail Percentage Blind control in domoticz
my solution (in beta version):
/*DESCRIPTION
Commande d'orientation d'un store a lamelles via domoticz
materiel: arduino nano ,3 piles 1.5v ,NRF24L01+
Connection servo :rouge->+5V, Black ou maron->GND, blanc ou orange-> pin d3.
connection niveau batterie: A0
The servo consumes much power and should probably have its own powersource.'
The arduino might spontanally restart if too much power is used (happend
to me when servo tried to pass the extreme positions = full load).
version modifié de http://www.mysensors.org/build/servo
*/
// Enable debug prints to serial monitor
#define MY_DEBUG
// Enable and select radio type attached
#define MY_RADIO_NRF24
//#define MY_RF24_PA_LEVEL RF24_PA_MIN // = -18dBm
//#define MY_RF24_PA_LEVEL RF24_PA_LOW // = -12dBm
#define MY_RF24_PA_LEVEL RF24_PA_HIGH // = -6dBm (by defaut)
//#define MY_RF24_PA_LEVEL RF24_PA_MAX // = 0dBm
#include <SPI.h>
#include <MySensors.h>
#include <Servo.h>
#define SERVO_DIGITAL_OUT_PIN 3 //pin du ServoMoteur
#define SERVO_MIN 0 // Fine tune your servos min. 0-180
#define SERVO_MAX 180 // Fine tune your servos max. 0-180
#define DETACH_DELAY 1000 // Tune this to let your movement finish before detaching the servo Temps delais pour finir le mouvement avant de detacher le servomoteur
#define CHILD_ID 1 // Id of the sensor child
#define CHILD_ID_BATTERY 2 //test //battery level
MyMessage msgPCent(CHILD_ID, V_PERCENTAGE);
MyMessage msgStatus(CHILD_ID, V_STATUS);
Servo myservo; // create servo object to control a servo
// a maximum of eight servo objects can be created Sensor gw(9,10);
int BATTERY_SENSE_PIN = A0; //test //battery level
int oldBatteryPcnt = 0; //test //battery level
void setup()
{
// use the 1.1 V internal reference //test //battery level
# if defined(__AVR_ATmega2560__)
analogReference(INTERNAL1V1); //test //battery level
# else //test //battery level
analogReference(INTERNAL); //test //battery level
# endif } //test //battery level //test //battery level
//myservo.attach(SERVO_DIGITAL_OUT_PIN);
// Request last servo state at startup
//request(CHILD_ID, V_PERCENTAGE);
//request(CHILD_ID, V_STATUS);
}
void presentation() {
// Send the sketch version information to the gateway and Controller
sendSketchInfo("Store", "1.1beta");
// Register all sensors to gw (they will be created as child devices)
present(CHILD_ID, S_DIMMER,"store chambre");
}
void loop()
{
int sensorValue = analogRead(BATTERY_SENSE_PIN); //test //battery level // get the battery Voltage
# ifdef MY_DEBUG //test //battery level
Serial.println(sensorValue); //test //battery level
# endif //test //battery level
// 1M, 470K divider across battery and using internal ADC ref of 1.1V //test //battery level
// Sense point is bypassed with 0.1 uF cap to reduce noise at that point //test //battery level
// ((1e6+470e3)/470e3)*1.1 = Vmax = 3.44 Volts //test //battery level
// 3.44/1023 = Volts per bit = 0.003363075 //test //battery level
int batteryPcnt = sensorValue / 10; //test //battery level
if (oldBatteryPcnt != batteryPcnt) {//test //battery level
sendBatteryLevel(batteryPcnt);//test //battery level
oldBatteryPcnt = batteryPcnt;//test //battery level
}
}
void receive(const MyMessage &message) {
if (message.type == V_STATUS && message.getInt()==0 ){
mouvement(100);}
if (message.type == V_STATUS && message.getInt()==1 ){
mouvement( 0);}
if (message.type == V_PERCENTAGE ) {
mouvement(100-message.getInt()); }
}
void mouvement(int PCent) {
myservo.attach(SERVO_DIGITAL_OUT_PIN);
myservo.write(SERVO_MAX + (SERVO_MIN - SERVO_MAX) / 100 *1.8* PCent); // sets the servo position 0-180
Serial.print( "V_PERCENTAGE=" );Serial.println(PCent);
delay(DETACH_DELAY); //
myservo.detach();
}
-
- Posts: 6
- Joined: Sunday 11 March 2018 11:52
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.10717
- Location: Portugal
- Contact:
Re: Fail Percentage Blind control in domoticz
Not yet solved ... i have Domoticz V4.10717 (latest ) and still a bugged percentage bar and no status. I full open(100%) the shutter/blind and still saying closed.
That's the code of mysensors relay shutter module: Easy to replicate.It's just an arduino and an rfm69 or nrf24...relays are not needed for tests.
i can't help more because i'm no programmer
And thats what happening on Domoticz:
[
That's the code of mysensors relay shutter module: Easy to replicate.It's just an arduino and an rfm69 or nrf24...relays are not needed for tests.
i can't help more because i'm no programmer
Code: Select all
// Enable debug prints to serial monitor
#define MY_DEBUG
// Enable and select radio type attached
#define MY_RADIO_RFM69
//#define MY_RF24_PA_LEVEL RF24_PA_LOW
//#define MY_REPEATER_FEATURE
#include <Bounce2.h>
#include <MySensors.h>
#include <SPI.h>
// uncomment if we want to manually assign an ID
//#define MY_NODE_ID 1 /
#define BUTTON_UP_PIN 5 // Arduino Digital I/O pin number for up button
#define BUTTON_DOWN_PIN 6 // Arduino Digital I/O pin number for down button
//#define BUTTON_STOP_PIN 7 // Arduino Digital I/O pin number for stop button
#define RELAY_UP_PIN 3 // Arduino Digital I/O pin number for direction relay
#define RELAY_DOWN_PIN 4 // Arduino Digital I/O pin number for power relay
#define RELAY_ON 0
#define RELAY_OFF 1
//#define RELAY_DOWN 1
//#define RELAY_UP 0
#define DIRECTION_DOWN 1
#define DIRECTION_UP 0
#define SKETCH_NAME "Cover"
#define SKETCH_VER "2.0"
#define CHILD_ID_COVER 0 // sensor Id of the sensor child
#define STATE_UP 100 // 100 is open - up
#define STATE_DOWN 0 // 0 is closed - down
//#define CHILD_ID_CALIBRATE 1 // sensor Id of the sensor child to calibrate
#define CHILD_ID_SET 1 // sensor Id of the sensor child to init the roll time
#define PRESENT_MESSAGE "shuttle for Livingroom"
const int LEVELS = 100; //the number of levels
float rollTime = 28.0; //the overall rolling time of the shutter
const bool IS_ACK = false; //is to acknowlage
static bool initial_state_sent = false;//for hass we need at list one state send at begining
// debouncing parameters
int value = 0;
int oldValueUp = 0;
int oldValueDown = 0;
//int value1=0;int value2=0;
int oldValueStop=0;
int oldValueStop1=0;
//static unsigned long last_interrupt_time_up = 0;
//static unsigned long last_interrupt_time_down = 0;
//static unsigned long debounce_time = 200;
Bounce debouncerUp = Bounce();
Bounce debouncerDown = Bounce();
//Bounce debouncerStop = Bounce();
// shutter position parameters
float timeOneLevel = rollTime / LEVELS;
int requestedShutterLevel = 0;
int currentShutterLevel = 0;
unsigned long lastLevelTime = 0;
bool isMoving = false;
int directionUpDown;
enum CoverState {
STOP,
UP, // Window covering. Up.
DOWN, // Window covering. Down.
};
static int coverState = STOP;
MyMessage msgUP(CHILD_ID_COVER, V_UP);
MyMessage msgDown(CHILD_ID_COVER, V_DOWN);
MyMessage msgStop(CHILD_ID_COVER, V_STOP);
MyMessage msgPercentage(CHILD_ID_COVER, V_PERCENTAGE);
//MyMessage msgCode(CHILD_ID_SET, V_IR_SEND);
void sendState() {
// Send current state and status to gateway.
send(msgUP.set(coverState == UP));
send(msgDown.set(coverState == DOWN));
send(msgStop.set(coverState == STOP));
send(msgPercentage.set(currentShutterLevel));
}
void shuttersUp(void) {
#ifdef MY_DEBUG
Serial.println("Shutters going up");
#endif
if (digitalRead(RELAY_DOWN_PIN) == RELAY_ON) {
digitalWrite(RELAY_DOWN_PIN, RELAY_OFF);
delay(20);
}
digitalWrite(RELAY_UP_PIN, RELAY_ON);
directionUpDown = DIRECTION_UP;
isMoving = true;
coverState = UP;
sendState();
}
void shuttersDown(void) {
#ifdef MY_DEBUG
Serial.println("Shutters going down");
#endif
if (digitalRead(RELAY_UP_PIN) == RELAY_ON) {
digitalWrite(RELAY_UP_PIN, RELAY_OFF);
delay(20);
}
digitalWrite(RELAY_DOWN_PIN, RELAY_ON);
directionUpDown = DIRECTION_DOWN;
isMoving = true;
coverState = DOWN;
sendState();
}
void shuttersHalt(void) {
#ifdef MY_DEBUG
Serial.println("Shutters halted X");
#endif
// Serial.println("2 BOTOES OFF");
// if (digitalRead((RELAY_UP_PIN) || (RELAY_DOWN_PIN) )== RELAY_ON) {
digitalWrite(RELAY_UP_PIN, RELAY_OFF);
digitalWrite(RELAY_DOWN_PIN, RELAY_OFF);
delay(20);
//}
isMoving = false;
requestedShutterLevel = currentShutterLevel;
#ifdef MY_DEBUG
Serial.println("saving state to: ");
Serial.println(String(currentShutterLevel));
#endif
saveState(CHILD_ID_COVER, currentShutterLevel);
coverState = STOP;
//sendState();
}
void changeShuttersLevel(int level) {
int dir = (level > currentShutterLevel) ? DIRECTION_UP : DIRECTION_DOWN;
if (isMoving && dir != directionUpDown) {
shuttersHalt();
}
requestedShutterLevel = level;
}
void initShutters() {
#ifdef MY_DEBUG
Serial.println("Init Cover");
#endif
shuttersUp();
delay((rollTime + timeOneLevel * LEVELS) * 1000);
currentShutterLevel = STATE_UP;
// currentShutterLevel = STATE_UP;
requestedShutterLevel = currentShutterLevel;
}
void receive(const MyMessage &message) {
#ifdef MY_DEBUG
Serial.println("recieved incomming message");
Serial.println("Recieved message for sensor: ");
Serial.println(String(message.sensor));
Serial.println("Recieved message with type: ");
Serial.println(String(message.type));
#endif
if (message.sensor == CHILD_ID_COVER) {
switch (message.type) {
case V_UP:
//Serial.println(", New status: V_UP");
changeShuttersLevel(STATE_UP);
//state = UP;
//sendState();
break;
case V_DOWN:
//Serial.println(", New status: V_DOWN");
changeShuttersLevel(STATE_DOWN);
//state = DOWN;
//sendState();
break;
case V_STOP:
//Serial.println(", New status: V_STOP");
shuttersHalt();
//state = IDLE;
//sendState();
break;
case V_PERCENTAGE:
//Serial.println(", New status: V_PERCENTAGE");
// if (!initial_state_sent) {
// #ifdef MY_DEBUG
// Serial.println("Receiving initial value from controller");
// #endif
// initial_state_sent = true;
// }
int per = message.getInt();
if (per > STATE_UP) {
per = STATE_UP;
}
changeShuttersLevel(per);
//InitShutters(message.getInt());//send value < 0 or > 100 to calibrate
//sendState();
break;
}
}
else if (message.sensor == CHILD_ID_SET) {
if (message.type == V_VAR1) {
Serial.println(", New status: V_VAR1, with payload: ");
String strRollTime = message.getString();
rollTime = strRollTime.toFloat();
Serial.println("rolltime value: ");
Serial.println(String(rollTime));
saveState(CHILD_ID_SET, rollTime);
}
}
#ifdef MY_DEBUG
Serial.println("exiting incoming message");
#endif
return;
}
void before() {
// Setup the button
pinMode(BUTTON_UP_PIN, INPUT_PULLUP);
// Activate internal pull-up
digitalWrite(BUTTON_UP_PIN, HIGH);
//attachInterrupt(digitalPinToInterrupt(BUTTON_UP_PIN), upButtonPress, RISING);
pinMode(BUTTON_DOWN_PIN, INPUT_PULLUP);
// Activate internal pull-up
digitalWrite(BUTTON_DOWN_PIN, HIGH);
// attachInterrupt(digitalPinToInterrupt(BUTTON_DOWN_PIN), downButtonPress, RISING);
//pinMode(BUTTON_STOP_PIN, INPUT_PULLUP);
// Activate internal pull-up
//digitalWrite(BUTTON_STOP_PIN, HIGH);
// After setting up the button, setup debouncer
debouncerUp.attach(BUTTON_UP_PIN);
debouncerUp.interval(5);
// After setting up the button, setup debouncer
debouncerDown.attach(BUTTON_DOWN_PIN);
debouncerDown.interval(5);
// After setting up the button, setup debouncer
// debouncerStop.attach(BUTTON_UP_PIN&&BUTTON_UP_PIN);
// debouncerStop.interval(5);
// Make sure relays are off when starting up
digitalWrite(RELAY_UP_PIN, RELAY_OFF);
// Then set relay pins in output mode
pinMode(RELAY_UP_PIN, OUTPUT);
// Make sure relays are off when starting up
digitalWrite(RELAY_DOWN_PIN, RELAY_OFF);
// Then set relay pins in output mode
pinMode(RELAY_DOWN_PIN, OUTPUT);
}
void presentation() {
// Send the sketch version information to the gateway and Controller
sendSketchInfo(SKETCH_NAME, SKETCH_VER);
// Register all sensors to gw (they will be created as child devices)
present(CHILD_ID_COVER, S_COVER, PRESENT_MESSAGE, IS_ACK);
//present(CHILD_ID_SET, S_CUSTOM);
}
void setup(void) {
//set up roll time if the saved value is not 255
Serial.println("getting rolltime from eeprom: ");
float tmpRollTime = loadState(CHILD_ID_SET);
if (tmpRollTime != 0xff) {
rollTime = tmpRollTime;
}
Serial.println(String(rollTime));
int state = loadState(CHILD_ID_COVER);
#ifdef MY_DEBUG
Serial.println("getting state from eeprom: ");
Serial.println(String(state));
#endif
if (state == 0xff) {
initShutters();
} else {
changeShuttersLevel(state);
}
currentShutterLevel=state;
}
void loop(void) {
if (!initial_state_sent) {
#ifdef MY_DEBUG
Serial.println("Sending initial value");
#endif
sendState();
// send(msgCode.set('20.0'));
// #ifdef MY_DEBUG
// Serial.println("Requesting initial value from controller");
// #endif
// request(CHILD_ID_COVER, V_PERCENTAGE);
// wait(2000, C_SET, V_PERCENTAGE);
initial_state_sent = true;
}
debouncerUp.update();
value = debouncerUp.read();
if (value == 0 && value != oldValueUp) {
changeShuttersLevel(STATE_UP);
//state = UP;
//sendState();
}
oldValueUp = value;
debouncerDown.update();
value = debouncerDown.read();
if (value == 0 && value != oldValueDown) {
changeShuttersLevel(STATE_DOWN);
//state = DOWN;
//sendState();
}
oldValueDown = value;
// debouncerStop.update();
//value = debouncerStop.read();
//if (value == 0 && value !=( oldValueUp||oldValueDown)) {
// debouncerDown.update();
// debouncerUp.update();
value = debouncerUp.rose();
if ((value == 0) && (value != oldValueStop) &&(isMoving==true)){
shuttersHalt();
}
oldValueStop = value;
value = debouncerDown.rose();
if ((value) == 0 && (value != oldValueStop1)&&(isMoving==true)){
shuttersHalt();
}
oldValueStop1 = value;
if (isMoving) {
unsigned long _now = millis();
if (_now - lastLevelTime >= timeOneLevel * 1000) {
if (directionUpDown == DIRECTION_UP) {
currentShutterLevel += 1;
} else {
currentShutterLevel -= 1;
}
#ifdef MY_DEBUG
//Serial.println(String(requestedShutterLevel));
Serial.println(String(currentShutterLevel));
#endif
lastLevelTime = millis();
//send(msgPercentage.set(currentShutterLevel));
}
if (currentShutterLevel == requestedShutterLevel){
shuttersHalt();
}
}
else if (requestedShutterLevel != currentShutterLevel) {
if (requestedShutterLevel > currentShutterLevel) {
shuttersUp();
}
else {
shuttersDown();
}
lastLevelTime = millis();
}
}
And thats what happening on Domoticz:
[
-
- Posts: 528
- Joined: Saturday 02 June 2018 11:05
- Target OS: Raspberry Pi / ODroid
- Domoticz version: V2022.1
- Location: Echt, Netherlands
- Contact:
Re: Fail Percentage Blind control in domoticz
Isn't this how it has to be?Tmaster2018 wrote: ↑Wednesday 07 August 2019 1:10 I full open(100%) the shutter/blind and still saying closed.
You selected inverted blinds.
On my blinds i also have:
100% = close
0% = open
Everything between is percentage level
Thin-client --> Docker Domoticz main environment
Pi3A+ --> Google home (GAssistPi)
Pi3B+ --> Docker (P1monitor, Domoticz test environment, Ubiquity controller)
Pi3A+ --> Google home (GAssistPi)
Pi3B+ --> Docker (P1monitor, Domoticz test environment, Ubiquity controller)
-
- Posts: 6
- Joined: Sunday 11 March 2018 11:52
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.10717
- Location: Portugal
- Contact:
Re: Fail Percentage Blind control in domoticz
No. inverted its because in 1st test i had cables wrong and close and open was inverted ,but i corrected it after ,and test it as normal blind with percentage ,and do the same.Even if i try only "blinds" without percentage bar ,it say always closed
@hoeby ,can you share your code for i understand if its something that i'm doing wrong? .
Do you confirm that an Mysensor with S_COVER presentation it's working on domoticz?
thank you
@hoeby ,can you share your code for i understand if its something that i'm doing wrong? .
Do you confirm that an Mysensor with S_COVER presentation it's working on domoticz?
thank you
-
- Posts: 528
- Joined: Saturday 02 June 2018 11:05
- Target OS: Raspberry Pi / ODroid
- Domoticz version: V2022.1
- Location: Echt, Netherlands
- Contact:
Re: Fail Percentage Blind control in domoticz
My code has nothing to do with arduino.
I can control my blinds bij dashboard (.htm). I can send level values and read. But on my own dashboard, not arduino based
I can control my blinds bij dashboard (.htm). I can send level values and read. But on my own dashboard, not arduino based
Thin-client --> Docker Domoticz main environment
Pi3A+ --> Google home (GAssistPi)
Pi3B+ --> Docker (P1monitor, Domoticz test environment, Ubiquity controller)
Pi3A+ --> Google home (GAssistPi)
Pi3B+ --> Docker (P1monitor, Domoticz test environment, Ubiquity controller)
-
- Posts: 6
- Joined: Sunday 11 March 2018 11:52
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.10717
- Location: Portugal
- Contact:
Re: Fail Percentage Blind control in domoticz
ah of couse. but i have another zwave shutter modules tha work good aswell. the problem it's on mysensors variables i think. V_UP ,V_DOWN,V_STOP AND V_PERCENTAGE That it's the one th not work...
-
- Posts: 14
- Joined: Wednesday 23 August 2017 22:14
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Fail Percentage Blind control in domoticz
Did some one solved the issue with percentage? I have no idea where to start...
If you look a good code working well with dimmer, you can try my version of the code here:
https://github.com/gryzli133/RollerShutterSplit
If you look a good code working well with dimmer, you can try my version of the code here:
https://github.com/gryzli133/RollerShutterSplit
Who is online
Users browsing this forum: No registered users and 0 guests