Read Dell iDRAC values through Redfish Topic is solved

Others (MiLight, Hue, Toon etc...)

Moderator: leecollings

User avatar
Ragdag
Posts: 152
Joined: Friday 30 March 2018 13:56
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Netherlands
Contact:

Read Dell iDRAC values through Redfish

Post by Ragdag »

I'm trying to figure out how to populate sensors in Domoticz with values from my Dell iDRAC server.
With Redfish I can get temperature and power consumption that I would like to collect in Domoticz but I have no idea how to build this.
Anybody can help me to get started?

The ones I want to capture are:
  • Inlet Temperature
  • Exhaust Temperature
  • CPU Temperature
  • Power Consumption
The following URLs will give me a JSON payload back, with the required data. Not sure what is easier, one URL that will only give back one sensor or one URL that will give back all.
For instance https://192.168.2.202/redfish/v1/Chassi ... dInletTemp
Will give:

Code: Select all

{
    "@odata.context": "/redfish/v1/$metadata#Thermal.Thermal",
    "@odata.id": "/redfish/v1/Chassis/System.Embedded.1/Sensors/Temperatures/iDRAC.Embedded.1%23SystemBoardInletTemp",
    "@odata.type": "#Thermal.v1_4_0.Temperature",
    "LowerThresholdCritical": -7,
    "LowerThresholdFatal": -7,
    "LowerThresholdNonCritical": 3,
    "MaxReadingRangeTemp": 47,
    "MemberId": "iDRAC.Embedded.1#SystemBoardInletTemp",
    "MinReadingRangeTemp": -7,
    "Name": "System Board Inlet Temp",
    "PhysicalContext": "SystemBoard",
    "ReadingCelsius": 20,
    "RelatedItem": [
        {
            "@odata.id": "/redfish/v1/Chassis/System.Embedded.1"
        }
    ],
    "[email protected]": 1,
    "SensorNumber": 4,
    "Status": {
        "Health": "OK",
        "State": "Enabled"
    },
    "UpperThresholdCritical": 47,
    "UpperThresholdFatal": 47,
    "UpperThresholdNonCritical": 42
}
While https://192.168.2.202/redfish/v1/Chassi ... .1/Thermal will give

Code: Select all

