#Code samples: EasyMeter smart Meter Q3M

Code tips and tricks for beginners
Post Reply
User avatar
Oli
Posts: 47
Joined: Tue Feb 09, 2021 10:07 am
Location: Germany, Meissen
Has thanked: 13 times
Been thanked: 45 times
Contact:

#Code samples: EasyMeter smart Meter Q3M

Post by Oli »

This is a functioning demo, it is made very easy for better understanding. Web interface, in my version the data will then be sent further,
To note the unusual serial adjustment of this device.


I hope it helps someone, have fun ...

Code: [Local Link Removed for Guests]

' SERIAL.MODE baudrate [, bits, parity, stop]  -> bits from 5 to 8, parity {0 = none : 1 = odd, 2 = even), stop from 1 to 2
serial.mode 9600 ,7 ,0 ,1  'EASY SMART METER

RXmsg$ = ""

tmp$ = ""
kwhin$ = ""
kwhin = 0
kwhout$ = ""
kwhout = 0
P1$ = ""
P1 = 0
P2$ = ""
P2 = 0
P3$ = ""
P3 = 0
Pges$ = ""
Pges = 0
SN$ = ""
status$ = ""

TIM$ = TIME$

GOSUB paint


onserial localRX:

Anf:

gosub paint

kwhin$ = WORD.EXTRACT$(tmp$, "1-0:1.8.0*255(", "*kWh)")
kwhin=VAL(kwhin$)
kwhout$ = WORD.EXTRACT$(tmp$, "1-0:2.8.0*255(", "*kWh)")
kwhout=VAL(kwhout$)
P1$ = WORD.EXTRACT$(tmp$, "1-0:21.7.0*255(", "*W)")
P1=VAL(P1$)
P2$ = WORD.EXTRACT$(tmp$, "1-0:41.7.0*255(", "*W)")
P2=VAL(P2$)
P3$ = WORD.EXTRACT$(tmp$, "1-0:61.7.0*255(", "*W)")
P3=VAL(P3$)
Pges$ = WORD.EXTRACT$(tmp$, "1-0:1.7.0*255(", "*W)")
Pges=VAL(Pges$)
status$ = WORD.EXTRACT$(tmp$, "1-0:96.5.5*255(", ")") '8bit hex
SN$ = WORD.EXTRACT$(tmp$, "0-0:96.1.255*255(", ")")


wlog kwhin, kwhout , P1, P2 ,P3 ,Pges

pause 3000
goto Anf


localRX:
pause 400 '! very important !
tmp$ = serial.input$
return



paint:
cls
refresh
a$ = ""
a$ = a$ + |<style> td {padding-right:20px;} </style>|
a$ = a$ + |<table style='text-align:left;'>|
a$ = a$ + |<tr><td>| + "Rohdaten:" + |</td><td>| + textbox$(tmp$,"win100") + |</td></tr>|
a$ = a$ + |<tr><td>| + "kwhin$" + |</td><td>| + textbox$(kwhin) + |</td></tr>|
a$ = a$ + |<tr><td>| + "kwhout$" + |</td><td>| +  textbox$(kwhout)  + |</td></tr>| 
a$ = a$ + |<tr><td>| + "P1$" + |</td><td>| +  textbox$(P1)  + |</td></tr>| 
a$ = a$ + |<tr><td>| + "P2$" + |</td><td>| +  textbox$(P2)  + |</td></tr>| 
a$ = a$ + |<tr><td>| + "P3$" + |</td><td>| +  textbox$(P3)  + |</td></tr>| 
a$ = a$ + |<tr><td>| + "Pges$" + |</td><td>| +  textbox$(Pges)  + |</td></tr>| 
a$ = a$ + |<tr><td>| + "SN$" + |</td><td>| +  textbox$(SN$)  + |</td></tr>| 
a$ = a$ + |<tr><td>| + "status$" + |</td><td>| +  textbox$(status$)  + |</td></tr>| 


a$ = a$ + |<tr><td>| + "Zählernummer:" + |</td><td>| + TIME$ + |</td></tr>|
a$ = a$ + |<tr><td>| + "Zählernummer:" + |</td><td>| + DATE$ + |</td></tr>|
a$ = a$ + |<tr><td>| + "Zählernummer:" + |</td><td>| + textbox$(TIM$) + |</td></tr>| 
a$ = a$ + |</table>|
a$ = a$ + |<br><br>|


a$ = a$ + cssid$("win100","width:1510px;")
'a$ = a$ + button$("Exit",serial2exit) + |<br>|
refresh
html a$
return
You do not have the required permissions to view the files attached to this post.
Post Reply