@@ -118,6 +118,7 @@ def setup(hass: HomeAssistant, config: ConfigType) -> bool:
118118
119119 stick = DuofernStickThreaded (serial_port = serial_port , system_code = code , config_file_json = configfile ,
120120 ephemeral = False )
121+ stick .updating_interval = 5 * 60
121122
122123 _registerServices (hass , stick , configEntries [0 ])
123124 _registerUpdateHassFromStickCallback (hass , stick )
@@ -149,7 +150,7 @@ def _registerUpdateHassFromStickCallback(hass: HomeAssistant, stick: DuofernStic
149150 def update_callback (id : str | None , key : Any , value : Any ) -> None :
150151 if id is not None :
151152 try :
152- _LOGGER .info (f"Updatecallback for { id } " )
153+ _LOGGER .debug (f"Updatecallback for { id } : { key } : { value } " )
153154 device = hass .data [DOMAIN ]['devices' ][id ] # Get device by id
154155 if device .enabled :
155156 try :
@@ -196,7 +197,8 @@ def get_device_id(hass_entity_id):
196197 hass_device_id = call .data .get ('device_id' , None )
197198 if get_all :
198199 _LOGGER .info ("Asking all devices for update" )
199- device_ids = hass .data [DOMAIN ]['stick' ].duofern_parser .modules ['by_code' ].keys ()
200+ hass .data [DOMAIN ]['stick' ].status_request ()
201+ return
200202 else :
201203 _LOGGER .info ("Asking specific devices for update" )
202204 device_ids = [get_device_id (i ) for i in hass_device_id ]
@@ -224,13 +226,13 @@ def get_device_id(hass_entity_id):
224226 def set_update_interval (call : ServiceCall ) -> None :
225227 try :
226228 period_minutes = call .data .get ('period_minutes' , None )
227- if period_minutes == int ( 0 ) :
229+ if period_minutes == 0 :
228230 period_minutes = None
229231 _LOGGER .warning ("set period_minutes to 0 - no updates will be triggered automatically" )
230232 except Exception :
231233 _LOGGER .warning ("something went wrong while reading period from parameters" )
232234 return
233- getDuofernStick (hass ).updating_interval = period_minutes
235+ getDuofernStick (hass ).updating_interval = period_minutes * 60 if period_minutes is not None else None
234236
235237 PAIRING_SCHEMA = vol .Schema ({
236238 vol .Optional ('timeout' , default = 30 ): cv .positive_int ,
@@ -242,7 +244,7 @@ def set_update_interval(call: ServiceCall) -> None:
242244 })
243245
244246 UPDATE_INTERVAL_SCHEMA = vol .Schema ({
245- vol .Optional ('period_minutes' , default = 5 ): cv .positive_int ,
247+ vol .Optional ('period_minutes' , default = 5 ): cv .positive_float ,
246248 })
247249
248250 hass .services .register (DOMAIN , 'start_pairing' , start_pairing , PAIRING_SCHEMA )
0 commit comments