HI,
I NEED TO CHANGE ATTRIBUTE, V_VAR1 ON MY NODE (MYSENSORS) SERIAL. HOW CAN DO THAT WITH NODE-RED IN HA. I JUST WANT TO CHANGE VALUE BECAUSE I DON'T SEE ANY SERVICE CAN DO THAT.
THANKS.
HI,
I NEED TO CHANGE ATTRIBUTE, V_VAR1 ON MY NODE (MYSENSORS) SERIAL. HOW CAN DO THAT WITH NODE-RED IN HA. I JUST WANT TO CHANGE VALUE BECAUSE I DON'T SEE ANY SERVICE CAN DO THAT.
THANKS.
HI,
I installed this firmware in HAAS and it works fine. It controls my 8 relays without problem and the status remains the same when I restart my nano, it takes the same status.
I have problems only at the start to detect the relays in HASS. I have tried several things but I would like to know how to avoid it if the status has already been detected. In other words, the first initiation.
#include <Arduino.h>
/**
*
* REVISION HISTORY
* Cette version est fonctionnel et est compatible avec Home Assistant (Sauf l'initialisation)
* Utilise le composant 74HC595 pour réduire le nombre de fils.
*
* DESCRIPTION
* Ce firmware utilise 8 sorties pour relais
* V_STATUS sert seulement pour le statu de sortie
* V_CUSTOM est pour activé les relais.
*/
// Mettre le mode DEBUG ou l'enlever en commentaire
#define MY_DEBUG
// Enable and select radio type attached
#define MY_RADIO_RF24
//#define MY_RADIO_RFM69
//#define MY_IS_RFM69HW
//#define MY_RFM69_NEW_DRIVER // Use new RFM69 Driver (include ATC)
//#define MY_RFM69_FREQUENCY RFM69_868MHZ
#define MY_REPEATER_FEATURE
#include <SPI.h>
#include <MySensors.h>
#define SN "8_Relais"
#define SV "1.2"
#define NB_OUTPUTS 8
#define OUTPUT_SER 7 // Serial data comes on this pin
#define OUTPUT_RCLK 8 // This is the LATCH pin. Data is released when the pin goes HI
#define OUTPUT_SRCLK 4 // Clock pin
#define HEARTBEAT_DELAY 3600000
#define pinEnable 6 // C'est dans la conception du board. La pin D6 doit être à 0 pour que le 74HC595 soit enable.
byte outputStates;
unsigned long lastHeartBeat=0;
void changeOutputState(int i, boolean newState){
bitWrite(outputStates, i, newState);
// Lock latch
digitalWrite(OUTPUT_RCLK, LOW);
// Write bits
shiftOut(OUTPUT_SER, OUTPUT_SRCLK, MSBFIRST, outputStates);
// Unlock latch
digitalWrite(OUTPUT_RCLK, HIGH);
}
void setup() {
pinMode( OUTPUT_SER, OUTPUT);
pinMode( OUTPUT_RCLK, OUTPUT);
pinMode( OUTPUT_SRCLK, OUTPUT);
pinMode( pinEnable, OUTPUT);
digitalWrite(pinEnable, LOW); // On met ici toujour la pin D6 à LOW
}
void presentation() {
// On envoie ici la version et le nom du Sketch
sendSketchInfo(SN, SV);
// On présente les relais selon le nombre établi au départ.
for (int i=0; i< NB_OUTPUTS; i++){
present(i, S_BINARY );
}
}
void loop(){
// Send a HeartBeat frequently so Domoticz see us as alive.
if (millis() > lastHeartBeat + HEARTBEAT_DELAY){
lastHeartBeat = millis();
sendHeartbeat();
}
}
void receive(const MyMessage &message){
boolean currentStatus;
switch(message.type){
case V_CUSTOM:
// Revert output status :
currentStatus=bitRead(outputStates, message.sensor);
changeOutputState(message.sensor, !currentStatus);
break;
case V_STATUS:
changeOutputState(message.sensor, message.getBool());
break;
}
// Send new state :
currentStatus=bitRead(outputStates, message.sensor);
MyMessage msg(message.sensor, V_STATUS);
msg.set(currentStatus);
send(msg);
}
Thank if somebody known
Bien,
J'ai trouvé la manière d'aller chercher ces variables depuis Home Assistant. Je pense qu'il ne faut pas le faire par le fichier même mais par les attributs de l'entité. Reste pour moi de trouver un moyen de modifié ces variables.
{{ state_attr('switch.relaisboard_2_2', 'V_VAR1') }} // result 1
{{ state_attr('switch.relaisboard_2_2', 'V_VAR2') }} // result 5
Je continue mes investigations.
Hi,
Re: WaterMeterPulseSensor not showing up in HA UI
Just add manually VAR_1 into your persistence file or send message via firwware for create it.
I don't know why Home Assistant can't create itself by only request command.
View in firmware, if no VAR_1 exist, a loop is infinite ???? Weird thing.
Regards,
Hi,
Somebody know how can change value in the persistence file via a card on Home Assistant for specific sensor node/id ?
"5": {
"id": 5,
"type": 3,
"description": "",
"values": {
"24": "1", // Need change this value
"25": "5", // Need change this value
"2": "0"```
Hi,
You can fix variable with sending data. In the firmware, you must add this function for place value in this V_VARx
So, place this function into your setup firmware.
Where in this case
MyMessage var1valve(CHILD_ID_SPRINKLER, V_VAR1);
MyMessage var2valve(CHILD_ID_SPRINKLER, V_VAR2);
This loop repeat for each relay (i) and you can set any value at the end (1) for one minutes and (5) for five minutes.
That's all.
void goInitiateValveTime() {
for (byte i = 0; i <= NUMBER_OF_VALVES; i++)
{
send(var1valve.setSensor(i).set(1));
wait(50);
send(var2valve.setSensor(i).set(5));
}
wait(50);
lastValve = -1;
}
Refresh Home Assistant just after run one time your script and value appear in your persistence file.
Regars,