Is there away to retrieve my settings when the plugin loads without creating Protected Overloads Sub LoadSettingsFromIni() ? The settings page reads in the values fine, but how do I access them in my plugin?
Announcement
Collapse
No announcement yet.
Retrieving Settings from INI file
Collapse
X
-
Retrieving Settings from INI file
-Larry
A member of "The HA Pioneer Group", MyWebSite
Plugins:
VWS, AB8SS, lrpSpeak, Calendar, Arduino, Harmony, BlueIris, Sprinklers, ZipBackup...
Hardware:
Intel NUC8i7BEH1 running Windows 10 Pro headless, HS3 Pro, Plex running on Synology dual High Availability DS-1815+ NAS (24Tb each), Synology Surveillance Station running on DS-416 Slim (8Tb), Samsung SmartThings, Google Home, Alexa, Hubitat Elevation, ZNET, Ubiquiti UniFi Network, Davis Vantage Pro II Weather Station. Whole house speaker system using a couple of AB8SS switches. Vantage Pro II Weather Station, Rain8Net Sprinklers, Hubitat Elevation, Google Home, Alexa, DSC Security System, Ubiquiti UniFi Network.Tags: None
- Likes 1
-
duh, I should have figured that one out...I guess I'm a little frazzled trying to get this plugin done.-Larry
A member of "The HA Pioneer Group", MyWebSite
Plugins:
VWS, AB8SS, lrpSpeak, Calendar, Arduino, Harmony, BlueIris, Sprinklers, ZipBackup...
Hardware:
Intel NUC8i7BEH1 running Windows 10 Pro headless, HS3 Pro, Plex running on Synology dual High Availability DS-1815+ NAS (24Tb each), Synology Surveillance Station running on DS-416 Slim (8Tb), Samsung SmartThings, Google Home, Alexa, Hubitat Elevation, ZNET, Ubiquiti UniFi Network, Davis Vantage Pro II Weather Station. Whole house speaker system using a couple of AB8SS switches. Vantage Pro II Weather Station, Rain8Net Sprinklers, Hubitat Elevation, Google Home, Alexa, DSC Security System, Ubiquiti UniFi Network.
Comment
-
do you guys trusts the hs3/4 built-in ini routines? i gave up on them in HS3, and implemented a third party ini class. My HS3 ini file kept getting truncated/corrupted when hs3 crashed or was shutdown in correctlyMark
HS3 Pro 4.2.19.5
Hardware: Insteon Serial PLM | AD2USB for Vista Alarm | HAI Omnistat2 | 1-Wire HA7E | RFXrec433 | Dahua Cameras | LiftMaster Internet Gateway | Tuya Smart Plugs
Plugins: Insteon (mine) | Vista Alarm (mine) | Omnistat 3 | Ultra1Wire3 | RFXCOM | HS MyQ | BLRadar | BLDenon | Tuya | Jon00 Charting | Jon00 Links
Platform: Windows Server 2022 Standard, i5-12600K/3.7GHz/10 core, 16GB RAM, 500GB SSD
Comment
-
Originally posted by mnsandler View Postdo you guys trusts the hs3/4 built-in ini routines? i gave up on them in HS3, and implemented a third party ini class. My HS3 ini file kept getting truncated/corrupted when hs3 crashed or was shutdown in correctlyHS4Pro on a Raspberry Pi4
54 Z-Wave Nodes / 21 Zigbee Devices / 108 Events / 767 Devices
Plugins: Z-Wave / Zigbee Plus / EasyTrigger / AK Weather / OMNI
HSTouch Clients: 1 Android
Comment
-
Originally posted by mnsandler View Postdo you guys trusts the hs3/4 built-in ini routines? i gave up on them in HS3, and implemented a third party ini class. My HS3 ini file kept getting truncated/corrupted when hs3 crashed or was shutdown in correctly
Comment
-
Originally posted by mnsandler View Postdo you guys trusts the hs3/4 built-in ini routines? i gave up on them in HS3, and implemented a third party ini class. My HS3 ini file kept getting truncated/corrupted when hs3 crashed or was shutdown in correctly-Larry
A member of "The HA Pioneer Group", MyWebSite
Plugins:
VWS, AB8SS, lrpSpeak, Calendar, Arduino, Harmony, BlueIris, Sprinklers, ZipBackup...
Hardware:
Intel NUC8i7BEH1 running Windows 10 Pro headless, HS3 Pro, Plex running on Synology dual High Availability DS-1815+ NAS (24Tb each), Synology Surveillance Station running on DS-416 Slim (8Tb), Samsung SmartThings, Google Home, Alexa, Hubitat Elevation, ZNET, Ubiquiti UniFi Network, Davis Vantage Pro II Weather Station. Whole house speaker system using a couple of AB8SS switches. Vantage Pro II Weather Station, Rain8Net Sprinklers, Hubitat Elevation, Google Home, Alexa, DSC Security System, Ubiquiti UniFi Network.
Comment
-
Originally posted by dcorsus View PostUse HomeseerSystem.GetIniSetting
The section is “Settings” but you can see that if you open the ini file
2.) But the settings page doesn't read anything in except toggles, and seems to ignore my text input.
3.) The settings page does save any changes I make to the correct pluginname.ini file, but on startup it only reads the toggles???
So I still am forced to use my routine to retrieve the data reliably.-Larry
A member of "The HA Pioneer Group", MyWebSite
Plugins:
VWS, AB8SS, lrpSpeak, Calendar, Arduino, Harmony, BlueIris, Sprinklers, ZipBackup...
Hardware:
Intel NUC8i7BEH1 running Windows 10 Pro headless, HS3 Pro, Plex running on Synology dual High Availability DS-1815+ NAS (24Tb each), Synology Surveillance Station running on DS-416 Slim (8Tb), Samsung SmartThings, Google Home, Alexa, Hubitat Elevation, ZNET, Ubiquiti UniFi Network, Davis Vantage Pro II Weather Station. Whole house speaker system using a couple of AB8SS switches. Vantage Pro II Weather Station, Rain8Net Sprinklers, Hubitat Elevation, Google Home, Alexa, DSC Security System, Ubiquiti UniFi Network.
Comment
-
Originally posted by lpitman View Post
1.) GetIniSetting works great to retrieve settings for my subs/functions.
2.) But the settings page doesn't read anything in except toggles, and seems to ignore my text input.
3.) The settings page does save any changes I make to the correct pluginname.ini file, but on startup it only reads the toggles???
So I still am forced to use my routine to retrieve the data reliably.
withToggle
withInput
withDropDownSelect
.....
Seems to work for me but text is simple not chapters long with potential conflict in characters like "=" or crlf
Comment
-
Originally posted by rmasonjr View PostI am writing a new plugin that will 'cache' the INI settings instead of reading them for every device event. I've even thought about a built-in timer to get any new settings every 'x' minutes or so.
Code:public bool use_status_device { get { if(_use_status_device == null) _use_status_device = GetPED<bool>(Utils.FuncName()); return (bool)_use_status_device; } set { _use_status_device = value; SavePED(Utils.FuncName(), _use_status_device); } } bool? _use_status_device;
Comment
-
Originally posted by dcorsus View Post
I store booleans, text and integers as part of the settings page. They do require use of different kind of:
withToggle
withInput
withDropDownSelect
.....
Seems to work for me but text is simple not chapters long with potential conflict in characters like "=" or crlf
'Add a TEXT INPUTVIEW to the page
settingsPage.WithInput(Constants.Settings.FourthAnnounceId, Constants.Settings.FourthAnnounceName, HomeSeer.Jui.Types.EInputType.Text)
'---------------------------------------------------------------------------------------------------------
'Add a TEXT INPUTVIEW to the page
settingsPage.WithInput(Constants.Settings.FromEmailId, Constants.Settings.FromEmailName, HomeSeer.Jui.Types.EInputType.Email)
'---------------------------------------------------------------------------------------------------------
'Add a TEXT INPUTVIEW to the page
settingsPage.WithInput(Constants.Settings.EmailServerId, Constants.Settings.EmailServerName, HomeSeer.Jui.Types.EInputType.Text)
'---------------------------------------------------------------------------------------------------------
'Add a TEXT INPUTVIEW to the page
settingsPage.WithInput(Constants.Settings.EmailPasswordId, Constants.Settings.EmailPasswordName, HomeSeer.Jui.Types.EInputType.Password)
'Add the page to the list of plugin settings pages
Settings.Add(settingsPage.Page)
-Larry
A member of "The HA Pioneer Group", MyWebSite
Plugins:
VWS, AB8SS, lrpSpeak, Calendar, Arduino, Harmony, BlueIris, Sprinklers, ZipBackup...
Hardware:
Intel NUC8i7BEH1 running Windows 10 Pro headless, HS3 Pro, Plex running on Synology dual High Availability DS-1815+ NAS (24Tb each), Synology Surveillance Station running on DS-416 Slim (8Tb), Samsung SmartThings, Google Home, Alexa, Hubitat Elevation, ZNET, Ubiquiti UniFi Network, Davis Vantage Pro II Weather Station. Whole house speaker system using a couple of AB8SS switches. Vantage Pro II Weather Station, Rain8Net Sprinklers, Hubitat Elevation, Google Home, Alexa, DSC Security System, Ubiquiti UniFi Network.
Comment
-
Originally posted by lpitman View Post
Thats the same as I'm using?
HTML Code:settingsPage1.WithDropDownSelectList(Constants.Settings.Sp1DebugLevelOptionsId, Constants.Settings.Sp1DebugLevelOptionsName, Constants.Settings.Sp1DebugLevelOptions, DebugLevel.dlErrorsOnly) settingsPage1.WithDropDownSelectList(Constants.Settings.Sp1UPNPDebugLevelOptionsId, Constants.Settings.Sp1UPNPDebugLevelOptionsName, Constants.Settings.Sp1UPNPDebugLevelOptions, DebugLevel.dlErrorsOnly) settingsPage1.WithToggle(Constants.Settings.Sp1DebugToggleLogtoDiskToggleId, Constants.Settings.Sp1LogtoDiskToggleName) 'Add the Music DB Setting Label to the page settingsPage1.WithLabel(Constants.Settings.Sp1MusicDBLabelId, Nothing, Constants.Settings.Sp1MusicDBLabelValue) settingsPage1.WithToggle(Constants.Settings.Sp1AutoUpdateFlagId, Constants.Settings.Sp1AutoUpdateFlagName, True) settingsPage1.WithToggle(Constants.Settings.Sp1ImmediateUpdateFlagId, Constants.Settings.Sp1ImmediateUpdateFlagName, False) settingsPage1.WithToggle(Constants.Settings.Sp1LearnRadioStationsFlagId, Constants.Settings.Sp1LearnRadioStationsFlagName, True) settingsPage1.WithInput(Constants.Settings.Sp1AutoUpdateTimeId, Constants.Settings.Sp1AutoUpdateTimeInputBoxName, "02:10")
Comment
-
Settings Page does save settings in INI file, but does not load them on startup. I have to toggle off then toggle on things like Debug Checkbox and other configuration items.-Larry
A member of "The HA Pioneer Group", MyWebSite
Plugins:
VWS, AB8SS, lrpSpeak, Calendar, Arduino, Harmony, BlueIris, Sprinklers, ZipBackup...
Hardware:
Intel NUC8i7BEH1 running Windows 10 Pro headless, HS3 Pro, Plex running on Synology dual High Availability DS-1815+ NAS (24Tb each), Synology Surveillance Station running on DS-416 Slim (8Tb), Samsung SmartThings, Google Home, Alexa, Hubitat Elevation, ZNET, Ubiquiti UniFi Network, Davis Vantage Pro II Weather Station. Whole house speaker system using a couple of AB8SS switches. Vantage Pro II Weather Station, Rain8Net Sprinklers, Hubitat Elevation, Google Home, Alexa, DSC Security System, Ubiquiti UniFi Network.
Comment
-
During initialization I load my settings into local variables
Code:public void Load() { Location = _hs.GetINISetting("Settings", "Location", "Hubitat", Utils.IniFile);//I Like it When I can Set a Default location myself Location2 = _hs.GetINISetting("Settings", "Location2", "Hubitat", Utils.IniFile); DebugLog = bool.Parse(_hs.GetINISetting("Settings", "DebugLog", "false", Utils.IniFile)); MakerURI = _hs.GetINISetting("Settings", "MakerURI", "", Utils.IniFile); }
Code:private void InitializeSettingsPages() { //Start a PageFactory to construct the Page var settingsPage1 = PageFactory.CreateSettingsPage("idConfig", "Config"); //Add a LabelView to the page settingsPage1.WithLabel("idlblMakerAPIURL", null, "Hubitat Maker API URL:"); //"Config"); //Add a text InputView for the Maker API text settingsPage1.WithInput("idtxtMakerAPIURL", "MakerAPI URL", _settings.MakerURI, HomeSeer.Jui.Types.EInputType.Text); settingsPage1.WithInput("idtxtLocation", "Floor (Location2)", _settings.Location2, HomeSeer.Jui.Types.EInputType.Text); settingsPage1.WithInput("idtxtLocation2", "Room (Location)", _settings.Location, HomeSeer.Jui.Types.EInputType.Text); //Add a checkbox to the page for Debug settingsPage1.WithCheckBox("idchkDebug", "Debug", _settings.DebugLog); //Add the first page to the list of plugin settings pages HomeSeer.Jui.Views.SettingsCollection. Settings.Add(settingsPage1.Page); }
Code:protected override bool OnSettingChange(string pageId, AbstractView currentView, AbstractView changedView) { Console.WriteLine("OnSettingChange"); if (changedView.Id == "idtxtMakerAPIURL") _settings.MakerURI = changedView.GetStringValue(); else if (changedView.Id == "idtxtLocation") _settings.Location = changedView.GetStringValue(); if (changedView.Id == "idtxtLocation2") _settings.Location2 = changedView.GetStringValue(); else if (changedView.Id == "idchkDebug") _settings.DebugLog = (changedView.GetStringValue() == "True"); return true; }
Comment
Comment