enocean-js / nrce-deprecated

depricated
MIT License
2 stars 2 forks source link

Get sensor state out of the msg.payload : Object #9

Closed Jo-rauh closed 5 years ago

Jo-rauh commented 7 years ago

Hello,

my flow is working and I get the msg.payload : Objects at the debug tab, now. The data:object of my temperatur Sensor STM330 from Enocean looks like that:

{"timestamp":1507478443548,"rawByte":"55000a0701eba50000730801a3e1340001ffffffff430014","packetType":1,"senderId":"01a3e134","choice":"a5","subTelNum":1,"destinationId":"ffffffff","rssi":67,"securityLevel":0,"packetTypeString":"4BS","raw":"00007308","learnBit":1}

Could you help me get the temperature out of it? I hoped that there would be written something like "state" but it isn't... What do I have to do?

Thank you very much!

Holger-Will commented 7 years ago

You have to teach in your sensor to make the content of the telegrams known. To do so, the easiest way is to follow the procedure given in the nodes description:

Use the input-channel of the Enocean-Listener by linking an inject-node to it.
Define the msg.payload as a string with a name you want to give the sensor

Once you click the inject-node-button you have 30 seconds to activate the sensor you want to teach in.
The node should show the status: "Sensor teached in" The new sensor should be visible in the Enocean-Listener device-list (see below in this description for how to see this list).

Jo-rauh commented 7 years ago

That is exactly what I'm doing. Also the message " Sensor teached in" appeared. Unfortunately the sensor does not appear in the device list. I don't know what the Problem is... Do you have any ideas? Maybe I'll try a new installation... Thank you!

Jo-rauh commented 7 years ago

So i did a new installation: Here is the way is did it:

Step1: Raspian stretch image on Sd-Card

Step2: Preparation to get the Enocean Pi working (overlay BT etc.)

Step3: Installation of node js curl -sL https://deb.nodesource.com/setup_7.x | sudo -E bash - sudo apt-get install -y nodejs

Step4: Installation of node red bash <(curl -sL https://raw.githubusercontent.com/node-red/raspbian-deb-package/master/resources/update-nodejs-and-nodered)

Step5: Installation of node-red-contrib-enocean cd ~/.node-red npm install node-red-contrib-enocean

Step 6: reboot

Step 7: Setting up the flow

TeachIn of sensors is working, they appear in the device list after a reboot. I only get data:objects in the debug tab without any information of the measured temperature

Here my export of the flow from clipboard:

[{"id":"86c7b205.f359a","type":"enocean-listener","z":"a65a2dfd.79ad5","serialport":"b8bf2c38.cd1fe","name":"Enocean Listener","knownsensor":true,"devicefilter":"target","devices":["01a49a20"],"knownsensorarray":null,"x":317.16668701171875,"y":295,"wires":[["a0770352.712b9"]]},{"id":"b8bf2c38.cd1fe","type":"enocean-config-node","z":"","serialport":"/dev/ttyAMA0"}]

My target is to get the actual temperature value. Could you tell me where the fault is in my "set-up". It would be awesome because slowly i get crazy...

Thank you very much!

Holger-Will commented 7 years ago

can you take a look into your knownSensors.json file and post it here please?

Jo-rauh commented 7 years ago

Yes of course. That is the path were it is located: /home/pi/.node-red/node_modules/node-red-contrib-enocean And that is what is written in there: { "01a49a20": { "id": "01a49a20", "eep": "a5-02-14", "manufacturer": "THERMOKON", "title": "New Temperature Sensor", "desc": "I'm a new sensor...", "eepFunc": "Temperature Sensor", "eepType": "Temperature Sensor Range -20°C to +60°C" }, "01a3e134": { "id": "01a3e134", "eep": "a5-02-05", "manufacturer": "ENOCEAN_GMBH", "title": "New Temperature Sensor", "desc": "I'm a new sensor...", "eepFunc": "Temperature Sensor", "eepType": "Temperature Sensor Range 0°C to +40°C" } } Thank you very much. Can't wait to get it working correctly;)

Jo-rauh commented 7 years ago

Or are these EEPs not implemented? Do I have to install some other packages or should the node-red-contrib-enocean work as a stand-alone node?

yGuy commented 6 years ago

I know I am late to the party, but I think had the same problem and did some debugging. Here is my analysis: The node-red-enocean package registers with the "data" event, just like the "memory module" - however the events are dispatched in the wrong order so the memory module (which is responsible for decoding the data) only decodes the data after it has been processed by the enocean listener module. Changing the code in the enocean listener module to react to the "known-data" event fixes the problem for me and I get decoded data. Otherwise this is all just raw data.

We should either change the module to listen for known-data in case of the "known modules only"-option, or change the order in which the events get fired/registered so that the memory module can perform the decoding, first.

I'll do some more testing and maybe will come back with a pull-request. (Separate question: Is GPL really the right license for this? I guess MIT or Apache would be more node-like/js-like ...

I will probably do some more coding/hacking the next days (I just got my first enocean devices and would like to use this project) so I guess I will be looking at more issues in the days to come.

Holger-Will commented 5 years ago

if you are still interessted in this, please have a look at the new version over at the monorepo: https://github.com/enocean-js/enocean-js/tree/master/packages/node-red-contrib-enocean