Integration von MySensors in FHEM geplant?

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

Vorheriges Thema - Nächstes Thema

fh555

Supi, ist jetzt per update verfügbar, eingespielt und ging auf Anhieb  8)
Ich habe jetzt noch einen Bodenfeuchtesensor mit eingeklingt und funktioniert auch auf Anhieb.

Mal noch eine andere Frage  ::)

Ist es möglich, daß das autocreate bei den MySensors Gateway die gefundenen Devices in eine andere Datei, als die fhem.cfg schreibt?
Ich habe der Übersichtlichkeit halber, meine Konfigurationsdateien ausgelagert und binde sie mit "include xxx" in der fhem.cfg ein.


include /opt/fhem/FHEM/fhem_interface.cfg
include /opt/fhem/FHEM/fhem_mysensors.cfg
include /opt/fhem/FHEM/fhem_lacrosse.cfg
include /opt/fhem/FHEM/fhem_it.cfg


und in der "fhem_mysensors.cfg" steht dann alles, was mit den MySensor-Devices zu tun hat.

define MYSENSOR_10 MYSENSORS_DEVICE 10
attr MYSENSOR_10 IODev MYS_GW
attr MYSENSOR_10 alias My_Switch
attr MYSENSOR_10 mapReading_tripped3 3 tripped 0:on 1:off
attr MYSENSOR_10 mode node
attr MYSENSOR_10 room MySensors
attr MYSENSOR_10 stateFormat tripped3
attr MYSENSOR_10 version 1.4

define MYSENSOR_30 MYSENSORS_DEVICE 30
attr MYSENSOR_30 IODev MYS_GW
attr MYSENSOR_30 alias My_Relais
attr MYSENSOR_30 mapReading_switch 1 switch
attr MYSENSOR_30 mode repeater
attr MYSENSOR_30 room MySensors
attr MYSENSOR_30 setReading_switch on,off
attr MYSENSOR_30 stateFormat switch
attr MYSENSOR_30 version 1.4b1 (18848a2)

usw


und in der "fhem_interfaces.cfg" steht zum Bsp.

###################################
## MySensors Gateway usb/seriell ##
###################################
define MYS_GW MYSENSORS /dev/ttyUSB1@115200
attr MYS_GW autocreate 1
attr MYS_GW icon cul_usb
attr MYS_GW room Gateway
attr MYS_GW stateFormat connection
attr MYS_GW verbose 5


Das autocreate ist aber auch "Global"? in der fhem.cfg aktiviert

define autocreate autocreate
attr autocreate autosave 1
attr autocreate device_room %TYPE
attr autocreate filelog ./log/%NAME-%Y.log
attr autocreate weblink 1
attr autocreate weblink_room Plots


Wenn also das neue MySensors Device per autocreate gefunden wurde, steht es ja unter "unsorted" und nach
"save config" steht es in der fhem.cfg.
Ich hätte aber lieber, wenn das was MySensors findet in der "fhem_mysensors.cfg" steht. Geht das?


ntruchsess

#226
nein, das musst Du dann von Hand in eigene Dateien splitten.

das autocreate werde ich vorraussichtlich noch so ändern, dass es das globale 'autocreate' (inklusive room etc.) berücksichtigt.

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

fh555

mhh, naja so mache ich das ja bisher. Ich dachte es geht einfacher  ;)

Mal noch eine Frage  ;)

Kann es sein, dass man bei MySensors nicht mit "alias" arbeiten kann?
Bsp.: welches funktioniert

define schalter1machwas notify MYSENSOR_40 { if (ReadingsVal("MYSENSOR_40","tripped","") eq "on") { fhem "set MYSENSOR_30 switch on" } else { fhem "set MYSENSOR_30 switch off" }}


und so geht es nicht

define My_Pir_Aktivitaet notify My_Pir { if (ReadingsVal("My_Pir","tripped","") eq "on") { fhem "set My_Relais switch on" } else { fhem "set My_Relais switch off" }}


