using Dummy to change reading on temp. sensor DS18B20

Begonnen von duffman, 21 Dezember 2015, 10:46:57

Vorheriges Thema - Nächstes Thema

duffman

Hi everyone,

first of all its fair to write im completly new in fhem/perl (cca 2-3 week) therefore, sorry in case im asking dump questions. ;)
I have a temperature sensor DS18B20. This sensor has a reading: temphigh which i want to change by a dropdown menu. But the setlist attr is not available under OWS devices. So Dummy came into my mind hand in hand with notify. However, my code is not working and i realy dont know where is the problem (commandref + fhemwiki are my friends, but without help this time). If somebody have an advice, i would highly appriciate.

define temp dummy
attr temp setList 22 22.5
define ntemp notify temp:state:.* set DS18B20_E6515F070000 temphigh $EVTPART2

if i set on dummy temp, for example 22.5 from the dropdown menu,
the event seems like:
dummy state 22.5
the problematic part is apparently $EVTPART2, if i use a simple decimal number like 22.5, it is working

P.S: in case this thread was already answered on german sections... sorry, i've tried to search for it, i realy did, but i dont speak german and its hard to pick the right words to search. :(

Ellert

Try a DOIF to exclude non decimal parts of temp.

define tempdi DOIF ([temp:?state]) (set DS18B20_E6515F070000 temphigh [temp:d])
attr tempdi do always

duffman


duffman

hmm... without success... not working... any other ideas? i was thinking to use IF but didnt have time yesterday to try it

dev0

Zitat von: duffman am 21 Dezember 2015, 10:46:57
define ntemp notify temp:state:.* set DS18B20_E6515F070000 temphigh $EVTPART2
Have a look at event monitor or inform on telnet sessions. You will see something like this if you choose a value from setList:

2015-12-22 07:36:09.297 dummy temp <number>

-> your notify will not be triggered with "state".
-> <number> is not $EVTPART2.
Details here.

Enough infos to get it?

Ellert

Zitat von: Ellert am 21 Dezember 2015, 11:56:26
Try a DOIF to exclude non decimal parts of temp.

define tempdi DOIF ([temp:?state]) (set DS18B20_E6515F070000 temphigh [temp:d])
attr tempdi do always


I'm sorry for my mistake, the right version for DOIF is this
define tempdi DOIF ([temp:?.*]) (set DS18B20_E6515F070000 temphigh [temp:d])
attr tempdi do always


duffman

thank you guys!
both of you,

Ellert for the specific example of a different aproach

dev0 for the educational part of my struggling, i know now that i didnt fully understand notify command. (i have to review all my notifys made before, seems that they are triggered by something else that i thought, until now), so the last part of event should be something like $EVTPART4 if i understand correctly.

I will try both and leave a post about it

dev0

It's $EVTPART0. In this example you could use $EVENT also. EVTPARTs will begin to count from 0 after type and devicename. In this case <number>.

duffman

hmm, now its clear. thx a lot
notify works like a charm,
define ntemp notify temp set DS18B20_E6515F070000 temphigh $EVENT
i did not try with DOIF yet.