nspanel lovelace ui support for FHEM ?

Begonnen von kroonen, 28 Januar 2023, 22:26:54

Vorheriges Thema - Nächstes Thema

kroonen

Hi,

Will there be also an module for fhem to connect to nspanel-lovelace-ui? Is see already 4 smarthome software that have modules/plugins to connect, and should be nice to have FHEM also supported

https://github.com/joBr99/nspanel-lovelace-ui


Tabadorer

Yeah I would also appreciate it. I struggle with the commands for manually updating the display with mqtt. And some things are prepped in NodeRed to make things easier in fhem.
This ist how my NSPanel Device in fhem currently looks like (incomplete).

Don't forget to set the fire these Commands on the Tasmota Console:
BuzzerPwm 1
This activates the slightly more sophisticated audio capabilities of the internal buzzer.


defmod NSPanel MQTT2_DEVICE
attr NSPanel autocreate 1
attr NSPanel devicetopic nspanel01
attr NSPanel group NSPanel
attr NSPanel icon taster_ch6_9
attr NSPanel periodicCmd deletereading:1
attr NSPanel readingList tele/nspanel01/LWT:.* LWT\
tele/nspanel01/RESULT:.* { json2nameValue($EVENT,'',$JSONMAP) }\
stat/nspanel01/FHEM:.* { json2nameValue($EVENT,'',$JSONMAP) }\

attr NSPanel room Büro
attr NSPanel setList nsdimmode:slider,0,5,100 cmnd/$DEVICETOPIC/CustomSend dimmode~$EVTPART1~100\
nstimeout:slider,0,5,600 cmnd/$DEVICETOPIC/CustomSend timeout~$EVTPART1\
nspagetype:select,pageStartup,cardEntities,cardThermo,cardMedia,popupNotify,screensaver,screensaver2,cardPower,cardQR cmnd/$DEVICETOPIC/CustomSend pageType~$EVTPART1\
nscustomsend cmnd/$DEVICETOPIC/CustomSend $EVTPART1\
nsnotify cmnd/$DEVICETOPIC/CustomSend notify~$EVTPART1~$EVTPART2 $EVTPART3 $EVTPART4 $EVTPART5 $EVTPART6 $EVTPART7 $EVTPART8 $EVTPART9\
nsnotifydelete cmnd/$DEVICETOPIC/CustomSend notify\
nsinitscreen:{substr(FmtTime(time()),0,5)} cmnd/$DEVICETOPIC/BackLog CustomSend time~$EVTPART1;;CustomSend pageType~screensaver;;CustomSend timeout~20;;CustomSend dimmode~10~100~6371\
off:noArg    cmnd/$DEVICETOPIC/POWER1 0\
on:noArg     cmnd/$DEVICETOPIC/POWER1 1\
toggle:noArg cmnd/$DEVICETOPIC/POWER1 2\
restart:noArg cmnd/$DEVICETOPIC/restart 1\
deletereading:noArg {fhem("deleteReading NSPanel CustomRecv.*")}
attr NSPanel webCmd nsdimmode:on:off


I also included a doif definition, which allow touching the exit button on the screen

defmod di_NSPanel01 DOIF ## Exit aus Screensaver\
(\
[NSPanel:CustomRecv_4] eq "bExit"\
) \
(\
set NSPanel nspagetype screensaver\
)
attr di_NSPanel01 do always
attr di_NSPanel01 group NSPanel
attr di_NSPanel01 icon helper_doif



OffTopic:
This is the flow in NodeRed to update the Clock on the Screensaver Pager

[{"id":"1cea60d3e332b68c","type":"inject","z":"f45b95e9c5d129af","name":"Zeit Stellen","props":[{"p":"payload"},{"p":"cmnd","v":"time","vt":"str"}],"repeat":"1","crontab":"","once":true,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":190,"y":440,"wires":[["d5cd4fbff73fc554"]]},{"id":"c3ad026e9f9fecf7","type":"mqtt out","z":"f45b95e9c5d129af","name":"","topic":"cmnd/nspanel01/CustomSend","qos":"","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"55d1bc8.84d6444","x":1330,"y":460,"wires":[]},{"id":"d5cd4fbff73fc554","type":"function","z":"f45b95e9c5d129af","name":"ts to Time","func":"\nfunction getCurrentTime() {\n    let d = new Date();\n    let hh = (\"00\" + d.getHours()).slice(-2) // + d.getTimezoneOffset() * -1 / 60; \n    let mm = (\"00\" + d.getMinutes()).slice(-2); \n    let ss = (\"00\" + d.getSeconds()).slice(-2); \n    return hh + \":\" + mm // + \":\" + ss; \n}\n\nmsg.payload = msg.cmnd + \"~\" + getCurrentTime();\n\n\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":400,"y":440,"wires":[["e7bad1331346fcc3"]]},{"id":"e7bad1331346fcc3","type":"rbe","z":"f45b95e9c5d129af","name":"Nur bei Zeitänderung senden","func":"rbe","gap":"","start":"","inout":"out","septopics":false,"property":"payload","topi":"topic","x":670,"y":440,"wires":[["c3ad026e9f9fecf7"]]},{"id":"55d1bc8.84d6444","type":"mqtt-broker","name":"","broker":"mqtt","port":"1883","clientid":"node-red","autoConnect":true,"usetls":false,"compatmode":false,"protocolVersion":4,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closePayload":"","willTopic":"","willQos":"0","willPayload":""}]


And this node initializes the screensaver after a reset and divides the RESULT Topic in an array for better parsing in fhem:

[{"id":"af6c8daad04e7cd7","type":"function","z":"f45b95e9c5d129af","name":"Startup Screen erzeugen","func":"\nfunction getCurrentTime() {\n    let d = new Date();\n    let hh = (\"00\" + d.getHours()).slice(-2) // + d.getTimezoneOffset() * -1 / 60; \n    let mm = (\"00\" + d.getMinutes()).slice(-2); \n    let ss = (\"00\" + d.getSeconds()).slice(-2); \n    return hh + \":\" + mm // + \":\" + ss; \n}\n\nlet payload = [\n    \"time~\" + getCurrentTime()\n    ,\"pageType~screensaver\"\n    ,\"timeout~20\"\n    ,\"dimmode~10~100~6371\"\n    ]\n\npayload = payload.map(payload => \"CustomSend \" + payload);\nmsg.payload = payload.join(\";\");\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":850,"y":700,"wires":[["51bf24b94bd19396"]]},{"id":"51bf24b94bd19396","type":"mqtt out","z":"f45b95e9c5d129af","name":"an NSPanel senden","topic":"cmnd/nspanel01/backlog","qos":"","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"55d1bc8.84d6444","x":1100,"y":700,"wires":[]},{"id":"7c023dfb7c547375","type":"mqtt in","z":"f45b95e9c5d129af","name":"NSPanel RESULT","topic":"tele/nspanel01/RESULT","qos":"0","datatype":"json","broker":"55d1bc8.84d6444","nl":false,"rap":true,"rh":0,"inputs":0,"x":350,"y":700,"wires":[["6813f79da971fca8"]]},{"id":"6813f79da971fca8","type":"switch","z":"f45b95e9c5d129af","name":"","property":"payload.CustomRecv","propertyType":"msg","rules":[{"t":"cont","v":"event,startup","vt":"str"},{"t":"cont","v":"event","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":650,"y":700,"wires":[["af6c8daad04e7cd7"],["10c7666b95bf9f6d"]]},{"id":"10c7666b95bf9f6d","type":"function","z":"f45b95e9c5d129af","name":"Screenbefehle für FHEM als Array umwandeln","func":"\nmsg.payload.CustomRecv = msg.payload.CustomRecv.split(\",\");\nif (msg.payload.CustomRecv.length < 5) {\n    msg.payload.CustomRecv.push(\"\");\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":940,"y":840,"wires":[["ae79a760ef7e1e66"]]},{"id":"ae79a760ef7e1e66","type":"mqtt out","z":"f45b95e9c5d129af","name":"","topic":"stat/nspanel01/FHEM","qos":"","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"55d1bc8.84d6444","x":1280,"y":840,"wires":[]},{"id":"55d1bc8.84d6444","type":"mqtt-broker","name":"","broker":"mqtt","port":"1883","clientid":"node-red","autoConnect":true,"usetls":false,"compatmode":false,"protocolVersion":4,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closePayload":"","willTopic":"","willQos":"0","willPayload":""}]

fhem in Docker auf Lenovo m625q 16gb RAM/2TB SSD | div. SonOFF mit Tasmota | Shelly | busware CUL869 | Homematic | Echo Dot | Fritz DECT Thermostate | ConBee II ZigBee Gateway | Mosquitto MQTT