definiert sind beide Teile, wie folgt

define MYSENSOR_30 MYSENSORS_DEVICE 30
attr MYSENSOR_30 IODev MYS_GW
attr MYSENSOR_30 alias My_Relais
attr MYSENSOR_30 mapReading_switch 1 switch
attr MYSENSOR_30 mode repeater
attr MYSENSOR_30 room MySensors
attr MYSENSOR_30 setReading_switch on,off
attr MYSENSOR_30 stateFormat switch
attr MYSENSOR_30 version 1.4b1 (18848a2)


define MYSENSOR_40 MYSENSORS_DEVICE 40
attr MYSENSOR_40 IODev MYS_GW
attr MYSENSOR_40 alias My_Pir
attr MYSENSOR_40 mapReading_tripped 1 tripped
attr MYSENSOR_40 mode node
attr MYSENSOR_40 room MySensors
attr MYSENSOR_40 stateFormat tripped
attr MYSENSOR_40 version 1.4b1 (18848a2)


gebe ich in der Befehlszeile in FHEM
set My_Relais switch on
kommt die Fehlermeldung:
Please define My_Relais first

hexenmeister

ZitatKann es sein, dass man bei MySensors nicht mit "alias" arbeiten kann?
Das geht ja generell in FHEM nicht. Alias sind rein für die Anzeige da. ;)
Maintainer: MQTT_GENERIC_BRIDGE, SYSMON, SMARTMON, systemd_watchdog, MQTT, MQTT_DEVICE, MQTT_BRIDGE
Contrib: dev_proxy

fh555

Hi hexenmeister,

danke, das wußte ich nicht.

fh168

#230
Temperaturmodul klappt immer noch nicht. Es wird zwar angelegt, jedoch keine Daten.
CFGFN
DEF   
100
IODev
gateway
I_SKETCH_NAME
Temperature Sensor
I_SKETCH_VERSION
1.0
NAME
MYSENSOR_100
NR
4771
STATE
???
TYPE
MYSENSORS_DEVICE
ack
0
protocol
1.4
radioId
100
repeater
0

logfile alles tacco

2014.11.08 23:54:51 5: MYSENSORS/RAW: /100;0;1;0;0;26.8

2014.11.08 23:54:51 5: MYSENSORS Read: Rx: fr=100 ci=000 c=001(C_SET         ) st=000(V_TEMP          ) ack=0 '26.8

2014.11.08 23:55:23 5: MYSENSORS/RAW: /100;0;1;0;0;26.5

2014.11.08 23:55:23 5: MYSENSORS Read: Rx: fr=100 ci=000 c=001(C_SET         ) st=000(V_TEMP          ) ack=0 '26.5

2014.11.08 23:55:57 5: MYSENSORS/RAW: /100;0;1;0;0;26.2

2014.11.08 23:55:57 5: MYSENSORS Read: Rx: fr=100 ci=000 c=001(C_SET         ) st=000(V_TEMP          ) ack=0 '26.2

2014.11.08 23:56:32 5: MYSENSORS/RAW: /100;0;1;0;0;26.1

2014.11.08 23:56:32 5: MYSENSORS Read: Rx: fr=100 ci=000 c=001(C_SET         ) st=000(V_TEMP          ) ack=0 '26.1

2014.11.08 23:56:51 1: PERL WARNING: Useless use of private variable in void context at (eval 40992) line 1.
2014.11.08 23:56:51 1: PERL WARNING: Useless use of a constant (actual) in void context at (eval 40992) line 1.
2014.11.08 23:57:04 5: MYSENSORS/RAW: /100;0;1;0;0;25.9

2014.11.08 23:57:04 5: MYSENSORS Read: Rx: fr=100 ci=000 c=001(C_SET         ) st=000(V_TEMP          ) ack=0 '25.9

2014.11.08 23:57:38 5: MYSENSORS/RAW: /100;0;1;0;0;25.7

