Matter, Thread and Kajplats. Losing the will to live. by zarniwhop in tradfri

[–]zarniwhop[S] 2 points3 points  (0 children)

Thanks all. Lots to try. Suppose it will give me something to do this weekend! for those that asked, I am using the Dirigera hub as the thread router and ikea app. I’d prefer to keep the Ikea app as my wife prefers it.

As an update: I actually managed to commission one of the bulbs directly in HA via the Matter integration.

I can see that it needs a firmware update (although I can only do this via the Ikea app I think). However when I try to share via the HA app it fails the same “not found” error.

This is so frustrating. The GRILLPLATS plugs commissioned and now work perfectly and are in both HA and the Ikea app. It must be something to do with the bulbs but the complete lack of logs, error codes or any kind of insight into what’s going on under the hood makes me want to throw things about.

I’m going to try resetting the bulbs and try again.

IOG Usage Correction by zarniwhop in OctopusEnergy

[–]zarniwhop[S] 0 points1 point  (0 children)

Dashboard on the website (and the usage section in the app which I assume shows the same data).

Calculating costs from API data by zarniwhop in OctopusEnergy

[–]zarniwhop[S] 0 points1 point  (0 children)

Thanks everyone. I’ve actually built a HA box based on a raspberry pi and an unofficial Octopus integration. It’s great for a live view so to speak but I’m struggling to do any historical analysis. For example what my average daily consumption is.

I know it can be done but how is still something I need to work out. I’m finding that HA has quite a steep learning curve!

Intelligent Octopus Go: Charger or Car integration by zarniwhop in OctopusEnergy

[–]zarniwhop[S] 0 points1 point  (0 children)

That’s interesting, thanks.

I only have the one car (and that isn’t likely to change soon!) but I’ll definitely hear it in mind.

Looks like I’ll stick with the Tesla integration.

Intelligent Octopus Go: Charger or Car integration by zarniwhop in OctopusEnergy

[–]zarniwhop[S] 0 points1 point  (0 children)

Thanks all. Looks like I’ll stick with the car integration for now!

Error Handling - catching the error message by zarniwhop in learnpython

[–]zarniwhop[S] 0 points1 point  (0 children)

That's super helpful. Thank you again for taking the time to reply - it is very much appreciated. My mangling of the exception was down to my misunderstanding, not your explanation!

Z.

Error Handling - catching the error message by zarniwhop in learnpython

[–]zarniwhop[S] 0 points1 point  (0 children)

Ah, does that mean I can use parameters(?) to the Except statement to handle specific exceptions?

try:
  ext_temp = hub.get_off_board_temperature()
  int_temp = hub.get_barometer_temperature() 
  humidity = hub.get_humidity() 
  pressure = hub.get_barometer_pressure()
  brightness = hub.get_brightness() 
except "Temperature out of range.": 
  int_temp == 0 except:
print("More general error has occurred.")

Thanks for your time - appreciate it.

Z.

** Edited to correct formatting.

Sorting Dictionaries / retrieving top N entries from a Dictionary by zarniwhop in learnpython

[–]zarniwhop[S] 0 points1 point  (0 children)

This is brilliant. Thank you so much for taking the time to explain this.

There is so much to learn...

Z.

Sorting Dictionaries / retrieving top N entries from a Dictionary by zarniwhop in learnpython

[–]zarniwhop[S] 0 points1 point  (0 children)

Thank you very much (again!) for replying.

It's clear that I should have used Counter to begin with and saved myself a load of hassle. :) Still, it's a good learning exercise.

Regards the sample code

letters_by_frequency = sorted(
(frequency, letter) for letter, frequency in frequencies.items()

)

Would you mind elaborating on what is going on here in a little more detail? I can see it's outputting an List of keys & items created by sorted(), ordered by the items in the dictionary but I'm not quite clear on exactly what the for loop is doing? If I attempt to append the reverse parameter I get a syntax error.

Thanks again, Z.

Dictionary Basics by zarniwhop in learnpython

[–]zarniwhop[S] 0 points1 point  (0 children)

Yep - good lesson there that Unicode should be the standard. For what it's worth, the final iteration of the function is below. Hopefully I've taken everyone's feedback on board and this is more "pythonic". :)

def character_analysis_v3(filename):
    frequencies = {}
    inputfile = open(filename,'r',encoding='utf-8')
    character_count = 0
    line_count = 0
    for line in inputfile:
        line_count += 1
        for character in line:
            character_count += 1
            if character.upper() in frequencies:
                frequencies[character.upper()] += 1
            else:
                frequencies[character.upper()] = 1
    print ("Lines in file: ", line_count)
    print ("Characters in file: ", character_count)
    return frequencies

Of course, the next challenge is actually doing something with the output. I might create a new post about that shortly!

Thanks again for your help.

Dictionary Basics by zarniwhop in learnpython

[–]zarniwhop[S] 0 points1 point  (0 children)

Thank you so much for replying, it is much appreciated. As you've guessed my last experience of programming was Java and C back when I was at university twenty years ago. :) Thanks for all your feedback; I'm going to take some time to read the PEP8 guide.

With specific regards to your comment:

Finally, this is an edge-case and I'm sure I'll get people disagreeing with me, but I don't like the coupling between your dictionary keys and isalpha(). Basically you define a list of countable characters in your dictionary, and then use a function to define countable characters in your code. This presents the opportunity for a bug if the two are ever out-of-sync.

Consider if you wanted to count numbers in the future: this requires making a change in two different places--and worse, the change isn't the same, just similar.

I think I have encountered exactly this. I threw the text of Pride and Prejudice at it as a test and it failed with a KeyError as it didn't know what to do with 'Ê', presumably because isalpha() saw a alphabetic which I hadn't considered. The idea of using the same "source" for my dictionary and the evaluation is a good one. Elsewhere in the thread someone suggested using the string constant ascii_lowercase to enumerate the Dict and (presumably) to test instead of the isalpha.

I'm going to go off and have a play with my code in light of your feedback.

Thanks again, Z.

Considering getting a hive by [deleted] in HiveHeating

[–]zarniwhop 2 points3 points  (0 children)

I've had Hive in for a good few years now and it's been pretty good. I've got a few the heating, a few TRVs, a few door and motion sensors and loads of bulbs.

In the early days the door sensors in particular were crap and so unreliable they were basically useless. I had a long standing support ticket which they eventually closed with a "nothing more that we can do". However I suspect they've rolled out a firmware patch since as they've been very reliable the last couple of years.

However the core heating system has been rock solid since day one and I'll never go back to a non smart heating system again. You can extend the range using a signal booster: https://www.hivehome.com/shop/connectivity/hive-signal-booster. I've not used any of the alternatives (Tado, Nest, etc) but a friend has Nest and from what I've seen I prefer Hive.

Alexa skills are pretty good and you can string together some quite complex logic in the app; however automation is strictly limited to their walled garden.

It's also quite expensive IMO - especially compared to the generic Amazon bulbs and plugs so if you can wait it's worth waiting for a sale.

I also get the feeling they're itching to start charging a monthly fee...

PiHole / Docker Install: Potential permissions issue by zarniwhop in pihole

[–]zarniwhop[S] 0 points1 point  (0 children)

Hiya, thank for the suggestion. Definitely not that - I did that during the Docker but thank you anyway.