mvermand
(Michiel Vermandel)
January 20, 2025, 1:15pm
1
I am trying to build a minimalistic Temperature Sensor driver for an Espressif esp32-h2 Zigbee device.
I created a fingerprints.yml, config.yml and src\init.lua and then ran
“smartthings edge:drivers:package” in the root folder.
This gives:
C:\data\my-projects\airco-zigbee\smartThings-edge-driver-temp-sensor>smartthings edge:drivers:package
AxiosError: Request failed with status code 500:
{"requestId":"4285812926139369725","error":{"code":"UnexpectedError","message":"unsuccessful-http-call status=500","details":[]}}
Code: ERR_BAD_RESPONSE
I don’t know what could cause this.
Any ideas?
Can I enable some more verbose logging?
These are the files:
fingerprints.yml:
zigbeeManufacturer:
- id: "Espressif/esp32-h2-temp-sensor"
deviceLabel: Espressif Temperature Sensor
manufacturer: Espressif
model: ZigbeeTempSensor
deviceProfileName: humidity-temperature
zigbeeGeneric:
- id: "esp32-h2-temp-sensor"
deviceLabel: "Esp32-h2 Temperature Sensor"
zigbeeProfiles:
- 0x0104 # Zigbee HA
clusters:
server:
- 0x0402 # TemperatureMeasurement
- 0x0405 # Relative Humidity Measurement Cluster
deviceProfileName: humidity-temperature
config.yml:
name: 'Espressif Temperature Sensor'
defaultProfile: 'humidity-temperature'
packageKey: 'com.espressif.esp32-h2.temp-sensor'
permissions:
zigbee: {}
description: "Espressif Temperature Sensor"
vendorSupportInformation: "https://www.espressif.com/"
src/init.lua:
local capabilities = require "st.capabilities"
local ZigbeeDriver = require "st.zigbee"
local defaults = require "st.zigbee.defaults"
local TemperatureMeasurement = (require "st.zigbee.zcl.clusters").TemperatureMeasurement
local zigbee_temperature_driver = {
supported_capabilities = {
capabilities.relativeHumidityMeasurement,
capabilities.temperatureMeasurement
}
}
defaults.register_for_default_handlers(zigbee_temperature_driver, zigbee_temperature_driver.supported_capabilities)
local driver = ZigbeeDriver("zigbee-humidity-sensor", zigbee_humidity_driver)
driver:run()
I also have an empty “profiles” folder because that folder is required by “smartthings edge:drivers:package”.
Have you tried it with a profile? It should be just a couple of lines with a temperature sensor anyway.
You can check if it even builds by going to the parent directory and executing this:
smartthings edge:drivers:package -b driver.zip smartThings-edge-driver-temp-sensor
mvermand
(Michiel Vermandel)
January 20, 2025, 2:38pm
3
Thanks @Andreas_Roedl ,
This command works fine, I get a driver.zip.
The zip does not contain a profiles folder anymore though.
What does this mean in the light of the “unsuccessful-http-call status=500” error?
Can I use the driver.zip instead of the other command and upload that zip file?
Is there a reason why you don’t want a profile? This would be a minimalistic profile:
name: humidity-temperature
components:
- id: main
capabilities:
- id: temperatureMeasurement
version: 1
- id: relativeHumidityMeasurement
version: 1
Makes sense, especially when you define one in your fingerprints.
1 Like
And this doesn’t seem correct to me in your init.lua:
... zigbee_humidity_driver ...
Edit: I know that some developers are too vain to use AI. BS in my opinion. I sometimes use it like a peer programming partner and it’s awesome :
1 Like
You get the unsuccessful-http-call error if you don’t have a profile file in the profiles
folder.
I believe you actually need to define the humidity-temperature
profile in your profiles
folder given that you are using it in the fingerprints. The way that the profiles you define in the driver package are converted/mapped to real device profiles is not documented, but I’m pretty sure that the ones you access by name within the context of the driver have to be in your profiles
folder.
1 Like
mvermand
(Michiel Vermandel)
January 20, 2025, 4:49pm
7
Adding the profile was the solution, but indeed this was an error as well.
I first added the profile file and after that building went without an error, although the code in the init.lua file was faulty. That is thus not checked during build.
Good to know!
Thanks for both replies!!
1 Like
mvermand
(Michiel Vermandel)
January 20, 2025, 4:55pm
8
Thanks @orangebucket , indeed I needed to include a profile file.
Bit of a cryptic error message if you ask me
Looks rather like they haven’t allowed for the possibility and the code has crashed out. It happens rather more than I would have expected with the API.
1 Like