2014.11.08 23:57:38 5: MYSENSORS Read: Rx: fr=100 ci=000 c=001(C_SET         ) st=000(V_TEMP          ) ack=0 '25.7

2014.11.08 23:58:12 5: MYSENSORS/RAW: /100;0;1;0;0;25.6

2014.11.08 23:58:12 5: MYSENSORS Read: Rx: fr=100 ci=000 c=001(C_SET         ) st=000(V_TEMP          ) ack=0 '25.6



EDIT: Jetzt klappts.. inclusion-mode auf 1  und dann den Temperatur-Arduino resetten. Meiner Meinung nach ist die Inclusion-Zeit zu gering, weil der Temperatursensor nicht ständig sendet.
Hue, Lacrosse, PCA301, MySensors, V 1.67 CUL 868 V3.4, Lacrosse-WLAN-Gateway, Tasmota RF-

Aloha

Hi,

I have an arduino pro mini with 3 temperature sensors connected to it. It's working fine and I can see the temperatures reaching both the serial gateway and Fhem. Problem is that Fhem only reads the sensor with the highest child ID for some reason.

I receive the following messages in the log:

2014.11.09 00:30:00 4: MYSENSORS_DEVICE Temp.VP: ignoring C_SET-message no reading-mapping for childId 0, type temperature
2014.11.09 00:30:00 4: MYSENSORS_DEVICE Temp.VP: ignoring C_SET-message no reading-mapping for childID 1, type temperature


The value from sensor with child ID 2 is logged and showed in the gui. If I remove map reading in config file for ChildID 2, values from ChildID 1 is logged instead. It's always only the sensor with the highest ChildID. I want to log values from all 3 ChildID's.

So am I missing something here or is this an unexpected behavior?  :-\

My fhem.cfg file for this device looks like this: (created by the autoconfig)

define Temp.VP MYSENSORS_DEVICE 101
attr Temp.VP IODev gateway
attr Temp.VP mapReading_temperature 0 temperature
attr Temp.VP mapReading_temperature1 1 temperature
attr Temp.VP mapReading_temperature2 2 temperature
attr Temp.VP mode node
attr Temp.VP room L1
attr Temp.VP stateFormat temperature2
attr Temp.VP version 1.4


Thanks in advance!

fh168

Nach heutigem Update macht Fhem sowas

root@raspbmc:/opt/fhem# perl fhem.pl fhem.cfg
root@raspbmc:/opt/fhem# Use of uninitialized value in anonymous hash ({}) at ./FHEM/10_MYSENSORS_DEVICE.pm line 172, <$fh> line 2436.
Use of uninitialized value in anonymous hash ({}) at ./FHEM/10_MYSENSORS_DEVICE.pm line 172, <$fh> line 2436.
Use of uninitialized value in anonymous hash ({}) at ./FHEM/10_MYSENSORS_DEVICE.pm line 172, <$fh> line 2436.
Use of uninitialized value in anonymous hash ({}) at ./FHEM/10_MYSENSORS_DEVICE.pm line 172, <$fh> line 2438.
Use of uninitialized value in anonymous hash ({}) at ./FHEM/10_MYSENSORS_DEVICE.pm line 172, <$fh> line 2438.
Use of uninitialized value in anonymous hash ({}) at ./FHEM/10_MYSENSORS_DEVICE.pm line 172, <$fh> line 2438.

Broadcast message from root@raspbmc
(/dev/console) at 9:17 ...

The system is going down for reboot NOW!
Hue, Lacrosse, PCA301, MySensors, V 1.67 CUL 868 V3.4, Lacrosse-WLAN-Gateway, Tasmota RF-

ntruchsess

#233
Zitat von: fh168 am 09 November 2014, 09:19:54
Nach heutigem Update macht Fhem sowas

Use of uninitialized value in anonymous hash ({}) at ./FHEM/10_MYSENSORS_DEVICE.pm line 172, <$fh> line 2436.


