Show openHAB uptime

(Ruben) #21

perfect! learnt another thing :slight_smile:
thanks a lot!

0 Likes

(Ssalonen) #22

Alternative way without any external scripts System Uptime Info and an Automatic Reboot

0 Likes

(Jerry) #23

Hi

I got this aswell:
Uptime openHAB aN:aN, whats wrong?

0 Likes

(Jerry) #24

No one?

0 Likes

(Vincent Regaud) #25

No one will answer a what’s wrong question like that.
Post your items, sitemap and rule file

0 Likes

(Jerry) #26

My itemsfile:
/* Network information*/
String Network_AdapterName { channel=‚Äúsysteminfo:computer:openHABianPi:network#networkDisplayName‚ÄĚ }
String Network_Name { channel=‚Äúsysteminfo:computer:openHABianPi:network#networkName‚ÄĚ }
String Network_IP { channel=‚Äúsysteminfo:computer:openHABianPi:network#ip‚ÄĚ }
String Network_Mac { channel=‚Äúsysteminfo:computer:openHABianPi:network#mac‚ÄĚ }
Number Network_DataSent { channel=‚Äúsysteminfo:computer:openHABianPi:network#dataSent‚ÄĚ }
Number Network_DataRecevied { channel=‚Äúsysteminfo:computer:openHABianPi:network#dataReceived‚ÄĚ }
Number Network_PacketsSent { channel=‚Äúsysteminfo:computer:openHABianPi:network#packetsSent‚ÄĚ }
Number Network_PacketsRecevied { channel=‚Äúsysteminfo:computer:openHABianPi:network#packetsReceived‚ÄĚ }

/* CPU information*/
String CPU_Name { channel=‚Äúsysteminfo:computer:openHABianPi:cpu#name‚ÄĚ }
String CPU_Description { channel=‚Äúsysteminfo:computer:openHABianPi:cpu#description‚ÄĚ }
Number CPU_Load { channel=‚Äúsysteminfo:computer:openHABianPi:cpu#load‚ÄĚ}
Number CPU_Load1 { channel=‚Äúsysteminfo:computer:openHABianPi:cpu#load1‚ÄĚ }
Number CPU_Load5 { channel=‚Äúsysteminfo:computer:openHABianPi:cpu#load5‚ÄĚ }
Number CPU_Load15 { channel=‚Äúsysteminfo:computer:openHABianPi:cpu#load15‚ÄĚ }
Number CPU_Threads { channel=‚Äúsysteminfo:computer:openHABianPi:cpu#threads‚ÄĚ }
Number CPU_Uptime { channel=‚Äúsysteminfo:computer:openHABianPi:cpu#uptime‚ÄĚ }
Number System_CPU_Uptime ‚ÄúUptime server [JS(duration.js):%s]‚ÄĚ (gSystem) { channel=‚Äúsysteminfo:computer:openHABianPi:cpu#uptime‚ÄĚ }
String System_openHAB_Uptime_output ‚ÄúUptime openHAB [%s]‚ÄĚ (gSystem) { channel=‚Äúexec:command:uptime:output‚ÄĚ }
Number System_openHAB_Uptime ‚ÄúUptime openHAB [JS(duration.js):%s]‚ÄĚ (gSystem) // updated in exec.rules

/* Drive information*/
String Drive_Name { channel=‚Äúsysteminfo:computer:openHABianPi:drive#name‚ÄĚ }
String Drive_Model { channel=‚Äúsysteminfo:computer:openHABianPi:drive#model‚ÄĚ }
String Drive_Serial { channel=‚Äúsysteminfo:computer:openHABianPi:drive#serial‚ÄĚ }

/* Storage information*/
String Storage_Name { channel=‚Äúsysteminfo:computer:openHABianPi:storage#name‚ÄĚ }
String Storage_Type { channel=‚Äúsysteminfo:computer:openHABianPi:storage#type‚ÄĚ }
String Storage_Description { channel=‚Äúsysteminfo:computer:openHABianPi:storage#description‚ÄĚ }
Number Storage_Available { channel=‚Äúsysteminfo:computer:openHABianPi:storage#available‚ÄĚ }
Number Storage_Used { channel=‚Äúsysteminfo:computer:openHABianPi:storage#used‚ÄĚ }
Number Storage_Total { channel=‚Äúsysteminfo:computer:openHABianPi:storage#total‚ÄĚ }
Number Storage_Available_Percent { channel=‚Äúsysteminfo:computer:openHABianPi:storage#availablePercent‚ÄĚ }
Number Storage_Used_Percent { channel=‚Äúsysteminfo:computer:openHABianPi:storage#usedPercent‚ÄĚ }

/* Memory information*/
Number Memory_Available { channel=‚Äúsysteminfo:computer:openHABianPi:memory#available‚ÄĚ }
Number Memory_Used { channel=‚Äúsysteminfo:computer:openHABianPi:memory#used‚ÄĚ }
Number Memory_Total { channel=‚Äúsysteminfo:computer:openHABianPi:memory#total‚ÄĚ }
Number Memory_Available_Percent { channel=‚Äúsysteminfo:computer:openHABianPi:memory#availablePercent‚ÄĚ }
Number Memory_Used_Percent { channel=‚Äúsysteminfo:computer:openHABianPi:memory#usedPercent‚ÄĚ }

/* Swap memory information*/
Number Swap_Available { channel=‚Äúsysteminfo:computer:openHABianPi:swap#available‚ÄĚ }
Number Swap_Used { channel=‚Äúsysteminfo:computer:openHABianPi:swap#used‚ÄĚ }
Number Swap_Total { channel=‚Äúsysteminfo:computer:openHABianPi:swap#total‚ÄĚ }
Number Swap_Available_Percent { channel=‚Äúsysteminfo:computer:openHABianPi:swap#availablePercent‚ÄĚ }
Number Swap_Used_Percent { channel=‚Äúsysteminfo:computer:openHABianPi:swap#usedPercent‚ÄĚ }

/* Battery information*/
String Battery_Name { channel=‚Äúsysteminfo:computer:work:battery#name‚ÄĚ }
Number Battery_RemainingCapacity { channel=‚Äúsysteminfo:computer:work:battery#remainingCapacity‚ÄĚ }
Number Battery_RemainingTime { channel=‚Äúsysteminfo:computer:work:battery#remainingTime‚ÄĚ }

/* Display information*/
String Display_Description { channel=‚Äúsysteminfo:computer:work:display#information‚ÄĚ }

/* Sensors information*/
Number Sensor_CPUTemp { channel=‚Äúsysteminfo:computer:openHABianPi:sensors#cpuTemp‚ÄĚ }
Number Sensor_CPUVoltage { channel=‚Äúsysteminfo:computer:openHABianPi:sensors#cpuVoltage‚ÄĚ }
Number Sensor_FanSpeed { channel=‚Äúsysteminfo:computer:openHABianPi:sensors#fanSpeed‚ÄĚ }

/* Process information*/
Number Process_load { channel=‚Äúsysteminfo:computer:openHABianPi:process#load‚ÄĚ }
Number Process_used { channel=‚Äúsysteminfo:computer:openHABianPi:process#used‚ÄĚ }
String Process_name { channel=‚Äúsysteminfo:computer:openHABianPi:process#name‚ÄĚ }
Number Process_threads { channel=‚Äúsysteminfo:computer:openHABianPi:process#threads‚ÄĚ }
String Process_path { channel=‚Äúsysteminfo:computer:openHABianPi:process#path‚ÄĚ }

0 Likes

(Jerry) #27

My .sitemap:
sitemap our_home label=‚ÄúV√•rt hem‚ÄĚ {

Frame label="Datum" {
    Text item=CurrentDate
}
Frame {  

    Group item=Datarum icon="office"
    Group item=Sovrum icon="bedroom"
}

Frame {
    
    Group item=Vardagsrum
    Group item=Kok label="Kök" icon="kitchen"

}

Frame {
    
    Group item=Hall icon="corridor"
    Group item=Badrum icon="bath"
}

Frame {
    
    Group item=Kladkammare label="Klädkammare" icon="wardrobe"
    Group item=Balkong
}

   
Frame label="Vädret" {

        Text label="Solen" icon="sun"{
        Text item=Sunrise_Time icon="sunrise"
	    Text item=Sunset_Time icon="sunset"
        
}

    Text label="Vädret" icon="sun"{

        Text item=Temperature icon="temperature"
        Text item=Temp_Min icon="temperature"
        Text item=Temp_Max icon="temperature"
        Text item=Temp_Feel icon="temperature"
        Text item=Temp_Dewpoint icon="temperature"
        Text item=Humidity icon="humidity"
        Text item=Pressure icon="pressure"
        Text item=Clouds icon="sun_clouds"
        Text item=Condition
        Text item=ObservationTime
        Text item=LastUpdate
        Text item=CommonId
        Text item=Rain icon="rain"
        Text item=Snow icon="snow"
        Text item=Precip_Probability
        Text item=Wind_Speed icon="wind"
        Text item=Wind_Speed_Mps icon="wind"
        Text item=Temp_MinF icon="temperature"
        Text item=Temp_MaxF icon="temperature"
        
    }
}
Frame label="System information" icon="pie" {

    Group item=RaspberryPI {
        
        Text item=Network_IP label="IP" icon="network"
        Text item=Network_DataSent label="Data sänt" icon="network"
        Text item=Network_DataRecevied label="Data mottaget" icon="network"
                  
        Text item=CPU_Load1 icon="processor"
        Text item=CPU_Load5 icon="processor"
        Text item=System_CPU_Uptime icon="time"
        Text item=System_openHAB_Uptime_output
        Text item=System_openHAB_Uptime icon="time"

        Text item=Storage_Total icon="hard_drive"
        Text item=Storage_Available_Percent icon="hard_drive"

        Text item=Memory_Total label="Minne Totalt" icon="ram_memory"
        Text item=Memory_Available label="Minne tillgängligt" icon="ram_memory"
        Text item=Memory_Used label="Minne använt" icon="ram_memory"
        Text item=Memory_Used_Percent label="Minne använt %" icon="ram_memory"        
        
        }
        
    
    Group item=Energi label="Energiförbrukning" icon="solarplant"

    }
}
0 Likes

(Jerry) #28

My .rulefile:
val String _logger = ‚Äúrules.exec‚ÄĚ

// This rule is used to update the Number out of the returned string from the command line.
// Only Works since openhab 2.2.
rule ‚ÄúConvert String to Item Type‚ÄĚ
when
Item System_openHAB_Uptime_output changed
then

// Get name of Number Item by removing "_output" from the name of the String Item
val toUpdate = triggeringItem.name.toString.split("_output").get(0)

// post the new value to the Number Item
postUpdate( toUpdate.toString , triggeringItem.state.toString )

logDebug(_logger, "Item '" + toUpdate + "' state: " + triggeringItem.state) 

end

0 Likes

(Selter) #29

You should mention that one also needs the regex binding installed :wink:

0 Likes