/// <summary> /// Gets the available Folders or Meters /// </summary> /// <param name="usernamePassword">The Username and Password for Basic Authentication</param> /// <param name="id">The ID of the Folder or Meter</param> /// <returns></returns> public static async Task <Folder> GetFolderAsync(UserPassword usernamePassword, Guid id) { using (var restApi = new SmartMeApiClient(usernamePassword)) { return(await restApi.GetAsync <Folder>("Folder/" + id)); } }
/// <summary> /// Gets the available Folders or Meters /// </summary> /// <param name="accessToken">The OAuth2 access token</param> /// <param name="id">The ID of the Folder or Meter</param> /// <returns></returns> public static async Task <Folder> GetFolderAsync(string accessToken, Guid id) { using (var restApi = new SmartMeApiClient(accessToken)) { return(await restApi.GetAsync <Folder>("Folder/" + id)); } }
/// <summary> /// Sets the Name of a Meter or a Folder /// </summary> /// <param name="usernamePassword">The Username and Password for Basic Authentication</param> /// <param name="meterFolderInformation">The Id of the meter or folder and the Name to be set</param> /// <returns></returns> public static async Task <bool> SetMeterFolderInformationAsync(UserPassword usernamePassword, MeterFolderInformationToSet meterFolderInformation) { using (var restApi = new SmartMeApiClient(usernamePassword)) { return(await restApi.PostAsync <MeterFolderInformationToSet>("MeterFolderInformation", meterFolderInformation)); } }
/// <summary> /// Sets the Name of a Meter or a Folder /// </summary> /// <param name="accessToken">The OAuth2 access token</param> /// <param name="meterFolderInformation">The Id of the meter or folder and the Name to be set</param> /// <returns></returns> public static async Task <bool> SetMeterFolderInformationAsync(string accessToken, MeterFolderInformationToSet meterFolderInformation) { using (var restApi = new SmartMeApiClient(accessToken)) { return(await restApi.PostAsync <MeterFolderInformationToSet>("MeterFolderInformation", meterFolderInformation)); } }
/// <summary> /// Gets all (last) values of a device /// </summary> /// <param name="accessToken">The OAuth2 access token</param> /// <param name="deviceId">The ID of the device</param> /// <returns></returns> public static async Task <DeviceValues> GetDeviceValuesAsync(string accessToken, Guid deviceId) { using (var restApi = new SmartMeApiClient(accessToken)) { return(await restApi.GetAsync <DeviceValues>("Values/" + deviceId)); } }
/// <summary> /// Gets the Information of a Folder or a Meter /// </summary> /// <param name="accessToken">The OAuth2 access token</param> /// <param name="id">The ID of the Folder or Meter</param> /// <returns></returns> public static async Task <MeterFolderInformation> GetMeterFolderInformationAsync(string accessToken, Guid id) { using (var restApi = new SmartMeApiClient(accessToken)) { return(await restApi.GetAsync <MeterFolderInformation>("MeterFolderInformation/" + id)); } }
/// <summary> /// Gets the informations of the user /// </summary> /// <param name="accessToken">The OAuth2 access token</param> /// <returns></returns> public static async Task <User> GetUserAsync(string accessToken) { using (var restApi = new SmartMeApiClient(accessToken)) { return(await restApi.GetAsync <User>("User")); } }
/// <summary> /// Gets all (last) values of a device /// </summary> /// <param name="usernamePassword">The Username and Password for Basic Authentication</param> /// <param name="deviceId">The ID of the device</param> /// <returns></returns> public static async Task <DeviceValues> GetDeviceValuesAsync(UserPassword usernamePassword, Guid deviceId) { using (var restApi = new SmartMeApiClient(usernamePassword)) { return(await restApi.GetAsync <DeviceValues>("Values/" + deviceId)); } }
/// <summary> /// M-BUS API: Adds data of a M-BUS Meter to the smart-me Cloud. /// Just send us the M-BUS Telegram (RSP_UD) and we will do the Rest. /// </summary> /// <param name="accessToken">The OAuth2 access token</param> /// <param name="mbusData">The M-BUS Telegram</param> /// <returns></returns> public static async Task <bool> SendTelegramAsync(string accessToken, MBusData mbusData) { using (var restApi = new SmartMeApiClient(accessToken)) { return(await restApi.PostAsync <MBusData>("MBus", mbusData)); } }
/// <summary> /// Gets the informations of the user /// </summary> /// <param name="usernamePassword">The Username and Password for Basic Authentication</param> /// <returns></returns> public static async Task <User> GetUserAsync(UserPassword usernamePassword) { using (var restApi = new SmartMeApiClient(usernamePassword)) { return(await restApi.GetAsync <User>("User")); } }
/// <summary> /// M-BUS API: Adds data of a M-BUS Meter to the smart-me Cloud. /// Just send us the M-BUS Telegram (RSP_UD) and we will do the Rest. /// </summary> /// <param name="usernamePassword">The Username and Password for Basic Authentication</param> /// <param name="mbusData">The M-BUS Telegram</param> /// <returns></returns> public static async Task <bool> SendTelegramAsync(UserPassword usernamePassword, MBusData mbusData) { using (var restApi = new SmartMeApiClient(usernamePassword)) { return(await restApi.PostAsync <MBusData>("MBus", mbusData)); } }
/// <summary> /// Runs an action for the specified device /// </summary> /// <param name="usernamePassword">The Username and Password for Basic Authentication</param> /// <param name="actionToRun">The Action Data</param> /// <returns></returns> public static async Task <bool> RunActionsAsync(UserPassword usernamePassword, Containers.ActionToRun actionToRun) { using (var restApi = new SmartMeApiClient(usernamePassword)) { return(await restApi.PostAsync <Containers.ActionToRun>("Actions", actionToRun)); } }
/// <summary> /// Gets all available Actions for a Device /// </summary> /// <param name="accessToken">The OAuth2 access token</param> /// <param name="deviceId">The ID of the device</param> /// <returns></returns> public static async Task <List <Containers.Action> > GetActionsAsync(string accessToken, Guid deviceId) { using (var restApi = new SmartMeApiClient(accessToken)) { return(await restApi.GetAsync <List <Containers.Action> >("Actions/" + deviceId)); } }
/// <summary> /// Gets all available Actions for a Device /// </summary> /// <param name="usernamePassword">The Username and Password for Basic Authentication</param> /// <param name="deviceId">The ID of the device</param> /// <returns></returns> public static async Task <List <Containers.Action> > GetActionsAsync(UserPassword usernamePassword, Guid deviceId) { using (var restApi = new SmartMeApiClient(usernamePassword)) { return(await restApi.GetAsync <List <Containers.Action> >("Actions/" + deviceId)); } }
/// <summary> /// Gets the Information of a Folder or a Meter /// </summary> /// <param name="usernamePassword">The Username and Password for Basic Authentication</param> /// <param name="id">The ID of the Folder or Meter</param> /// <returns></returns> public static async Task <MeterFolderInformation> GetMeterFolderInformationAsync(UserPassword usernamePassword, Guid id) { using (var restApi = new SmartMeApiClient(usernamePassword)) { return(await restApi.GetAsync <MeterFolderInformation>("MeterFolderInformation/" + id)); } }
/// <summary> /// Gets a Custom Device by it's ID /// </summary> /// <param name="accessToken">The OAuth2 access token</param> /// <param name="deviceId">The ID of the device</param> /// <returns></returns> public static async Task <CustomDevice> GetCustomDeviceAsync(string accessToken, Guid deviceId) { using (var restApi = new SmartMeApiClient(accessToken)) { return(await restApi.GetAsync <CustomDevice>("CustomDevice/" + deviceId)); } }
/// <summary> /// Runs an action for the specified device /// </summary> /// <param name="accessToken">The OAuth2 access token</param> /// <param name="actionToRun">The Action Data</param> /// <returns></returns> public static async Task <bool> RunActionsAsync(string accessToken, Containers.ActionToRun actionToRun) { using (var restApi = new SmartMeApiClient(accessToken)) { return(await restApi.PostAsync <Containers.ActionToRun>("Actions", actionToRun)); } }
/// <summary> /// Gets all Devices /// </summary> /// <param name="accessToken">The OAuth2 access token</param> /// <param name="resultHandler">The result handler</param> /// <returns></returns> public static async Task <IActionResult> GetDevicesAsync(string accessToken, ResultHandler <List <Device> > resultHandler) { using (var restApi = new SmartMeApiClient(accessToken)) { return(await restApi.GetAsync <List <Device> >("Devices", resultHandler)); } }
/// <summary> /// Gets a Custom Device by it's ID /// </summary> /// <param name="usernamePassword">The Username and Password for Basic Authentication</param> /// <param name="deviceId">The ID of the device</param> /// <returns></returns> public static async Task <CustomDevice> GetCustomDeviceAsync(UserPassword usernamePassword, Guid deviceId) { using (var restApi = new SmartMeApiClient(usernamePassword)) { return(await restApi.GetAsync <CustomDevice>("CustomDevice/" + deviceId)); } }
/// <summary> /// Gets all Custom Devices /// </summary> /// <param name="usernamePassword">The Username and Password for Basic Authentication</param> /// <returns></returns> public static async Task <List <CustomDevice> > GetCustomDevicesAsync(UserPassword usernamePassword) { using (var restApi = new SmartMeApiClient(usernamePassword)) { return(await restApi.GetAsync <List <CustomDevice> >("CustomDevice")); } }
/// <summary> /// Gets all Custom Devices /// </summary> /// <param name="accessToken">The OAuth2 access token</param> /// <returns></returns> public static async Task <List <CustomDevice> > GetCustomDevicesAsync(string accessToken) { using (var restApi = new SmartMeApiClient(accessToken)) { return(await restApi.GetAsync <List <CustomDevice> >("CustomDevice")); } }
/// <summary> /// Sets the configuration of a smart-me device. The device needs to be online. /// </summary> /// <param name="usernamePassword">The Username and Password for Basic Authentication</param> /// <param name="configuration">The smart-me device configuration</param> /// <returns></returns> public static async Task <bool> SetSmartMeDeviceConfigurationAsync(UserPassword usernamePassword, SmartMeDeviceConfiguration configuration) { using (var restApi = new SmartMeApiClient(usernamePassword)) { return(await restApi.PostAsync <SmartMeDeviceConfiguration>("SmartMeDeviceConfiguration", configuration)); } }
/// <summary> /// Sets the configuration of a smart-me device. The device needs to be online. /// </summary> /// <param name="accessToken">The OAuth2 access token</param> /// <param name="configuration">The smart-me device configuration</param> /// <returns></returns> public static async Task <bool> SetSmartMeDeviceConfigurationAsync(string accessToken, SmartMeDeviceConfiguration configuration) { using (var restApi = new SmartMeApiClient(accessToken)) { return(await restApi.PostAsync <SmartMeDeviceConfiguration>("SmartMeDeviceConfiguration", configuration)); } }
/// <summary> /// Gets the configuration of a smart-me device. /// </summary> /// <param name="usernamePassword">The Username and Password for Basic Authentication</param> /// <param name="deviceId">The ID of the device</param> /// <returns></returns> public static async Task <SmartMeDeviceConfiguration> GetSmartMeDeviceConfigurationAsync(UserPassword usernamePassword, Guid deviceId) { using (var restApi = new SmartMeApiClient(usernamePassword)) { return(await restApi.GetAsync <SmartMeDeviceConfiguration>("SmartMeDeviceConfiguration/" + deviceId)); } }
/// <summary> /// Gets the configuration of a smart-me device. /// </summary> /// <param name="accessToken">The OAuth2 access token</param> /// <param name="deviceId">The ID of the device</param> /// <returns></returns> public static async Task <SmartMeDeviceConfiguration> GetSmartMeDeviceConfigurationAsync(string accessToken, Guid deviceId) { using (var restApi = new SmartMeApiClient(accessToken)) { return(await restApi.GetAsync <SmartMeDeviceConfiguration>("SmartMeDeviceConfiguration/" + deviceId)); } }
/// <summary> /// Gets the additional information (e.g. Firmware Version) about a device. /// </summary> /// <param name="accessToken">The OAuth2 access token</param> /// <param name="deviceId">The ID of the device</param> /// <returns></returns> public static async Task <AdditionalDeviceInformation> GetAdditionalDeviceInformationAsync(string accessToken, Guid deviceId) { using (var restApi = new SmartMeApiClient(accessToken)) { return(await restApi.GetAsync <AdditionalDeviceInformation>("AdditionalDeviceInformation/" + deviceId)); } }
/// <summary> /// Gets the additional information (e.g. Firmware Version) about a device. /// </summary> /// <param name="usernamePassword">The Username and Password for Basic Authentication</param> /// <param name="deviceId">The ID of the device</param> /// <returns></returns> public static async Task <AdditionalDeviceInformation> GetAdditionalDeviceInformationAsync(UserPassword usernamePassword, Guid deviceId) { using (var restApi = new SmartMeApiClient(usernamePassword)) { return(await restApi.GetAsync <AdditionalDeviceInformation>("AdditionalDeviceInformation/" + deviceId)); } }
/// <summary> /// Gets all Devices by it's Sub Type (e.g. E-Charging Station) /// </summary> /// <param name="accessToken">The OAuth2 access token</param> /// <param name="meterSubType">The MeterSubType by which to filter</param> /// <returns></returns> public static async Task <List <Device> > GetDevicesAsync(string accessToken, MeterSubType meterSubType) { using (var restApi = new SmartMeApiClient(accessToken)) { return(await restApi.GetAsync <List <Device> >("DevicesBySubType", new Dictionary <string, object> { { "meterSubType", Enum.GetName(typeof(MeterSubType), meterSubType) } })); } }
/// <summary> /// Gets all Devices for an Energy Type /// </summary> /// <param name="usernamePassword">The Username and Password for Basic Authentication</param> /// <param name="meterEnergyType">The MeterEnergyType by which to filter</param> /// <returns></returns> public static async Task <List <Device> > GetDevicesAsync(UserPassword usernamePassword, MeterEnergyType meterEnergyType) { using (var restApi = new SmartMeApiClient(usernamePassword)) { return(await restApi.GetAsync <List <Device> >("DevicesByEnergy", new Dictionary <string, object> { { "meterEnergyType", Enum.GetName(typeof(MeterEnergyType), meterEnergyType) } })); } }
/// <summary> /// Gets a Device by it's Serial Number. The Serial is the part before the "-". /// </summary> /// <param name="accessToken">The OAuth2 access token</param> /// <param name="serial">The Serial Number of the device</param> /// <returns></returns> public static async Task <Device> GetDeviceAsync(string accessToken, Int64 serial) { using (var restApi = new SmartMeApiClient(accessToken)) { return(await restApi.GetAsync <Device>("DeviceBySerial", new Dictionary <string, object> { { "serial", serial } })); } }