Du musst die Dateien in FHEM/lib/Device/MySensors manuell (aus dem SVN) updaten, die kommen beim fhem-update (noch) nicht mit, das Direktory muss Rudolf König noch in den update-prozess mit aufnehmen.
Alternativ hier aus meinem git-repo:
Constants.pm
Message.pm

Gruß,

Norbert

edit: habe Device/MySensors gerade in die contrib/fhemupdate.pl aufgenommen, ich hoffe damit kommen die Dateien in Zukunft beim update mit.
while (!asleep()) {sheep++};

fh168

#234
Der Fehler ist weg,

jedoch der hum sensor zeigt kein feuchtigkeitsreading an

EF
127
IODev
gateway
NAME
MYSENSOR_127
NR
1445
STATE
???
TYPE
MYSENSORS_DEVICE
ack
0
protocol
1.4
radioId
127
repeater
0
Readings
temperature1
23.0
2014-11-09 12:15:06



2014.11.09 12:15:09 5: MYSENSORS Read: Rx: fr=100 ci=255 c=003(C_INTERNAL    ) st=011(I_SKETCH_NAME   ) ack=0 'Temperature Sensor'

2014.11.09 12:15:09 5: MYSENSORS Read: Rx: fr=100 ci=255 c=003(C_INTERNAL    ) st=012(I_SKETCH_VERSION) ack=0 '1.0'

2014.11.09 12:15:09 5: MYSENSORS Read: Rx: fr=100 ci=000 c=000(C_PRESENTATION) st=006(S_TEMP          ) ack=0 '1.4'

2014.11.09 12:15:09 5: MYSENSORS/RAW: /100;0;1;0;0;23.3

2014.11.09 12:15:09 5: MYSENSORS Read: Rx: fr=100 ci=000 c=001(C_SET         ) st=000(V_TEMP          ) ack=0 '23.3'

2014.11.09 12:15:15 5: MYSENSORS/RAW: /0;0;3;0;5;0

2014.11.09 12:15:15 5: MYSENSORS Read: Rx: fr=000 ci=000 c=003(C_INTERNAL    ) st=005(I_INCLUSION_MODE) ack=0 '0'

2014.11.09 12:15:22 1: PERL WARNING: Useless use of private variable in void context at (eval 163) line 1.
2014.11.09 12:15:22 1: PERL WARNING: Useless use of a constant (actual) in void context at (eval 163) line 1.
2014.11.09 12:15:23 1: PERL WARNING: Useless use of private variable in void context at (eval 164) line 1.
2014.11.09 12:15:23 1: PERL WARNING: Useless use of a constant (actual) in void context at (eval 164) line 1.
2014.11.09 12:17:31 1: PERL WARNING: Useless use of private variable in void context at (eval 189) line 1.
2014.11.09 12:17:31 1: PERL WARNING: Useless use of a constant (actual) in void context at (eval 189) line 1.
2014.11.09 12:19:37 5: MYSENSORS/RAW: /127;0;1;0;1;42.0

2014.11.09 12:19:37 5: MYSENSORS Read: Rx: fr=127 ci=000 c=001(C_SET         ) st=001(V_HUM           ) ack=0 '42.0'

2014.11.09 12:20:07 1: gateway is against deletion (connection: disconnected), continuing with rereadcfg anyway
2014.11.09 12:20:08 1: Including fhem.cfg
2014.11.09 12:20:15 1: Including ./log/fhem.save
2014.11.09 12:20:18 3: Opening gateway device 192.168.178.234:5003
2014.11.09 12:20:18 3: gateway device opened
2014.11.09 12:20:18 5: MYSENSORS send: Rx: fr=000 ci=000 c=003(C_INTERNAL    ) st=002(I_VERSION       ) ack=0 ''

2014.11.09 12:20:18 5: SW: 303b303b333b303b323b0a
2014.11.09 12:20:27 5: MYSENSORS/RAW: /0;0;3;0;14;Gateway startup complete.
0;0;3;0;2;1.4

