I have created a Domoticz plugin for Homeremote with Chat GPT. Would anyone like to test it?
In the plugin settings you can set the local IP, port and polling interval time.
The plugin then retrieves all available devices from the Domoticz gateway and generates all devices with their names. Each device contains the device ID (IDX) and attributes from Domoticz.
This plugin can be used, for example, to make sensor temperatures, battery levels, switching statuses etc. available and displayed in HomeRemote.
In HomeRemote Designer do a right click on “Devices” → “Add Plugin” → “Import From Code” → copy and paste the code.
// Domoticz Plugin für HomeRemote V 1.0
// Temperaturdaten, Batteriestatus, Luftfeuchtigkeit, On/Off-Status, Lux etc. abrufen
// Entwickelt von Kalle mit "Bing Copilot"
plugin.Name = "Domoticz";
plugin.OnChangeRequest = onChangeRequest;
plugin.OnConnect = onConnect;
plugin.OnDisconnect = onDisconnect;
plugin.OnPoll = onPoll;
plugin.OnSynchronizeDevices = onSynchronizeDevices;
plugin.DefaultSettings = {
"IpAddress": "192.168.68.116",
"Port": "9595",
"PollingInterval": "15000"
};
var http = new HTTPClient();
function onChangeRequest(device, attribute, value) {
// Hier können Sie Code hinzufügen, um auf Änderungsanforderungen zu reagieren
}
function onConnect() {
plugin.PollingInterval = parseInt(plugin.Settings["PollingInterval"], 10);
}
function onDisconnect() {
// Hier können Sie Code hinzufügen, um auf Trennungsereignisse zu reagieren
}
function onPoll() {
var ipAddress = plugin.Settings["IpAddress"];
var port = plugin.Settings["Port"];
for (var id in plugin.Devices) {
var deviceId = plugin.Devices[id].Id;
var response = http.get("http://" + ipAddress + ":" + port + "/json.htm?type=devices&rid=" + deviceId);
if(response.status == 200) {
var data;
if(typeof response.data === 'object') {
data = response.data;
} else {
data = JSON.parse(response.data);
}
var device = plugin.Devices[id];
device.Temperature = data.result[0].Temp;
device.BatteryLevel = data.result[0].BatteryLevel;
device.Humidity = data.result[0].Humidity;
device.Status = data.result[0].Status;
device.Lux = data.result[0].Lux;
// Hier können Sie die Werte für die zusätzlichen Attribute setzen
device.AddjMulti = data.result[0].AddjMulti;
device.AddjMulti2 = data.result[0].AddjMulti2;
device.AddjValue = data.result[0].AddjValue;
device.AddjValue2 = data.result[0].AddjValue2;
device.CustomImage = data.result[0].CustomImage;
device.Data = data.result[0].Data;
device.Description = data.result[0].Description;
device.DewPoint = data.result[0].DewPoint;
device.Favorite = data.result[0].Favorite;
device.HardwareDisabled = data.result[0].HardwareDisabled;
device.HardwareID = data.result[0].HardwareID;
device.HardwareName = data.result[0].HardwareName;
device.HardwareType = data.result[0].HardwareType;
device.HardwareTypeVal = data.result[0].HardwareTypeVal;
device.HaveTimeout = data.result[0].HaveTimeout;
device.HumidityStatus = data.result[0].HumidityStatus;
device.ID = data.result[0].ID;
device.LastUpdate = data.result[0].LastUpdate;
device.Notifications = data.result[0].Notifications;
device.PlanID = data.result[0].PlanID;
device.PlanIDs = data.result[0].PlanIDs;
device.Protected = data.result[0].Protected;
device.ShowNotifications = data.result[0].ShowNotifications;
device.SignalLevel = data.result[0].SignalLevel;
device.SubType = data.result[0].SubType;
device.Timers = data.result[0].Timers;
device.Type = data.result[0].Type;
device.TypeImg = data.result[0].TypeImg;
device.Unit = data.result[0].Unit;
device.Used = data.result[0].Used;
device.XOffset = data.result[0].XOffset;
device.YOffset = data.result[0].YOffset;
device.idx = data.result[0].idx;
device.trend = data.result[0].trend;
}
}
}
function onSynchronizeDevices() {
var ipAddress = plugin.Settings["IpAddress"];
var port = plugin.Settings["Port"];
var response = http.get("http://" + ipAddress + ":" + port + "/json.htm?type=devices&used=true&displayhidden=1");
if(response.status == 200) {
var data;
if(typeof response.data === 'object') {
data = response.data;
} else {
data = JSON.parse(response.data);
}
for (var i = 0; i < data.result.length; i++) {
var deviceData = data.result[i];
var domoDevice = new Device();
domoDevice.Id = deviceData.idx;
domoDevice.DisplayName = deviceData.Name;
domoDevice.Capabilities = [];
domoDevice.Attributes = [
"Temperature",
"BatteryLevel",
"Humidity",
"Status",
"Lux",
"AddjMulti",
"AddjMulti2",
"AddjValue",
"AddjValue2",
"CustomImage",
"Data",
"Description",
"DewPoint",
"Favorite",
"HardwareDisabled",
"HardwareID",
"HardwareName",
"HardwareType",
"HardwareTypeVal",
"HaveTimeout",
"HumidityStatus",
"ID",
"LastUpdate",
"Notifications",
"PlanID",
"PlanIDs",
"Protected",
"ShowNotifications",
"SignalLevel",
"SubType",
"Timers",
"Type",
"TypeImg",
"Unit",
"Used",
"XOffset",
"YOffset",
"idx",
"trend"
];
plugin.Devices[domoDevice.Id] = domoDevice;
}
}
}