megakid/ha_octopus_intelligent

Automation Service Call

Closed this issue ยท 3 comments

Executing the select_option service to set the target ready time does not work for half past the hour settings.

My test code looks like this...

service: select.select_option
data:
  option: "08:30"
target:
  entity_id: select.octopus_target_ready_by_time

Automation runs but the time is set to 08:00 instead.

Exactly the same code works if setting "09:00" for example. Feels like it is ignoring the :30 part.

I've also used the UI device select option and it produces the same result...

device_id: 939174e695844fa490d21e99d7d1dfd6
domain: select
entity_id: select.octopus_target_ready_by_time
type: select_option
option: "08:30"

Happens for me too! :)

Think I've got it. ๐Ÿ˜„

Line 138 int graphql_client.py.

Currently:

readyByHoursAfterMidnightMinutes = round(30 * (readyByHoursAfterMidnight % 0.5))

I think it should be:

readyByHoursAfterMidnightMinutes = round(60 * (readyByHoursAfterMidnight % 1))

I've swapped that in, and now I can set Ready By Time with to the hour or half-hour.

Please validate my logic before applying! ๐Ÿ˜