{
    "@odata.context": "/redfish/v1/$metadata#Thermal.Thermal",
    "@odata.id": "/redfish/v1/Chassis/System.Embedded.1/Thermal",
    "@odata.type": "#Thermal.v1_4_0.Thermal",
    "Description": "Represents the properties for Temperature and Cooling",
    "Fans": [
        {
            "@odata.id": "/redfish/v1/Chassis/System.Embedded.1/Sensors/Fans/0x17%7C%7CFan.Embedded.1",
            "@odata.type": "#Thermal.v1_4_0.Fan",
            "Assembly": {
                "@odata.id": "/redfish/v1/Chassis/System.Embedded.1/Assembly"
            },
            "FanName": "System Board Fan1 RPM",
            "LowerThresholdCritical": 360,
            "LowerThresholdFatal": 360,
            "LowerThresholdNonCritical": 600,
            "MaxReadingRange": null,
            "MemberId": "0x17||Fan.Embedded.1",
            "MinReadingRange": 360,
            "Name": "System Board Fan1 RPM",
            "PhysicalContext": "SystemBoard",
            "Reading": 5880,
            "ReadingUnits": "RPM",
            "Redundancy": [],
            "[email protected]": 0,
            "RelatedItem": [
                {
                    "@odata.id": "/redfish/v1/Chassis/System.Embedded.1"
                }
            ],
            "[email protected]": 1,
            "Status": {
                "Health": "OK",
                "State": "Enabled"
            },
            "UpperThresholdCritical": null,
            "UpperThresholdFatal": null,
            "UpperThresholdNonCritical": null
        },
        {
            "@odata.id": "/redfish/v1/Chassis/System.Embedded.1/Sensors/Fans/0x17%7C%7CFan.Embedded.4",
            "@odata.type": "#Thermal.v1_4_0.Fan",
            "Assembly": {
                "@odata.id": "/redfish/v1/Chassis/System.Embedded.1/Assembly"
            },
            "FanName": "System Board Fan4 RPM",
            "LowerThresholdCritical": 360,
            "LowerThresholdFatal": 360,
            "LowerThresholdNonCritical": 600,
            "MaxReadingRange": null,
            "MemberId": "0x17||Fan.Embedded.4",
            "MinReadingRange": 360,
            "Name": "System Board Fan4 RPM",
            "PhysicalContext": "SystemBoard",
            "Reading": 5640,
            "ReadingUnits": "RPM",
            "Redundancy": [],
            "[email protected]": 0,
            "RelatedItem": [
                {
                    "@odata.id": "/redfish/v1/Chassis/System.Embedded.1"
                }
            ],
            "[email protected]": 1,
            "Status": {
                "Health": "OK",
                "State": "Enabled"
            },
            "UpperThresholdCritical": null,
            "UpperThresholdFatal": null,
            "UpperThresholdNonCritical": null
        },
        {
            "@odata.id": "/redfish/v1/Chassis/System.Embedded.1/Sensors/Fans/0x17%7C%7CFan.Embedded.2",
            "@odata.type": "#Thermal.v1_4_0.Fan",
            "Assembly": {
                "@odata.id": "/redfish/v1/Chassis/System.Embedded.1/Assembly"
            },
            "FanName": "System Board Fan2 RPM",
            "LowerThresholdCritical": 360,
            "LowerThresholdFatal": 360,
            "LowerThresholdNonCritical": 600,
            "MaxReadingRange": null,
            "MemberId": "0x17||Fan.Embedded.2",
            "MinReadingRange": 360,
            "Name": "System Board Fan2 RPM",
            "PhysicalContext": "SystemBoard",
            "Reading": 5880,
            "ReadingUnits": "RPM",
            "Redundancy": [],
            "[email protected]": 0,
            "RelatedItem": [
                {
                    "@odata.id": "/redfish/v1/Chassis/System.Embedded.1"
                }
            ],
            "[email protected]": 1,
            "Status": {
                "Health": "OK",
                "State": "Enabled"
            },
            "UpperThresholdCritical": null,
            "UpperThresholdFatal": null,
            "UpperThresholdNonCritical": null
        },
        {
            "@odata.id": "/redfish/v1/Chassis/System.Embedded.1/Sensors/Fans/0x17%7C%7CFan.Embedded.3",
            "@odata.type": "#Thermal.v1_4_0.Fan",
            "Assembly": {
                "@odata.id": "/redfish/v1/Chassis/System.Embedded.1/Assembly"
            },
            "FanName": "System Board Fan3 RPM",
            "LowerThresholdCritical": 360,
            "LowerThresholdFatal": 360,
            "LowerThresholdNonCritical": 600,
            "MaxReadingRange": null,
            "MemberId": "0x17||Fan.Embedded.3",
            "MinReadingRange": 360,
            "Name": "System Board Fan3 RPM",
            "PhysicalContext": "SystemBoard",
            "Reading": 5760,
            "ReadingUnits": "RPM",
            "Redundancy": [],
            "[email protected]": 0,
            "RelatedItem": [
                {
                    "@odata.id": "/redfish/v1/Chassis/System.Embedded.1"
                }
            ],
            "[email protected]": 1,
            "Status": {
                "Health": "OK",
                "State": "Enabled"
            },
            "UpperThresholdCritical": null,
            "UpperThresholdFatal": null,
            "UpperThresholdNonCritical": null
        },
        {
            "@odata.id": "/redfish/v1/Chassis/System.Embedded.1/Sensors/Fans/0x17%7C%7CFan.Embedded.6",
            "@odata.type": "#Thermal.v1_4_0.Fan",
            "Assembly": {
                "@odata.id": "/redfish/v1/Chassis/System.Embedded.1/Assembly"
            },
            "FanName": "System Board Fan6 RPM",
            "LowerThresholdCritical": 360,
            "LowerThresholdFatal": 360,
            "LowerThresholdNonCritical": 600,
            "MaxReadingRange": null,
            "MemberId": "0x17||Fan.Embedded.6",
            "MinReadingRange": 360,
            "Name": "System Board Fan6 RPM",
            "PhysicalContext": "SystemBoard",
            "Reading": 6000,
            "ReadingUnits": "RPM",
            "Redundancy": [],
            "[email protected]": 0,
            "RelatedItem": [
                {
                    "@odata.id": "/redfish/v1/Chassis/System.Embedded.1"
                }
            ],
            "[email protected]": 1,
            "Status": {
                "Health": "OK",
                "State": "Enabled"
            },
            "UpperThresholdCritical": null,
            "UpperThresholdFatal": null,
            "UpperThresholdNonCritical": null
        },
        {
            "@odata.id": "/redfish/v1/Chassis/System.Embedded.1/Sensors/Fans/0x17%7C%7CFan.Embedded.5",
            "@odata.type": "#Thermal.v1_4_0.Fan",
            "Assembly": {
                "@odata.id": "/redfish/v1/Chassis/System.Embedded.1/Assembly"
            },
            "FanName": "System Board Fan5 RPM",
            "LowerThresholdCritical": 360,
            "LowerThresholdFatal": 360,
            "LowerThresholdNonCritical": 600,
            "MaxReadingRange": null,
            "MemberId": "0x17||Fan.Embedded.5",
            "MinReadingRange": 360,
            "Name": "System Board Fan5 RPM",
            "PhysicalContext": "SystemBoard",
            "Reading": 5760,
            "ReadingUnits": "RPM",
            "Redundancy": [],
            "[email protected]": 0,
            "RelatedItem": [
                {
                    "@odata.id": "/redfish/v1/Chassis/System.Embedded.1"
                }
            ],
            "[email protected]": 1,
            "Status": {
                "Health": "OK",
                "State": "Enabled"
            },
            "UpperThresholdCritical": null,
            "UpperThresholdFatal": null,
            "UpperThresholdNonCritical": null
        }
    ],
    "[email protected]": 6,
    "Id": "Thermal",
    "Name": "Thermal",
    "Redundancy": [
        {
            "@odata.id": "/redfish/v1/Chassis/System.Embedded.1/Thermal/Redundancy/iDRAC.Embedded.1%23SystemBoardFanRedundancy",
            "@odata.type": "#Redundancy.v1_3_0.Redundancy",
            "MaxNumSupported": null,
            "MemberId": "iDRAC.Embedded.1#SystemBoardFanRedundancy",
            "MinNumNeeded": null,
            "Mode": "N+m",
            "Name": "System Board Fan Redundancy",
            "RedundancyEnabled": true,
            "RedundancySet": [],
            "[email protected]": 0,
            "Status": {
                "Health": "OK",
                "State": "Enabled"
            }
        }
    ],
    "[email protected]": 1,
    "Temperatures": [
        {
            "@odata.context": "/redfish/v1/$metadata#Thermal.Thermal",
            "@odata.id": "/redfish/v1/Chassis/System.Embedded.1/Sensors/Temperatures/iDRAC.Embedded.1%23SystemBoardInletTemp",
            "@odata.type": "#Thermal.v1_4_0.Temperature",
            "LowerThresholdCritical": -7,
            "LowerThresholdFatal": -7,
            "LowerThresholdNonCritical": 3,
            "MaxReadingRangeTemp": 47,
            "MemberId": "iDRAC.Embedded.1#SystemBoardInletTemp",
            "MinReadingRangeTemp": -7,
            "Name": "System Board Inlet Temp",
            "PhysicalContext": "SystemBoard",
            "ReadingCelsius": 20,
            "RelatedItem": [
                {
                    "@odata.id": "/redfish/v1/Chassis/System.Embedded.1"
                }
            ],
            "[email protected]": 1,
            "SensorNumber": 4,
            "Status": {
                "Health": "OK",
                "State": "Enabled"
            },
            "UpperThresholdCritical": 47,
            "UpperThresholdFatal": 47,
            "UpperThresholdNonCritical": 42
        },
        {
            "@odata.context": "/redfish/v1/$metadata#Thermal.Thermal",
            "@odata.id": "/redfish/v1/Chassis/System.Embedded.1/Sensors/Temperatures/iDRAC.Embedded.1%23SystemBoardExhaustTemp",
            "@odata.type": "#Thermal.v1_4_0.Temperature",
            "LowerThresholdCritical": 0,
            "LowerThresholdFatal": 0,
            "LowerThresholdNonCritical": 0,
            "MaxReadingRangeTemp": 75,
            "MemberId": "iDRAC.Embedded.1#SystemBoardExhaustTemp",
            "MinReadingRangeTemp": 0,
            "Name": "System Board Exhaust Temp",
            "PhysicalContext": "SystemBoard",
            "ReadingCelsius": 38,
            "RelatedItem": [
                {
                    "@odata.id": "/redfish/v1/Chassis/System.Embedded.1"
                }
            ],
            "[email protected]": 1,
            "SensorNumber": 1,
            "Status": {
                "Health": "OK",
                "State": "Enabled"
            },
            "UpperThresholdCritical": 75,
            "UpperThresholdFatal": 75,
            "UpperThresholdNonCritical": 70
        },
        {
            "@odata.context": "/redfish/v1/$metadata#Thermal.Thermal",
            "@odata.id": "/redfish/v1/Chassis/System.Embedded.1/Sensors/Temperatures/iDRAC.Embedded.1%23CPU1Temp",
            "@odata.type": "#Thermal.v1_4_0.Temperature",
            "LowerThresholdCritical": 3,
            "LowerThresholdFatal": 3,
            "LowerThresholdNonCritical": 8,
            "MaxReadingRangeTemp": 87,
            "MemberId": "iDRAC.Embedded.1#CPU1Temp",
            "MinReadingRangeTemp": 3,
            "Name": "CPU1 Temp",
            "PhysicalContext": "CPU",
            "ReadingCelsius": 67,
            "RelatedItem": [
                {
                    "@odata.id": "/redfish/v1/Systems/System.Embedded.1/Processors/CPU.Socket.1"
                }
            ],
            "[email protected]": 1,
            "SensorNumber": 14,
            "Status": {
                "Health": "OK",
                "State": "Enabled"
            },
            "UpperThresholdCritical": 87,
            "UpperThresholdFatal": 87,
            "UpperThresholdNonCritical": 82
        }
    ],
    "[email protected]": 3
}
For Power the URL https://192.168.2.202/redfish/v1/Chassi ... ed.1/Power is available.

Code: Select all

{
    "@odata.context": "/redfish/v1/$metadata#Power.Power",
    "@odata.id": "/redfish/v1/Chassis/System.Embedded.1/Power/PowerControl",
    "@odata.type": "#Power.v1_4_0.PowerControl",
    "MemberId": "PowerControl",
    "Name": "System Power Control",
    "PowerAllocatedWatts": 896,
    "PowerAvailableWatts": 0,
    "PowerCapacityWatts": 896,
    "PowerConsumedWatts": 220,
    "PowerLimit": {
        "CorrectionInMs": 0,
        "LimitException": "HardPowerOff",
        "LimitInWatts": 398
    },
    "PowerMetrics": {
        "AverageConsumedWatts": 0,
        "IntervalInMin": 1,
        "MaxConsumedWatts": 0,
        "MinConsumedWatts": 0
    },
    "PowerRequestedWatts": 398,
    "RelatedItem": [
        {
            "@odata.id": "/redfish/v1/Chassis/System.Embedded.1"
        },
        {
            "@odata.id": "/redfish/v1/Systems/System.Embedded.1"
        }
    ],
    "[email protected]": 2
}
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Read Dell iDRAC values through Redfish

Post by waaren »

Ragdag wrote: Saturday 11 April 2020 11:15 I'm trying to figure out how to populate sensors in Domoticz with values from my Dell iDRAC server.
With Redfish I can get temperature and power consumption that I would like to collect in Domoticz but I have no idea how to build this.

