Project/arduino

바탕화면에 내 방 온습도 띄우기

fullfish 2024. 11. 13. 14:28

저번에 만든 온습도계로 

https://fullfish.tistory.com/269

 

온습도계 보완

이전에 만들었던 https://fullfish.tistory.com/150 서버로 데이터 보내는 온습도계 옛날에 만든것 재료 WeMos D1 mini, DHT-22 설명 온도 센서로 얻은 온도, 습도 데이터를 와이파이를 이용하여 ThingSpeak서버로

fullfish.tistory.com

스마트폰 어플이나 방에 있는 디스플레이로 온습도 확인이 되는데

바탕화면에도 띄울 수 있지 않을까라는 생각에 찾아보니까

Rainmeter이라는 소프트웨어가 있어서

이걸로 thingspeak에 api요청 보내서 데이터를 받아와서 위젯형식으로 띄웠다

 

 

코드

[Rainmeter]
; This section contains general settings that can be used to change how Rainmeter behaves.
Update=60000
Background=#@#Background.png
; #@# is equal to Rainmeter\Skins\illustro\@Resources
BackgroundMode=3
BackgroundMargins=0,34,0,14

[Metadata]
; Contains basic information of the skin.
Name=Temperature & Humidity
Author=fullfish
Information=Shows your Temperature & Humidity
Version=1.0.0

[Variables]
; Variables declared here can be used later on between two # characters (e.g. #MyVariable#).
fontName=Trebuchet MS
textSize=8
colorBar=235,170,0,255
colorText=255,255,255,205


; Measure for field1 data
[TemperatureField]
Measure=Plugin
Plugin=WebParser
URL=https://api.thingspeak.com/channels/{channels_id}/fields/1/last.json?api_key={api_key}
RegExp="\"field1\":\"([^\"]+)\""
Stringindex=1
UpdateRate=60

; Measure for field2 data
[HumidityField]
Measure=Plugin
Plugin=WebParser
URL=https://api.thingspeak.com/channels/{channels_id}/fields/2/last.json?api_key={api_key}
RegExp="\"field2\":\"([0-9.]+)"
Stringindex=1
UpdateRate=60


[meterTitle]
Meter=String
MeterStyle=styleTitle
; Using MeterStyle=styleTitle will basically "copy" the
; contents of the [styleTitle] section here during runtime.
X=100
Y=12
W=190
H=18
Text="Temperature & Humidity"
; Even though the text is set to Network, Rainmeter will display
; it as NETWORK, because styleTitle contains StringCase=Upper.

; Display for field1 (Temperature)
[MeterField1Display]f
Meter=String
MeasureName=MeasureField1
MeterStyle=styleLeftText
FontColor=255,255,255
AntiAlias=1
X=10
Y=40
W=190
H=14
Text="Temperature"

[meterTemperatureValue]
Meter=String
MeterStyle=styleRightText
MeasureName=TemperatureField
X=200
Y=0r
; r stands for relative. In this case, the Y postition of meterValueCPU is 0 pixels
; below the Y value of the previous meter (i.e it's the same as in meterLabelCPU).
W=190
H=14
Text="%1°C"
; %1 stands for the value of MeasureName (measureIP in this case).

[meterSeperator]
Meter=Image
MeterStyle=styleSeperator
X=10
Y=52
W=190
H=1

; Display for field2 (Humidity)
[MeterField2Display]
Meter=String
MeterStyle=styleLeftText
MeasureName=HumidityField
FontColor=255,255,255
AntiAlias=1
X=10
Y=60
W=190
H=14
Text="Humidity"

[meterHumidityValue]
Meter=String
MeterStyle=styleRightText
MeasureName=HumidityField
X=200
Y=0r
W=190
H=14
Text="%1 %"
NumOfDecimals=1
AutoScale=1
; Because measureIP returns the current upload speed in bytes, we must use AutoScale=1 to
; automatically scale the value into a more readable figure.

[styleTitle]
StringAlign=Center
StringCase=Upper
StringStyle=Bold
StringEffect=Shadow
FontEffectColor=0,0,0,50
FontColor=#colorText#
FontFace=#fontName#
FontSize=10
AntiAlias=1
ClipString=1

[styleLeftText]
StringAlign=Left
; Meters using styleLeftText will be left-aligned.
StringCase=None
StringStyle=Bold
StringEffect=Shadow
FontEffectColor=0,0,0,20
FontColor=#colorText#
FontFace=#fontName#
FontSize=#textSize#
AntiAlias=1
ClipString=1

[styleRightText]
StringAlign=Right
StringCase=None
StringStyle=Bold
StringEffect=Shadow
FontEffectColor=0,0,0,20
FontColor=#colorText#
FontFace=#fontName#
FontSize=#textSize#
AntiAlias=1
ClipString=1

 

 

 

정규식에서 그룹화를 하고 원래 %1 %2 이런식으로 불러오는데
여기서는 그런식으로 못불러오고 Stingindex로 불러서 각 덩어리별로 관리를 해야해서
api를 온도 따로 습도 따로 불러왔다

'Project > arduino' 카테고리의 다른 글

온습도계 보완  (0) 2024.04.16
대기 상황 무드등  (0) 2022.08.10
간단한 부화기 만들기  (0) 2022.08.10
재난구역 인명탐사 rc카  (0) 2022.08.03
미니 드론 만들기  (0) 2022.08.03