2014.11.09 12:20:27 5: MYSENSORS Read: Rx: fr=000 ci=000 c=003(C_INTERNAL    ) st=014(I_STARTUP_COMPLETE) ack=0 'Gateway startup complete.'

2014.11.09 12:20:28 5: MYSENSORS Read: Rx: fr=000 ci=000 c=003(C_INTERNAL    ) st=002(I_VERSION       ) ack=0 '1.4'

2014.11.09 12:20:31 1: PERL WARNING: Useless use of private variable in void context at (eval 248) line 1.
2014.11.09 12:20:31 1: PERL WARNING: Useless use of a constant (actual) in void context at (eval 248) line 1.
2014.11.09 12:23:15 1: PERL WARNING: Useless use of private variable in void context at (eval 301) line 1.
2014.11.09 12:23:15 1: PERL WARNING: Useless use of a constant (actual) in void context at (eval 301) line 1.
Hue, Lacrosse, PCA301, MySensors, V 1.67 CUL 868 V3.4, Lacrosse-WLAN-Gateway, Tasmota RF-

ntruchsess

Zitat von: Aloha am 09 November 2014, 02:16:26
2014.11.09 00:30:00 4: MYSENSORS_DEVICE Temp.VP: ignoring C_SET-message no reading-mapping for childId 0, type temperature
2014.11.09 00:30:00 4: MYSENSORS_DEVICE Temp.VP: ignoring C_SET-message no reading-mapping for childID 1, type temperature


fixed in rev. 6923. Sometimes a pair of parentheses makes a difference ;-)

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

Aloha

Zitat von: ntruchsess am 09 November 2014, 12:46:15
fixed in rev. 6923. Sometimes a pair of parentheses makes a difference ;-)

- Norbert

That was quick! I just tested it and it works very well now.  :)

Thanks!

ntruchsess

#237
Zitat von: fh168 am 09 November 2014, 12:24:01
jedoch der hum sensor zeigt kein feuchtigkeitsreading an

NAME MYSENSOR_127
TYPE MYSENSORS_DEVICE
radioId 127
Readings temperature1 23.0

2014.11.09 12:19:37 5: MYSENSORS Read: Rx: fr=127 ci=000 c=001(C_SET         ) st=001(V_HUM           ) ack=0 '42.0'

Lass die Devices noch mal sauber neu anlegen, für RadioId 127, ChildId 1 ist ja temperature und nicht humidity eingetragen. Oder korrigiere das manuell mit 'attr MYSENSOR_127 1 humidity'

Wenn das 'attr MYSENSOR_127 1 humidity' vom autocreate angelegt wurde, dann solltest Du auf SVN-Rev. 6923 updaten.

Übrigens: wenn Du einen Sensor neu flashst, dann bleibt die diesem Arduino schon mal zugewiesene RadioId im Eeprom erhalten.

Gruß,

Norbert

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

fh168

hat nichts gebracht, hab den hum noch mal von der config entfernt, ihn nochmal neu geflasht
und auch das snippet funktionierte nicht.

MYSENSOR_127: unknown attribute 1. Type 'attr MYSENSOR_127 ?' for a detailed list.
Hue, Lacrosse, PCA301, MySensors, V 1.67 CUL 868 V3.4, Lacrosse-WLAN-Gateway, Tasmota RF-

Aloha

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 so I tried to configure it manually.

Fhem gives the sensor an ID but nothing more. Before defining it manually I can see the following in the logs.

2014.11.09 12:25:32 3: MYSENSORS: ignoring req-msg from unknown radioId 102, childId 1 for V_VAR1

After defining the sensor and Fhem receives the first data from it, Fhem prints out the following error message to the console and then crashes. I have to turn off the sensor if I want to be able to start it again.

Undefined subroutine &MYSENSORS::DEVICE::ReadingsVal called at ./FHEM/10_MYSENSORS_DEVICE.pm line 428.


So, my question is if this type of sensor is supported yet?