Not sure what is easier, one URL that will only give back one sensor or one URL that will give back all.
If you search this forum with

Code: Select all

dzVents json sensor
in the search field you will find a lot of examples on how to do this. Just start with coding and if you get stuck somewhere while doing that I am happy to explain.

If you are going to use dzVents, you could best use one json to retrieve all data in one pass.
When not yet familiar with dzVents please start with reading Get started Before implementing (~ 5 minutes). Special attention please for "In Domoticz go to Setup > Settings > Other and in the section EventSystem make sure the checkbox 'dzVents enabled' is checked. Also make sure that in the Security section in the settings you allow 127.0.0.1 to not need a password. dzVents uses that port to send certain commands to Domoticz. Finally make sure you have set your current location in Setup > Settings > System > Location, otherwise there is no way to determine nighttime/daytime state."
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
User avatar
Ragdag
Posts: 152
Joined: Friday 30 March 2018 13:56
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Read Dell iDRAC values through Redfish

Post by Ragdag »

Thanks, will do.
User avatar
Ragdag
Posts: 152
Joined: Friday 30 March 2018 13:56
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Read Dell iDRAC values through Redfish

Post by Ragdag »

waaren wrote: Saturday 11 April 2020 12:32
Ragdag wrote: Saturday 11 April 2020 11:15 I'm trying to figure out how to populate sensors in Domoticz with values from my Dell iDRAC server.
With Redfish I can get temperature and power consumption that I would like to collect in Domoticz but I have no idea how to build this.

Not sure what is easier, one URL that will only give back one sensor or one URL that will give back all.
If you search this forum with

Code: Select all

dzVents json sensor
in the search field you will find a lot of examples on how to do this. Just start with coding and if you get stuck somewhere while doing that I am happy to explain.

If you are going to use dzVents, you could best use one json to retrieve all data in one pass.
When not yet familiar with dzVents please start with reading Get started Before implementing (~ 5 minutes). Special attention please for "In Domoticz go to Setup > Settings > Other and in the section EventSystem make sure the checkbox 'dzVents enabled' is checked. Also make sure that in the Security section in the settings you allow 127.0.0.1 to not need a password. dzVents uses that port to send certain commands to Domoticz. Finally make sure you have set your current location in Setup > Settings > System > Location, otherwise there is no way to determine nighttime/daytime state."
I'm starting from the template HTTPrequest
How do I determine httpResponses should be?

Code: Select all

