scottyphillips / pychonet

A simple to use library for interfacing with the ECHONETlite protocol
GNU General Public License v3.0
20 stars 17 forks source link

Example refactor /code sharing of temperature #2

Closed khcnz closed 3 years ago

khcnz commented 3 years ago

Hey Scotty, if you are making this level of changes in a new repo I'd suggest a couple of further changes (which I'm happy to help with if you agree).

1) Standard get methods (such as get temperature) shouldn't return json but should just return the data requested directly - thats how the old library worked at an interface level right? 2) A bunch of code sharing can be used in some places to greatly reduce template code

Let me know your thoughts, happy to help out with more.

khcnz commented 3 years ago

I think these changes would break how update() currently works, but that would be an easy fix.

scottyphillips commented 3 years ago

I’ll have a think about it and let you know

scottyphillips commented 3 years ago

Ive almost made all these changes but ill include the single message response function tomorrow. On the question of returning JSON vs values for getter methods the original code did in-fact return JSON for the getters but I have changed this to the raw values. Its kind of a philosophical question whether this is an improvement or not, as I didn't mind working with the JSON data.... it may change back to the way I had it to begin with..

scottyphillips commented 3 years ago

Closing this now as intent has been realised