Integration von MySensors in FHEM geplant?

Begonnen von fh555, 06 September 2014, 00:40:58

Vorheriges Thema - Nächstes Thema

ntruchsess

#240
Undefined subroutine &MYSENSORS::DEVICE::ReadingsVal called at ./FHEM/10_MYSENSORS_DEVICE.pm line 428.
-> fixed in rev. 6929.


Zitat von: Aloha am 09 November 2014, 15:18:15
Since my temperature sensors are working fine now I continued with testing a power meter pulse sensor. It was not recognised automatically by the autoconfig[...]

could you update to latest svn, remove all attributes of MYSENSOR_102 leaving/setting 'attr MYSENSOR_102 verbose 5' and also attr verbose 5 on the MYSENSOR-gateway device and then redo the autocreate and post the output (everything that shows up after turning on the sensor?

EDIT: added fix for processing of request-msg: rev. 6931. This is required for S_POWER-sensor
while (!asleep()) {sheep++};

Aloha

Did you change anything else? This time the autoconfig worked and the sensor was added.  :)

There was a slight problem though. If I connect the sensor before enabling autoconfig Fherm crash with the following error message:

no reading-mapping for childId 1, type value1 at ./FHEM/10_MYSENSORS_DEVICE.pm line 530.

And the last thing the logs show:
2014.11.09 19:07:00 5: MYSENSORS gateway gateway: read: 102-102-0 s=1,c=0,t=13,pt=0,l=3:1.4
2014.11.09 19:07:00 5: MYSENSORS Read: Rx: fr=102 ci=001 c=000(C_PRESENTATION) st=013(S_POWER         ) ack=0 '1.4'

2014.11.09 19:07:00 4: MYSENSORS_DEVICE node: errors on C_PRESENTATION-message for childId 1, subType S_POWER no mapReading for 1, power, no mapReading for 1, energy, no mapReading for 1, value1, no setReading for 1, value1
2014.11.09 19:07:00 5: MYSENSORS/RAW: 0;0;3;0;9;read: 102-1/02-0 s=1,c=2,t=24,pt=0,l=3:1.4
102;1;2;0;24;1.4

2014.11.09 19:07:00 5: MYSENSORS Read: Rx: fr=000 ci=000 c=003(C_INTERNAL    ) st=009(I_LOG_MESSAGE   ) ack=0 'read: 102-102-0 s=1,c=2,t=24,pt=0,l=3:1.4'

2014.11.09 19:07:00 5: MYSENSORS gateway gateway: read: 102-102-0 s=1,c=2,t=24,pt=0,l=3:1.4
2014.11.09 19:07:00 5: MYSENSORS Read: Rx: fr=102 ci=001 c=002(C_REQ         ) st=024(V_VAR1          ) ack=0 '1.4'


/ Thomas

ntruchsess

Thank's for reporting. I didn't build a sensor that uses C_REQ-message yet, so this is valueable for me.

Zitat von: Aloha am 09 November 2014, 19:22:31
Did you change anything else? This time the autoconfig worked and the sensor was added.  :)
no nothing else changed. Seems the gateway didn't receive the presentation-messages while inclusion-mode was active.

Zitat von: Aloha am 09 November 2014, 19:22:31
no reading-mapping for childId 1, type value1 at ./FHEM/10_MYSENSORS_DEVICE.pm line 530.
-> fixed in rev. 6934. (Now it's logged, not crashing).
while (!asleep()) {sheep++};

fh168

#243
Hallo Norbert,

hast du mal den 433MHzSensor aus der MySensor Library zusammengesteckt?
Klasse Sache, ich bekomme von meinem Nachbarn die Temperatur von dem 433 MHz Thermometer angezeigt.
Verdammt kalt geworden :-).
Wenn man eine Steckdosen-Baumarkt-Fernbedienung besitzt, kann man da auch die Codes herausbekommen.

Wäre schön wenn man das in Fhem auch sofort einbauen könnte :-)

Temperature: 10.4
Temperature: 10.4
Temperature: 10.4
Temperature: 10.4
Code: 6068, period: 324us.
Temperature: 10.4
Temperature: 10.4
Temperature: 10.4
Temperature: 10.4


Man sollte bei den 433 MHz - Receivern nicht die billigen kaufen, die funktionieren nur einige Meter. Ich habe das in meinem Blog damals nochmal erwähnt http://blog.moneybag.de/fhem-preiswerter-433-mhz-funkbewegungsmelder-pir/


LG
/robin
Hue, Lacrosse, PCA301, MySensors, V 1.67 CUL 868 V3.4, Lacrosse-WLAN-Gateway, Tasmota RF-

ntruchsess

das ist ja nett, habe ich aber noch nicht mit gespielt ;-)

Hast Du Vorschläge, was man da wie 'integrieren' würde? (Also was soll fhem machen, wenn eine bestimmte Message reinkommt?)
while (!asleep()) {sheep++};

fh168

#245
Hallo Norbert,

logo habe ich das:
Vielleicht könnte man den Sketch erweitern das man auch noch 433 MHz senden kann..

Vorschläge:

Man könnte wie oben beschrieben die 433 MHz Thermometer empfangen, interessant, das es bei mir sofort geklappt hat.

Man könnte mit einer billig Baumarkt-Fernbedienung bspw. nicht nur Steckdosen schalten sondern auch eine Philips oder oder komplette Scenes an und ausschalten.

Man könnte die Daten von einem 433 MHz-Bewegungsmelder abfangen:
http://blog.moneybag.de/fhem-preiswerter-433-mhz-funkbewegungsmelder-pir/

Man könnte die DAetn von einem 433 MHz-Tür-Fensterkontakt abfangen:
http://blog.moneybag.de/tuer-fenster-kontakt-sensor-auf-433-mhz-basis/


Ich habe damals mal ein Video darüber gemacht, viele positive Reaktionen bekommen. Ich komme aber derzeitig noch nicht dazu, noch eins zu machen:

https://www.youtube.com/watch?v=sHT_ubQH4nk

Ich habe noch ein paar von den 433-MHz Emfänger, haben eine gute Reichweite.

Die einzelnen Module habe ich bei mir im Einsatz, auch Empfang über den Arduino. Im Grunde müsste man den Source-Code nur mit dem Mysensors-Code verbinden. ich bin aber nicht so da im Thema.

Das Senden geht von derzeitig noch über den Raspberry Pi ist aber auch kein Hexenwerk.

Wie gesagt im ersten Schritt könnte man die empfangenen Daten (Temperatur, Baumarkt-FB) in Fhem automatisch als Reading (?) anlegen lassen. Und die kann man ja wieder mit Fhem auslesen.

LG
/robin

Hue, Lacrosse, PCA301, MySensors, V 1.67 CUL 868 V3.4, Lacrosse-WLAN-Gateway, Tasmota RF-

ntruchsess

jetzt habe ich mal einen Blick in den RF433MhzSensor.ino-sketch geworfen, der bei den MySensors-beispielen dabei ist.Der kommuniziert ja gar nicht über die MySensors-library, wieso haben die den überhaupt mit zu den Beispielen gepackt? Ich sehe keine sinnvolle Möglichkeit das in die MYSENSORS-module zu integrieren.

Zur Kommunikation mit 433MHz Geräten gibt es ja schon einige andere FHEM-Module mit anderer Basis.
while (!asleep()) {sheep++};

fh168

schade, dann hätte ich wieder einen USB-Platz frei bekommen. Derzeitig nehme ich zum Empfang von 433 MHz Signalen einen Arduino Nano mit 433 Mhz-Empfänger.
Hue, Lacrosse, PCA301, MySensors, V 1.67 CUL 868 V3.4, Lacrosse-WLAN-Gateway, Tasmota RF-

fh555

Hallo,

ich habe mal wieder eine Frage (welche nicht expliziert mit MySensors zu tun hat) :
Man kann ja an ein Modul mehrere Sensoren anschließen aber wie bekommt man diese verschiedenen Sensoren für das entsprechende Modul grafisch in der Weboberfläche angezeigt?

Bsp.:
Modul_100
      |
Switch_1        on
Switch_2        off
Temperature  25.0


Im Anhang mal die Konfiguration von einen Dual-Switch,
also ggf. 2 von diesen Lampen-Symbolen oder statt den Lampen-Symbol zwei Schalter oder on/off.




ntruchsess

while (!asleep()) {sheep++};

eppi

Hallo zusammmen
Ich scheitere bereits ganz am Anfang und benötige einen Schubser von euch  ;)

Auf einen Arduino Uno mit Wiznet5100 habe ich mittels Arduino-Tool 1.58 den Example Sketch MySensors/Ethernet/ErthernetGateway geladen. Danach die Macadresse und die IP des Arduino angepasst:


#include <SPI.h> 
#include <MySensor.h>
#include <MyGateway.h> 
#include <stdarg.h>

// Use this fo WizNET module and Arduino Ethernet Shield
#include <Ethernet.h>   


#define INCLUSION_MODE_TIME 1 // Number of minutes inclusion mode is enabled
#define INCLUSION_MODE_PIN  3 // Digital pin used for inclusion mode button

#define RADIO_CE_PIN        5  // radio chip enable
#define RADIO_SPI_SS_PIN    6  // radio SPI serial select
#define RADIO_ERROR_LED_PIN 7  // Error led pin
#define RADIO_RX_LED_PIN    8  // Receive led pin
#define RADIO_TX_LED_PIN    9  // the PCB, on board LED

#define IP_PORT 5003        // The port you want to open
IPAddress myIp (192, 168, 2, 104);  // Configure your static ip-address here    COMPILE ERROR HERE? Use Arduino IDE 1.5.7 or later!

// The MAC address can be anything you want but should be unique on your network.
// Newer boards have a MAC address printed on the underside of the PCB, which you can (optionally) use.
// Note that most of the Ardunio examples use  "DEAD BEEF FEED" for the MAC address.
byte mac[] = { 0xDF, 0xDA, 0x51, 0x7C, 0x29, 0x85 };  // DEAD BEEF FEED

// a R/W server on the port
EthernetServer server = EthernetServer(IP_PORT);

// No blink or button functionality. Use the vanilla constructor.
MyGateway gw(RADIO_CE_PIN, RADIO_SPI_SS_PIN, INCLUSION_MODE_TIME);

// Uncomment this constructor if you have leds and include button attached to your gateway
//MyGateway gw(RADIO_CE_PIN, RADIO_SPI_SS_PIN, INCLUSION_MODE_TIME, INCLUSION_MODE_PIN, RADIO_RX_LED_PIN, RADIO_TX_LED_PIN, RADIO_ERROR_LED_PIN);


char inputString[MAX_RECEIVE_LENGTH] = "";    // A string to hold incoming commands from serial/ethernet interface
int inputPos = 0;

void setup() 
{
  // Initialize gateway at maximum PA level, channel 70 and callback for write operations
  gw.begin(RF24_PA_LEVEL_GW, RF24_CHANNEL, RF24_DATARATE, writeEthernet);

  Ethernet.begin(mac, myIp);

  // give the Ethernet interface a second to initialize
  delay(1000);

  // start listening for clients
  server.begin();
}

// This will be called when data should be written to ethernet
void writeEthernet(char *writeBuffer) {
  server.write(writeBuffer);
}


void loop()
{
  // if an incoming client connects, there will be
  // bytes available to read via the client object
  EthernetClient client = server.available();

  if (client) {
      // if got 1 or more bytes
      if (client.available()) {
         // read the bytes incoming from the client
         char inChar = client.read();

         if (inputPos<MAX_RECEIVE_LENGTH-1) {
           // if newline then command is complete
           if (inChar == '\n') { 
              // a command was issued by the client
              // we will now try to send it to the actuator
              inputString[inputPos] = 0;

              // echo the string to the serial port
              Serial.print(inputString);

              gw.parseAndSend(inputString);

              // clear the string:
              inputPos = 0;
           } else { 
             // add it to the inputString:
             inputString[inputPos] = inChar;
             inputPos++;
           }
        } else {
           // Incoming message too long. Throw away
           inputPos = 0;
        }
      }
   } 
   gw.processRadioMessage();   
}



Das Compilieren wie auch der Upload funktioniert problemlos und bekomme auch keine Fehlermeldungen. Wenn ich aber danach einen Ping absetze auf die IP des Arduino (192.168.2.104) bekomme ich keine Antwort.

Um sicherzustellen, dass die Hardware funktioniert, habe ich den Ethernet WebServer aus der Standard Liberary installiert (gleiche IP und gleiche MAC Adresse), danach hat der Arduino schön brav auf die Pings geantwortet.

Kann mir jemand einen Tipp geben?
Danke und Gruss Dani

ntruchsess

schließ mal den Serial-monitor (115200 baud) an, und schau, ob der Sketch überhaupt sauber initialisiert. Wenn das nRF24L01-modul nicht korrekt verbunden ist, kommt da 'check wires', ansonsten sowas wir 'startup ok'
while (!asleep()) {sheep++};

eppi

Hallo Norbert
Danke für den Tip! Im Serial Monitor kommt:
0;0;3;0;9;check wires

Ich habe noch kein nRF24L01 angeschlossen (Nur Ethernet und USB-Power). Könnte das der Grund sein, dass ich ihn nicht pingen kann?

Gruss Dani

ntruchsess

while (!asleep()) {sheep++};

eppi

Hallo Norbert
Ich habe nun das nRF24L01 wie folgt angeschlossen:
GND GND
3.3V VCC
A2 MISO
A1 MOSI
A0 SCK
6 CSN
5 CE


Leider lässt sich der Arduino nach wie vor nicht pingen. Ich habe mal noch den MQTT-Gateway Sketch in der MySensors Library versucht, der funktioniert auf anhieb.

Hast du noch einen Tip wo ich suchen könnte?
Danke und Gruss Dani