httpResponses = {
			'trigger' -- must match with the callback passed to the openURL command
Is that one of the headers from the request?
Image
Last edited by Ragdag on Saturday 11 April 2020 14:30, edited 2 times in total.
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Read Dell iDRAC values through Redfish

Post by waaren »

Ragdag wrote: Saturday 11 April 2020 14:20 I'm starting from the template HTTPrequest
How do I determine httpResponses should be?

Code: Select all

httpResponses = {
			'trigger' -- must match with the callback passed to the openURL command
trigger is a string you can choose freely as long it is the same as what you use as callBack in the openURL call.
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
User avatar
Ragdag
Posts: 152
Joined: Friday 30 March 2018 13:56
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Read Dell iDRAC values through Redfish

Post by Ragdag »

waaren wrote: Saturday 11 April 2020 14:22
Ragdag wrote: Saturday 11 April 2020 14:20 I'm starting from the template HTTPrequest
How do I determine httpResponses should be?

Code: Select all

httpResponses = {
			'trigger' -- must match with the callback passed to the openURL command
trigger is a string you can choose freely as long it is the same as what you use as callBack in the openURL call.
Thanks.

The other question what is the correct JSON ID for instance for the inlet Temp.
I thought it was local inletTemp = iDRAC.Embedded.1#SystemBoardInletTemp but that gives an error

I believe I'm almost there
Have the following but and the sensor I created is getting updated each minute but I'm not yet able to capture the temperature.

Code: Select all

return {
	on = {
		timer = {
			'every 1 minutes' -- just an example to trigger the request
		},
		httpResponses = {
			'trigger' -- must match with the callback passed to the openURL command
		}
	},
	execute = function(domoticz, item)

		if (item.isTimer) then
			domoticz.openURL({
				url = 'https://root:[email protected]/redfish/v1/Chassis/System.Embedded.1/Thermal',
				method = 'GET',
				callback = 'trigger', -- see httpResponses above.
			})
		end

		if (item.isHTTPResponse) then

			if (item.ok) then
				if (item.isJSON) then

					local inletTemp = item.json.ReadingCelsius  -- just an example

					-- update some device in Domoticz
					domoticz.devices('Server Inlet Temp').updateTemperature(inletTemp)
				end
			else
				domoticz.log('There was a problem handling the request', domoticz.LOG_ERROR)
				domoticz.log(item, domoticz.LOG_ERROR)
			end

		end

	end
}
Last edited by Ragdag on Saturday 11 April 2020 14:52, edited 1 time in total.
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Read Dell iDRAC values through Redfish

Post by waaren »

Ragdag wrote: Saturday 11 April 2020 14:30 The other question what is the correct JSON ID for instance for the inlet Temp.
I thought it was local inletTemp = iDRAC.Embedded.1#SystemBoardInletTemp but that gives an error
What do you have sofar and what do you see in the log ?
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
User avatar
Ragdag
Posts: 152
Joined: Friday 30 March 2018 13:56
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Read Dell iDRAC values through Redfish

Post by Ragdag »

waaren wrote: Saturday 11 April 2020 14:51
Ragdag wrote: Saturday 11 April 2020 14:30 The other question what is the correct JSON ID for instance for the inlet Temp.
I thought it was local inletTemp = iDRAC.Embedded.1#SystemBoardInletTemp but that gives an error
What do you have sofar and what do you see in the log ?
Let me aggregate all info
Current code

Code: Select all

return {
	on = {
		timer = {
			'every 1 minutes' -- just an example to trigger the request
		},
		httpResponses = {
			'trigger' -- must match with the callback passed to the openURL command
		}
	},
	execute = function(domoticz, item)

		if (item.isTimer) then
			domoticz.openURL({
				url = 'https://root:[email protected]/redfish/v1/Chassis/System.Embedded.1/Thermal',
				method = 'GET',
				callback = 'trigger', -- see httpResponses above.
			})
		end

		if (item.isHTTPResponse) then

			if (item.ok) then
				if (item.isJSON) then

					local inletTemp = item.json.ReadingCelsius  -- just an example

					-- update some device in Domoticz
					domoticz.devices('Server Inlet Temp').updateTemperature(inletTemp)
				end
			else
				domoticz.log('There was a problem handling the request', domoticz.LOG_ERROR)
				domoticz.log(item, domoticz.LOG_ERROR)
			end

		end

	end
}
In the log

Code: Select all

2020-04-11 14:52:08.904 Status: dzVents: Info: Handling httpResponse-events for: "trigger"
2020-04-11 14:52:08.904 Status: dzVents: Info: ------ Start internal script: iDRAC Temp: HTTPResponse: "trigger"
2020-04-11 14:52:08.934 Status: dzVents: Info: ------ Finished iDRAC Temp
2020-04-11 14:52:08.935 Status: EventSystem: Script event triggered: /home/pi/domoticz/dzVents/runtime/dzVents.lua
I see that the sensor I created is being updated.
Image
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Read Dell iDRAC values through Redfish

Post by waaren »

Ragdag wrote: Saturday 11 April 2020 14:54 I see that the sensor I created is being updated.
Sounds like good progress !

if you add

Code: Select all

domoticz.utils.dumpTable(item.json)
as line 24
(just above

Code: Select all

local inletTemp = item.json.ReadingCelsius  -- just an example 
) You will see the complete table and it makes it easier to pick the right values from the json return.
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
User avatar
Ragdag
Posts: 152
Joined: Friday 30 March 2018 13:56
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Read Dell iDRAC values through Redfish

Post by Ragdag »

I have the complete table already with Postman but I can't figure out the correct syntax to pick the inlet temp.


The complete table from Postman is.

Code: Select all

{
    "@odata.context": "/redfish/v1/$metadata#Thermal.Thermal",
    "@odata.id": "/redfish/v1/Chassis/System.Embedded.1/Thermal",
    "@odata.type": "#Thermal.v1_4_0.Thermal",
    "Description": "Represents the properties for Temperature and Cooling",
    "Fans": [
        {
            "@odata.id": "/redfish/v1/Chassis/System.Embedded.1/Sensors/Fans/0x17%7C%7CFan.Embedded.1",
            "@odata.type": "#Thermal.v1_4_0.Fan",
            "Assembly": {
                "@odata.id": "/redfish/v1/Chassis/System.Embedded.1/Assembly"
            },
            "FanName": "System Board Fan1 RPM",
            "LowerThresholdCritical": 360,
            "LowerThresholdFatal": 360,
            "LowerThresholdNonCritical": 600,
            "MaxReadingRange": null,
            "MemberId": "0x17||Fan.Embedded.1",
            "MinReadingRange": 360,
            "Name": "System Board Fan1 RPM",
            "PhysicalContext": "SystemBoard",
            "Reading": 4920,
            "ReadingUnits": "RPM",
            "Redundancy": [],
            "[email protected]": 0,
            "RelatedItem": [
                {
                    "@odata.id": "/redfish/v1/Chassis/System.Embedded.1"
                }
            ],
            "[email protected]": 1,
            "Status": {
                "Health": "OK",
                "State": "Enabled"
            },
            "UpperThresholdCritical": null,
            "UpperThresholdFatal": null,
            "UpperThresholdNonCritical": null
        },
        {
            "@odata.id": "/redfish/v1/Chassis/System.Embedded.1/Sensors/Fans/0x17%7C%7CFan.Embedded.4",
            "@odata.type": "#Thermal.v1_4_0.Fan",
            "Assembly": {
                "@odata.id": "/redfish/v1/Chassis/System.Embedded.1/Assembly"
            },
            "FanName": "System Board Fan4 RPM",
            "LowerThresholdCritical": 360,
            "LowerThresholdFatal": 360,
            "LowerThresholdNonCritical": 600,
            "MaxReadingRange": null,
            "MemberId": "0x17||Fan.Embedded.4",
            "MinReadingRange": 360,
            "Name": "System Board Fan4 RPM",
            "PhysicalContext": "SystemBoard",
            "Reading": 4800,
            "ReadingUnits": "RPM",
            "Redundancy": [],
            "[email protected]": 0,
            "RelatedItem": [
                {
                    "@odata.id": "/redfish/v1/Chassis/System.Embedded.1"
                }
            ],
            "[email protected]": 1,
            "Status": {
                "Health": "OK",
                "State": "Enabled"
            },
            "UpperThresholdCritical": null,
            "UpperThresholdFatal": null,
            "UpperThresholdNonCritical": null
        },
        {
            "@odata.id": "/redfish/v1/Chassis/System.Embedded.1/Sensors/Fans/0x17%7C%7CFan.Embedded.2",
            "@odata.type": "#Thermal.v1_4_0.Fan",
            "Assembly": {
                "@odata.id": "/redfish/v1/Chassis/System.Embedded.1/Assembly"
            },
            "FanName": "System Board Fan2 RPM",
            "LowerThresholdCritical": 360,
            "LowerThresholdFatal": 360,
            "LowerThresholdNonCritical": 600,
            "MaxReadingRange": null,
            "MemberId": "0x17||Fan.Embedded.2",
            "MinReadingRange": 360,
            "Name": "System Board Fan2 RPM",
            "PhysicalContext": "SystemBoard",
            "Reading": 4920,
            "ReadingUnits": "RPM",
            "Redundancy": [],
            "[email protected]": 0,
            "RelatedItem": [
                {
                    "@odata.id": "/redfish/v1/Chassis/System.Embedded.1"
                }
            ],
            "[email protected]": 1,
            "Status": {
                "Health": "OK",
                "State": "Enabled"
            },
            "UpperThresholdCritical": null,
            "UpperThresholdFatal": null,
            "UpperThresholdNonCritical": null
        },
        {
            "@odata.id": "/redfish/v1/Chassis/System.Embedded.1/Sensors/Fans/0x17%7C%7CFan.Embedded.3",
            "@odata.type": "#Thermal.v1_4_0.Fan",
            "Assembly": {
                "@odata.id": "/redfish/v1/Chassis/System.Embedded.1/Assembly"
            },
            "FanName": "System Board Fan3 RPM",
            "LowerThresholdCritical": 360,
            "LowerThresholdFatal": 360,
            "LowerThresholdNonCritical": 600,
            "MaxReadingRange": null,
            "MemberId": "0x17||Fan.Embedded.3",
            "MinReadingRange": 360,
            "Name": "System Board Fan3 RPM",
            "PhysicalContext": "SystemBoard",
            "Reading": 4920,
            "ReadingUnits": "RPM",
            "Redundancy": [],
            "[email protected]": 0,
            "RelatedItem": [
                {
                    "@odata.id": "/redfish/v1/Chassis/System.Embedded.1"
                }
            ],
            "[email protected]": 1,
            "Status": {
                "Health": "OK",
                "State": "Enabled"
            },
            "UpperThresholdCritical": null,
            "UpperThresholdFatal": null,
            "UpperThresholdNonCritical": null
        },
        {
            "@odata.id": "/redfish/v1/Chassis/System.Embedded.1/Sensors/Fans/0x17%7C%7CFan.Embedded.6",
            "@odata.type": "#Thermal.v1_4_0.Fan",
            "Assembly": {
                "@odata.id": "/redfish/v1/Chassis/System.Embedded.1/Assembly"
            },
            "FanName": "System Board Fan6 RPM",
            "LowerThresholdCritical": 360,
            "LowerThresholdFatal": 360,
            "LowerThresholdNonCritical": 600,
            "MaxReadingRange": null,
            "MemberId": "0x17||Fan.Embedded.6",
            "MinReadingRange": 360,
            "Name": "System Board Fan6 RPM",
            "PhysicalContext": "SystemBoard",
            "Reading": 5040,
            "ReadingUnits": "RPM",
            "Redundancy": [],
            "[email protected]": 0,
            "RelatedItem": [
                {
                    "@odata.id": "/redfish/v1/Chassis/System.Embedded.1"
                }
            ],
            "[email protected]": 1,
            "Status": {
                "Health": "OK",
                "State": "Enabled"
            },
            "UpperThresholdCritical": null,
            "UpperThresholdFatal": null,
            "UpperThresholdNonCritical": null
        },
        {
            "@odata.id": "/redfish/v1/Chassis/System.Embedded.1/Sensors/Fans/0x17%7C%7CFan.Embedded.5",
            "@odata.type": "#Thermal.v1_4_0.Fan",
            "Assembly": {
                "@odata.id": "/redfish/v1/Chassis/System.Embedded.1/Assembly"
            },
            "FanName": "System Board Fan5 RPM",
            "LowerThresholdCritical": 360,
            "LowerThresholdFatal": 360,
            "LowerThresholdNonCritical": 600,
            "MaxReadingRange": null,
            "MemberId": "0x17||Fan.Embedded.5",
            "MinReadingRange": 360,
            "Name": "System Board Fan5 RPM",
            "PhysicalContext": "SystemBoard",
            "Reading": 4920,
            "ReadingUnits": "RPM",
            "Redundancy": [],
            "[email protected]": 0,
            "RelatedItem": [
                {
                    "@odata.id": "/redfish/v1/Chassis/System.Embedded.1"
                }
            ],
            "[email protected]": 1,
            "Status": {
                "Health": "OK",
                "State": "Enabled"
            },
            "UpperThresholdCritical": null,
            "UpperThresholdFatal": null,
            "UpperThresholdNonCritical": null
        }
    ],
    "[email protected]": 6,
    "Id": "Thermal",
    "Name": "Thermal",
    "Redundancy": [
        {
            "@odata.id": "/redfish/v1/Chassis/System.Embedded.1/Thermal/Redundancy/iDRAC.Embedded.1%23SystemBoardFanRedundancy",
            "@odata.type": "#Redundancy.v1_3_0.Redundancy",
            "MaxNumSupported": null,
            "MemberId": "iDRAC.Embedded.1#SystemBoardFanRedundancy",
            "MinNumNeeded": null,
            "Mode": "N+m",
            "Name": "System Board Fan Redundancy",
            "RedundancyEnabled": true,
            "RedundancySet": [],
            "[email protected]": 0,
            "Status": {
                "Health": "OK",
                "State": "Enabled"
            }
        }
    ],
    "[email protected]": 1,
    "Temperatures": [
        {
            "@odata.context": "/redfish/v1/$metadata#Thermal.Thermal",
            "@odata.id": "/redfish/v1/Chassis/System.Embedded.1/Sensors/Temperatures/iDRAC.Embedded.1%23SystemBoardInletTemp",
            "@odata.type": "#Thermal.v1_4_0.Temperature",
            "LowerThresholdCritical": -7,
            "LowerThresholdFatal": -7,
            "LowerThresholdNonCritical": 3,
            "MaxReadingRangeTemp": 47,
            "MemberId": "iDRAC.Embedded.1#SystemBoardInletTemp",
            "MinReadingRangeTemp": -7,
            "Name": "System Board Inlet Temp",
            "PhysicalContext": "SystemBoard",
            "ReadingCelsius": 22,
            "RelatedItem": [
                {
                    "@odata.id": "/redfish/v1/Chassis/System.Embedded.1"
                }
            ],
            "[email protected]": 1,
            "SensorNumber": 4,
            "Status": {
                "Health": "OK",
                "State": "Enabled"
            },
            "UpperThresholdCritical": 47,
            "UpperThresholdFatal": 47,
            "UpperThresholdNonCritical": 42
        },
        {
            "@odata.context": "/redfish/v1/$metadata#Thermal.Thermal",
            "@odata.id": "/redfish/v1/Chassis/System.Embedded.1/Sensors/Temperatures/iDRAC.Embedded.1%23SystemBoardExhaustTemp",
            "@odata.type": "#Thermal.v1_4_0.Temperature",
            "LowerThresholdCritical": 0,
            "LowerThresholdFatal": 0,
            "LowerThresholdNonCritical": 0,
            "MaxReadingRangeTemp": 75,
            "MemberId": "iDRAC.Embedded.1#SystemBoardExhaustTemp",
            "MinReadingRangeTemp": 0,
            "Name": "System Board Exhaust Temp",
            "PhysicalContext": "SystemBoard",
            "ReadingCelsius": 37,
            "RelatedItem": [
                {
                    "@odata.id": "/redfish/v1/Chassis/System.Embedded.1"
                }
            ],
            "[email protected]": 1,
            "SensorNumber": 1,
            "Status": {
                "Health": "OK",
                "State": "Enabled"
            },
            "UpperThresholdCritical": 75,
            "UpperThresholdFatal": 75,
            "UpperThresholdNonCritical": 70
        },
        {
            "@odata.context": "/redfish/v1/$metadata#Thermal.Thermal",
            "@odata.id": "/redfish/v1/Chassis/System.Embedded.1/Sensors/Temperatures/iDRAC.Embedded.1%23CPU1Temp",
            "@odata.type": "#Thermal.v1_4_0.Temperature",
            "LowerThresholdCritical": 3,
            "LowerThresholdFatal": 3,
            "LowerThresholdNonCritical": 8,
            "MaxReadingRangeTemp": 87,
            "MemberId": "iDRAC.Embedded.1#CPU1Temp",
            "MinReadingRangeTemp": 3,
            "Name": "CPU1 Temp",
            "PhysicalContext": "CPU",
            "ReadingCelsius": 58,
            "RelatedItem": [
                {
                    "@odata.id": "/redfish/v1/Systems/System.Embedded.1/Processors/CPU.Socket.1"
                }
            ],
            "[email protected]": 1,
            "SensorNumber": 14,
            "Status": {
                "Health": "OK",
                "State": "Enabled"
            },
            "UpperThresholdCritical": 87,
            "UpperThresholdFatal": 87,
            "UpperThresholdNonCritical": 82
        }
    ],
    "[email protected]": 3
}
The output from your addition

Code: Select all

2020-04-11 15:24:00.282 Status: dzVents: Info: ------ Start internal script: iDRAC Temp:, trigger: "every 1 minutes"
2020-04-11 15:24:00.283 Status: dzVents: Info: ------ Finished iDRAC Temp
2020-04-11 15:24:00.283 Status: EventSystem: Script event triggered: /home/pi/domoticz/dzVents/runtime/dzVents.lua
2020-04-11 15:24:04.643 (Z-wave) General/kWh (kWh Keuken)
2020-04-11 15:24:04.766 (Z-wave) Usage (Unknown)
2020-04-11 15:24:04.775 (Z-wave) General/kWh (kWh Keuken)
2020-04-11 15:24:04.787 (Power-Gas) P1 Smart Meter (Power)
2020-04-11 15:24:06.972 (Z-wave) General/kWh (kWh Keuken)
2020-04-11 15:24:07.095 (Z-wave) Usage (Unknown)
2020-04-11 15:24:07.104 (Z-wave) General/kWh (kWh Keuken)
2020-04-11 15:24:08.841 Status: dzVents: > Status:
2020-04-11 15:24:08.841 Status: dzVents: > State: Enabled
2020-04-11 15:24:08.841 Status: dzVents: > Health: OK
2020-04-11 15:24:08.841 Status: dzVents: > RelatedItem:
2020-04-11 15:24:08.841 Status: dzVents: > 1:
2020-04-11 15:24:08.841 Status: dzVents: > @odata.id: /redfish/v1/Chassis/System.Embedded.1
2020-04-11 15:24:08.841 Status: dzVents: > MemberId: 0x17||Fan.Embedded.5
2020-04-11 15:24:08.841 Status: dzVents: > LowerThresholdNonCritical: 600
2020-04-11 15:24:08.841 Status: dzVents: > @odata.id: /redfish/v1/Chassis/System.Embedded.1/Thermal
2020-04-11 15:24:08.841 Status: dzVents: > Redundancy:
2020-04-11 15:24:08.841 Status: dzVents: > 1:
2020-04-11 15:24:08.841 Status: dzVents: > Name: System Board Fan Redundancy
2020-04-11 15:24:08.841 Status: dzVents: > @odata.type: #Redundancy.v1_3_0.Redundancy
2020-04-11 15:24:08.841 Status: dzVents: > [email protected]: 0
2020-04-11 15:24:08.841 Status: dzVents: > RedundancyEnabled: true
2020-04-11 15:24:08.842 Status: dzVents: > Status:
2020-04-11 15:24:08.842 Status: dzVents: > State: Enabled
2020-04-11 15:24:08.842 Status: dzVents: > Health: OK
2020-04-11 15:24:08.842 Status: dzVents: > Mode: N+m
2020-04-11 15:24:08.842 Status: dzVents: > RedundancySet:
2020-04-11 15:24:08.842 Status: dzVents: > MemberId: iDRAC.Embedded.1#SystemBoardFanRedundancy
2020-04-11 15:24:08.842 Status: dzVents: > @odata.id: /redfish/v1/Chassis/System.Embedded.1/Thermal/Redundancy/iDRAC.Embedded.1%23SystemBoardFanRedundancy
2020-04-11 15:24:08.842 Status: dzVents: > [email protected]: 1
2020-04-11 15:24:08.842 Status: dzVents: > Temperatures:
2020-04-11 15:24:08.842 Status: dzVents: > 1:
2020-04-11 15:24:08.842 Status: dzVents: > [email protected]: 1
2020-04-11 15:24:08.842 Status: dzVents: > Name: System Board Inlet Temp
2020-04-11 15:24:08.842 Status: dzVents: > LowerThresholdFatal: -7
2020-04-11 15:24:08.842 Status: dzVents: > UpperThresholdNonCritical: 42
2020-04-11 15:24:08.842 Status: dzVents: > PhysicalContext: SystemBoard
2020-04-11 15:24:08.842 Status: dzVents: > @odata.id: /redfish/v1/Chassis/System.Embedded.1/Sensors/Temperatures/iDRAC.Embedded.1%23SystemBoardInletTemp
2020-04-11 15:24:08.842 Status: dzVents: > MaxReadingRangeTemp: 47
2020-04-11 15:24:08.842 Status: dzVents: > MinReadingRangeTemp: -7
2020-04-11 15:24:08.842 Status: dzVents: > ReadingCelsius: 23
2020-04-11 15:24:08.842 Status: dzVents: > UpperThresholdFatal: 47
2020-04-11 15:24:08.842 Status: dzVents: > @odata.context: /redfish/v1/$metadata#Thermal.Thermal
2020-04-11 15:24:08.842 Status: dzVents: > RelatedItem:
2020-04-11 15:24:08.842 Status: dzVents: > 1:
2020-04-11 15:24:08.842 Status: dzVents: > @odata.id: /redfish/v1/Chassis/System.Embedded.1
2020-04-11 15:24:08.842 Status: dzVents: > Status:
2020-04-11 15:24:08.842 Status: dzVents: > State: Enabled
2020-04-11 15:24:08.842 Status: dzVents: > Health: OK
2020-04-11 15:24:08.842 Status: dzVents: > LowerThresholdNonCritical: 3
2020-04-11 15:24:08.842 Status: dzVents: > LowerThresholdCritical: -7
2020-04-11 15:24:08.842 Status: dzVents: > @odata.type: #Thermal.v1_4_0.Temperature
2020-04-11 15:24:08.842 Status: dzVents: > MemberId: iDRAC.Embedded.1#SystemBoardInletTemp
2020-04-11 15:24:08.842 Status: dzVents: > SensorNumber: 4
2020-04-11 15:24:08.842 Status: dzVents: > UpperThresholdCritical: 47
2020-04-11 15:24:08.842 Status: dzVents: > 2:
2020-04-11 15:24:08.842 Status: dzVents: > [email protected]: 1
2020-04-11 15:24:08.842 Status: dzVents: > Name: System Board Exhaust Temp
2020-04-11 15:24:08.842 Status: dzVents: > LowerThresholdFatal: 0
2020-04-11 15:24:08.842 Status: dzVents: > UpperThresholdNonCritical: 70
2020-04-11 15:24:08.842 Status: dzVents: > PhysicalContext: SystemBoard
2020-04-11 15:24:08.842 Status: dzVents: > @odata.id: /redfish/v1/Chassis/System.Embedded.1/Sensors/Temperatures/iDRAC.Embedded.1%23SystemBoardExhaustTemp
2020-04-11 15:24:08.842 Status: dzVents: > MaxReadingRangeTemp: 75
2020-04-11 15:24:08.842 Status: dzVents: > MinReadingRangeTemp: 0
2020-04-11 15:24:08.842 Status: dzVents: > ReadingCelsius: 36
2020-04-11 15:24:08.842 Status: dzVents: > UpperThresholdFatal: 75
2020-04-11 15:24:08.843 Status: dzVents: > @odata.context: /redfish/v1/$metadata#Thermal.Thermal
2020-04-11 15:24:08.843 Status: dzVents: > RelatedItem:
2020-04-11 15:24:08.843 Status: dzVents: > 1:
2020-04-11 15:24:08.843 Status: dzVents: > @odata.id: /redfish/v1/Chassis/System.Embedded.1
2020-04-11 15:24:08.843 Status: dzVents: > Status:
2020-04-11 15:24:08.843 Status: dzVents: > State: Enabled
2020-04-11 15:24:08.843 Status: dzVents: > Health: OK
2020-04-11 15:24:08.843 Status: dzVents: > LowerThresholdNonCritical: 0
2020-04-11 15:24:08.843 Status: dzVents: > LowerThresholdCritical: 0
2020-04-11 15:24:08.843 Status: dzVents: > @odata.type: #Thermal.v1_4_0.Temperature
2020-04-11 15:24:08.843 Status: dzVents: > MemberId: iDRAC.Embedded.1#SystemBoardExhaustTemp
2020-04-11 15:24:08.843 Status: dzVents: > SensorNumber: 1
2020-04-11 15:24:08.843 Status: dzVents: > UpperThresholdCritical: 75
2020-04-11 15:24:08.843 Status: dzVents: > 3:
2020-04-11 15:24:08.843 Status: dzVents: > [email protected]: 1
2020-04-11 15:24:08.843 Status: dzVents: > Name: CPU1 Temp
2020-04-11 15:24:08.843 Status: dzVents: > LowerThresholdFatal: 3
2020-04-11 15:24:08.843 Status: dzVents: > UpperThresholdNonCritical: 82
2020-04-11 15:24:08.843 Status: dzVents: > PhysicalContext: CPU
2020-04-11 15:24:08.843 Status: dzVents: > @odata.id: /redfish/v1/Chassis/System.Embedded.1/Sensors/Temperatures/iDRAC.Embedded.1%23CPU1Temp
2020-04-11 15:24:08.843 Status: dzVents: > MaxReadingRangeTemp: 87
2020-04-11 15:24:08.843 Status: dzVents: > MinReadingRangeTemp: 3
2020-04-11 15:24:08.843 Status: dzVents: > ReadingCelsius: 59
2020-04-11 15:24:08.843 Status: dzVents: > UpperThresholdFatal: 87
2020-04-11 15:24:08.843 Status: dzVents: > @odata.context: /redfish/v1/$metadata#Thermal.Thermal
2020-04-11 15:24:08.843 Status: dzVents: > RelatedItem:
2020-04-11 15:24:08.843 Status: dzVents: > 1:
2020-04-11 15:24:08.843 Status: dzVents: > @odata.id: /redfish/v1/Systems/System.Embedded.1/Processors/CPU.Socket.1
2020-04-11 15:24:08.843 Status: dzVents: > Status:
2020-04-11 15:24:08.843 Status: dzVents: > State: Enabled
2020-04-11 15:24:08.843 Status: dzVents: > Health: OK
2020-04-11 15:24:08.843 Status: dzVents: > LowerThresholdNonCritical: 8
2020-04-11 15:24:08.843 Status: dzVents: > LowerThresholdCritical: 3
2020-04-11 15:24:08.843 Status: dzVents: > @odata.type: #Thermal.v1_4_0.Temperature
2020-04-11 15:24:08.843 Status: dzVents: > MemberId: iDRAC.Embedded.1#CPU1Temp
2020-04-11 15:24:08.843 Status: dzVents: > SensorNumber: 14
2020-04-11 15:24:08.843 Status: dzVents: > UpperThresholdCritical: 87
2020-04-11 15:24:08.843 Status: dzVents: > Id: Thermal
2020-04-11 15:24:08.843 Status: dzVents: > Description: Represents the properties for Temperature and Cooling
2020-04-11 15:24:08.858 Status: dzVents: Info: ------ Finished iDRAC Temp
2020-04-11 15:24:08.858 Status: EventSystem: Script event triggered: /home/pi/domoticz/dzVents/runtime/dzVents.lua
User avatar
Ragdag
Posts: 152
Joined: Friday 30 March 2018 13:56
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Read Dell iDRAC values through Redfish

Post by Ragdag »

If I use the URL /redfish/v1/Chassis/System.Embedded.1/Sensors/Temperatures/iDRAC.Embedded.1%23SystemBoardInletTemp to get the JSON payload I get it working actually with this code.

Code: Select all

return {
	on = {
		timer = {
			'every 1 minutes' -- just an example to trigger the request
		},
		httpResponses = {
			'trigger' -- must match with the callback passed to the openURL command
		}
	},
	execute = function(domoticz, item)

		if (item.isTimer) then
			domoticz.openURL({
				url = 'https://root:[email protected]/redfish/v1/Chassis/System.Embedded.1/Sensors/Temperatures/iDRAC.Embedded.1%23SystemBoardInletTemp',
				method = 'GET',
				callback = 'trigger', -- see httpResponses above.
			})
		end

		if (item.isHTTPResponse) then

			if (item.ok) then
				if (item.isJSON) then
                    domoticz.utils.dumpTable(item.json)
					local inletTemp = item.json.ReadingCelsius  -- just an example

					-- update some device in Domoticz
					domoticz.devices('Server Inlet Temp').updateTemperature(inletTemp)
				end
			else
				domoticz.log('There was a problem handling the request', domoticz.LOG_ERROR)
				domoticz.log(item, domoticz.LOG_ERROR)
			end

		end

	end
}
Image

It is just when I call https://192.168.2.202/redfish/v1/Chassi ... mperatures and get all values at the same time that I don't know how to get the right one.

Thank you so far for your patience and help.

EDIT:
Also trying something like this does not work.

Code: Select all

return {
	on = {
		timer = {
			'every 1 minutes' -- just an example to trigger the request
		},
		httpResponses = {
			'trigger' -- must match with the callback passed to the openURL command
		}
	},
	execute = function(domoticz, item)

		if (item.isTimer) then
			domoticz.openURL({
				url = 'https://root:[email protected]/redfish/v1/Chassis/System.Embedded.1/Thermal',
				method = 'GET',
				callback = 'trigger', -- see httpResponses above.
			})
		end

		if (item.isHTTPResponse) then

			if (item.ok) then
				if (item.isJSON) then

					local inletTemp = item['json']['Temperatures']['iDRAC.Embedded.1%23SystemBoardInletTemp']['ReadingCelsius']  -- just an example

					-- update some device in Domoticz
					domoticz.devices('Server Inlet Temp').updateTemperature(inletTemp)
				end
			else
				domoticz.log('There was a problem handling the request', domoticz.LOG_ERROR)
				domoticz.log(item, domoticz.LOG_ERROR)
			end

		end

	end
}
User avatar
Ragdag
Posts: 152
Joined: Friday 30 March 2018 13:56
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Read Dell iDRAC values through Redfish

Post by Ragdag »

I think I have it :D

Should this be it?

Code: Select all

return {
	on = {
		timer = {
			'every 1 minutes' -- just an example to trigger the request
		},
		httpResponses = {
			'trigger' -- must match with the callback passed to the openURL command
		}
	},
	execute = function(domoticz, item)

		if (item.isTimer) then
			domoticz.openURL({
				url = 'https://root:[email protected]/redfish/v1/Chassis/System.Embedded.1/Thermal',
				method = 'GET',
				callback = 'trigger', -- see httpResponses above.
			})
		end

		if (item.isHTTPResponse) then

			if (item.ok) then
				if (item.isJSON) then

					local inletTemp = item.json.Temperatures[1].ReadingCelsius
					local ExhaustTemp = item.json.Temperatures[2].ReadingCelsius

					-- update some device in Domoticz
					domoticz.devices('Server Inlet Temp').updateTemperature(inletTemp)
					domoticz.devices('Server Exhaust Temp').updateTemperature(ExhaustTemp)
				end
			else
				domoticz.log('There was a problem handling the request', domoticz.LOG_ERROR)
				domoticz.log(item, domoticz.LOG_ERROR)
			end

		end

	end
}
This give me and looks okay
Image
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Read Dell iDRAC values through Redfish

Post by waaren »

Ragdag wrote: Saturday 11 April 2020 16:11 I think I have it :D
Looks good 👍

My experience is that once you see how the json translates into the Lua table structure it will make it easier to get the right fields.
Even more so if you look at the domoticz log in OS file. In the GUI it is all flat but on the OS level you also see the indention.
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
User avatar
Ragdag
Posts: 152
Joined: Friday 30 March 2018 13:56
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Read Dell iDRAC values through Redfish

Post by Ragdag »

waaren wrote: Saturday 11 April 2020 16:46
Ragdag wrote: Saturday 11 April 2020 16:11 I think I have it :D
Looks good 👍

My experience is that once you see how the json translates into the Lua table structure it will make it easier to get the right fields.
Even more so if you look at the domoticz log in OS file. In the GUI it is all flat but on the OS level you also see the indention.
Would it also be possible to add the second URL https://root:[email protected]/redfi ... werControl in the same script or would it be better to have them separate?
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Read Dell iDRAC values through Redfish

Post by waaren »

Ragdag wrote: Saturday 11 April 2020 16:55 Would it also be possible to add the second URL https://root:[email protected]/redfi ... werControl in the same script or would it be better to have them separate?
It's possible.
If the information to be processed is related I would put them in one script. Use different callbacks so you can identify in the script which one of the openURL's returns triggered the script.
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
User avatar
Ragdag
Posts: 152
Joined: Friday 30 March 2018 13:56
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Read Dell iDRAC values through Redfish

Post by Ragdag »

waaren wrote: Saturday 11 April 2020 23:55
Ragdag wrote: Saturday 11 April 2020 16:55 Would it also be possible to add the second URL https://root:[email protected]/redfi ... werControl in the same script or would it be better to have them separate?
It's possible.
If the information to be processed is related I would put them in one script. Use different callbacks so you can identify in the script which one of the openURL's returns triggered the script.
Would you have an example of that?
I'm reading through https://www.domoticz.com/wiki/DzVents:_ ... P_requests but that does not make it clear for me.
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Read Dell iDRAC values through Redfish

Post by waaren »

Ragdag wrote: Monday 13 April 2020 11:49 Would you have an example of that?
I'm reading through https://www.domoticz.com/wiki/DzVents:_ ... P_requests but that does not make it clear for me.
Example with different callbacks within HTTPResponse

Code: Select all

return 
{
    on = 
    {
        devices = 
        {
            'HTTPSwitch'  -- just to trigger the script
        },
        
        httpResponses = 
        {
            'trigger_*', -- wildcard trigger
        },
    },

    logging = 
    {
        level = domoticz.LOG_DEBUG,
        marker = 'httpResponseTest',
    },
    
    execute = function(dz, item)
        
        local function sendURL(json, trigger, delay)
            local url = dz.settings['Domoticz url'] .. '/json.htm?'  .. json 
            dz.openURL(
            {
                url = url,
                callback = trigger 
            }).afterSec(delay or 0)
        end

        if item.isHTTPResponse then
            dz.log('Script now triggered by ' .. item.callback,dz.LOG_DEBUG)
            dz.utils.dumpTable(item.json)
        else
            sendURL('type=command&param=getversion','trigger_getVersion')
            sendURL('type=users','trigger_users',5 ) -- after 5 seconds
            sendURL('type=command&param=getlog','trigger_getlog',10 ) -- after 10 seconds
        end
    end
}
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
User avatar
Ragdag
Posts: 152
Joined: Friday 30 March 2018 13:56
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Read Dell iDRAC values through Redfish

Post by Ragdag »

Thank you, I'll study it and try to work through it.
Again thank you for your patience and guidance!
User avatar
Ragdag
Posts: 152
Joined: Friday 30 March 2018 13:56
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Read Dell iDRAC values through Redfish

Post by Ragdag »

I switched my sensor from Usage (Electric) to Electric (Usage+counter) because I also wanted to get an report in Domoticz.
To update that counter I changed the script to with the help of https://www.domoticz.com/wiki/DzVents:_ ... counter.29

Code: Select all

return {
	on = {
		timer = {
			'every 1 minutes' -- just an example to trigger the request
		},
		httpResponses = {
			'iDRACPower' -- must match with the callback passed to the openURL command
		}
	},
	execute = function(domoticz, item)

		if (item.isTimer) then
			domoticz.openURL({
				url = 'https://root:[email protected]/redfish/v1/Chassis/System.Embedded.1/Power/PowerControl',
				method = 'GET',
				callback = 'iDRACPower', -- see httpResponses above.
			})
		end

		if (item.isHTTPResponse) then

			if (item.ok) then
				if (item.isJSON) then

					local ServerPower = item.json.PowerConsumedWatts

					-- update some device in Domoticz
					domoticz.devices(271).updateElectricity(ServerPower)
			    end
			else
				domoticz.log('There was a problem handling the request', domoticz.LOG_ERROR)
				domoticz.log(item, domoticz.LOG_ERROR)
			end

		end

	end
}
This works but it is only showing Power Usage and Energy Usage stays empty.
Image
How do I get that calculated?

EDIT:
Think I figured it out With the help of this thread https://www.domoticz.com/forum/viewtopic.php?t=31396
Changed my script as follows:

Code: Select all

return {
	on = {
		timer = {
			'every 1 minutes' -- just an example to trigger the request
		},
		httpResponses = {
			'iDRACPower' -- must match with the callback passed to the openURL command
		}
	},
	
    logging = 
    {
        level = domoticz.LOG_DEBUG, -- for debugging
        --level = domoticz.LOG_INFO,
        marker = "Server Power Usage"
    },

	execute = function(domoticz, item)

		if (item.isTimer) then
			domoticz.openURL({
				url = 'https://root:[email protected]/redfish/v1/Chassis/System.Embedded.1/Power/PowerControl',
				method = 'GET',
				callback = 'iDRACPower', -- see httpResponses above.
			})
		end

		if (item.isHTTPResponse) then

			if (item.ok) then
				if (item.isJSON) then

					local ServerPowerConsumedWatts = item.json.PowerConsumedWatts

					-- update some device in Domoticz
					local ServerUsage = domoticz.devices(271)
					local ServerUsageTotal = ServerUsage.WhTotal + ServerPowerConsumedWatts / 60
					ServerUsage.updateElectricity(ServerPowerConsumedWatts, ServerUsageTotal)
                    domoticz.log ('WpPower = '  ..  ServerPowerConsumedWatts)
                    domoticz.log ('newTotal = '  ..  ServerUsageTotal)

			    end
			else
				domoticz.log('There was a problem handling the request', domoticz.LOG_ERROR)
				domoticz.log(item, domoticz.LOG_ERROR)
			end

		end

	end
}
I can now see that it is writing values, will see how it looks after an hour or so.
User avatar
Ragdag
Posts: 152
Joined: Friday 30 March 2018 13:56
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Read Dell iDRAC values through Redfish

Post by Ragdag »

Unfortunately after a restart of the server the Temperatures array in the json has a different order.

So this code is now writing the wrong temps in the wrong sensors.

Code: Select all

local scriptVar = 'iDRAC_Temp'

return 
{
	on = 
	{
	    timer = 
	    {
		    'every 5 minutes' -- just an example to trigger the request
	    },
	    httpResponses = 
        {
            scriptVar, -- must match with the callback passed to the openURL command
	    },
	},

    logging = 
    {
        --level = domoticz.LOG_DEBUG,
        marker = scriptVar,
    },

	execute = function(domoticz, item)

		if (item.isTimer) then
			domoticz.openURL({
				url = 'https://root:[email protected]/redfish/v1/Chassis/System.Embedded.1/Thermal',
				method = 'GET',
				callback = scriptVar, -- see httpResponses above.
			})
		end

		if (item.isHTTPResponse) then

			if (item.ok) then
				if (item.isJSON) then

					local inletTemp = item.json.Temperatures[1].ReadingCelsius
					local ExhaustTemp = item.json.Temperatures[2].ReadingCelsius
					
					domoticz.log('Inlet: ' .. inletTemp, domoticz.LOG_DEBUG)
					domoticz.log('Exhaust: ' .. ExhaustTemp, domoticz.LOG_DEBUG)
					
                    if (domoticz.devices(268).updateTemperature(inletTemp) == 0.0 ) then
                        domoticz.log('There was a problem getting an 0.0 reading for Inlet', domoticz.LOG_ERROR)
                    else
    					-- update some device in Domoticz
	    				domoticz.devices(268).updateTemperature(inletTemp)
		    		end

                    if (domoticz.devices(269).updateTemperature(ExhaustTemp) == 0.0 ) then
                        domoticz.log('There was a problem getting an 0.0 reading for Exhaust', domoticz.LOG_ERROR)
                    else
    					-- update some device in Domoticz
		    			domoticz.devices(269).updateTemperature(ExhaustTemp)
		    		end
			   	end
			else
				domoticz.log('There was a problem handling the request', domoticz.LOG_ERROR)
				domoticz.log(item, domoticz.LOG_ERROR)
			end

		end

	end
}
Is there a way for me to loop through the array and pick a value if the name is correct?

This is the json part for the temps

Code: Select all

    "Temperatures": [
        {
            "@odata.context": "/redfish/v1/$metadata#Thermal.Thermal",
            "@odata.id": "/redfish/v1/Chassis/System.Embedded.1/Sensors/Temperatures/iDRAC.Embedded.1%23SystemBoardExhaustTemp",
            "@odata.type": "#Thermal.v1_4_0.Temperature",
            "LowerThresholdCritical": 0,
            "LowerThresholdFatal": 0,
            "LowerThresholdNonCritical": 0,
            "MaxReadingRangeTemp": 75,
            "MemberId": "iDRAC.Embedded.1#SystemBoardExhaustTemp",
            "MinReadingRangeTemp": 0,
            "Name": "System Board Exhaust Temp",
            "PhysicalContext": "SystemBoard",
            "ReadingCelsius": 36,
            "RelatedItem": [
                {
                    "@odata.id": "/redfish/v1/Chassis/System.Embedded.1"
                }
            ],
            "[email protected]": 1,
            "SensorNumber": 1,
            "Status": {
                "Health": "OK",
                "State": "Enabled"
            },
            "UpperThresholdCritical": 75,
            "UpperThresholdFatal": 75,
            "UpperThresholdNonCritical": 70
        },
        {
            "@odata.context": "/redfish/v1/$metadata#Thermal.Thermal",
            "@odata.id": "/redfish/v1/Chassis/System.Embedded.1/Sensors/Temperatures/iDRAC.Embedded.1%23CPU1Temp",
            "@odata.type": "#Thermal.v1_4_0.Temperature",
            "LowerThresholdCritical": 3,
            "LowerThresholdFatal": 3,
            "LowerThresholdNonCritical": 8,
            "MaxReadingRangeTemp": 87,
            "MemberId": "iDRAC.Embedded.1#CPU1Temp",
            "MinReadingRangeTemp": 3,
            "Name": "CPU1 Temp",
            "PhysicalContext": "CPU",
            "ReadingCelsius": 63,
            "RelatedItem": [
                {
                    "@odata.id": "/redfish/v1/Systems/System.Embedded.1/Processors/CPU.Socket.1"
                }
            ],
            "[email protected]": 1,
            "SensorNumber": 14,
            "Status": {
                "Health": "OK",
                "State": "Enabled"
            },
            "UpperThresholdCritical": 87,
            "UpperThresholdFatal": 87,
            "UpperThresholdNonCritical": 82
        },
        {
            "@odata.context": "/redfish/v1/$metadata#Thermal.Thermal",
            "@odata.id": "/redfish/v1/Chassis/System.Embedded.1/Sensors/Temperatures/iDRAC.Embedded.1%23SystemBoardInletTemp",
            "@odata.type": "#Thermal.v1_4_0.Temperature",
            "LowerThresholdCritical": -7,
            "LowerThresholdFatal": -7,
            "LowerThresholdNonCritical": 3,
            "MaxReadingRangeTemp": 47,
            "MemberId": "iDRAC.Embedded.1#SystemBoardInletTemp",
            "MinReadingRangeTemp": -7,
            "Name": "System Board Inlet Temp",
            "PhysicalContext": "SystemBoard",
            "ReadingCelsius": 19,
            "RelatedItem": [
                {
                    "@odata.id": "/redfish/v1/Chassis/System.Embedded.1"
                }
            ],
            "[email protected]": 1,
            "SensorNumber": 4,
            "Status": {
                "Health": "OK",
                "State": "Enabled"
            },
            "UpperThresholdCritical": 47,
            "UpperThresholdFatal": 47,
            "UpperThresholdNonCritical": 42
        }
    ],
    "[email protected]": 3
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest